mcconnell 2004/03/07 14:05:49
Added: merlin/facilities/finder README.TXT maven.xml
project.properties project.xml
merlin/facilities/finder/api maven.xml project.xml
merlin/facilities/finder/api/src/java/org/apache/avalon/finder
Finder.java FinderException.java
merlin/facilities/finder/impl maven.xml project.xml
merlin/facilities/finder/impl/src/java/org/apache/avalon/finder/impl
DefaultFinder.java
merlin/facilities/finder/impl/src/test/org/apache/avalon/finder/impl/test
DefaultFinderTestCase.java
merlin/facilities/finder/test/conf block.xml
merlin/facilities/finder/test maven.xml project.xml
merlin/facilities/finder/test/src/java/org/apache/avalon/finder/test
DefaultGizmo.java DefaultWidget.java Gizmo.java
Widget.java
merlin/facilities/finder/test/src/test/org/apache/avalon/finder/test
StandardTestCase.java
Log:
A framework for pull-based service activation. The purpose
of this facility is to address the resolution of ECM and Fortress
semantics whereby services are activated as a result of a request
as opposed to the classic compositon approach of push-based
directives.
Revision Changes Path
1.1 avalon/merlin/facilities/finder/README.TXT
Index: README.TXT
===================================================================
A framework for pull based service activation. The purpose
of this facility is to address the resolution of ECM and Fortress
semantics whereby services are activated as a result of a request
as opposed to the classic compositon approach of push-based
directives.
To build the facility:
$ cd merlin\facilities\finder
$ merlin avalon:build
1.1 avalon/merlin/facilities/finder/maven.xml
Index: maven.xml
===================================================================
<project default="avalon:build" xmlns:maven="jelly:maven" xmlns:j="jelly:core"
xmlns:util="jelly:util" xmlns:ant="jelly:ant">
<goal name="avalon:clean" prereqs="clean">
<maven:reactor
basedir="${basedir}"
includes="*/project.xml"
excludes="project.xml,target/**"
goals="clean"
banner="Cleaning:"
ignoreFailures="true"/>
</goal>
<goal name="avalon:build">
<maven:reactor basedir="${basedir}"
includes="*/project.xml"
excludes="project.xml,target/**"
goals=""
banner="Building:"
ignoreFailures="false"
postProcessing="true" />
<ant:copy todir="${maven.build.dir}">
<j:forEach var="child" items="${reactorProjects}">
<ant:fileset dir="${child.file.parentFile}/target">
<ant:include name="${child.artifactId}-${child.currentVersion}.jar"/>
</ant:fileset>
</j:forEach>
</ant:copy>
</goal>
<goal name="avalon:site" prereqs="avalon:build,xjavadoc,site"/>
<goal name="xjavadoc">
<maven:reactor basedir="${basedir}"
includes="*/project.xml"
excludes="project.xml"
banner="Site Prep:"
ignoreFailures="false"
postProcessing="true" />
<ant:mkdir dir="${maven.build.dir}/docs/api" />
<ant:property name="copyright"
value="Copyright &copy; ${year} ${pom.organization.name}. All Rights
Reserved." />
<ant:path id="template.classpath">
<j:forEach var="child" items="${reactorProjects}">
<j:set var="deps" value="${child.dependencies}"/>
<j:forEach var="dep" items="${deps}">
<ant:pathelement
path="${maven.repo.local}/${dep.getArtifactDirectory()}/jars/${dep.getArtifact()}"/>
</j:forEach>
</j:forEach>
</ant:path>
<util:tokenize var="links" delim=","
trim="true">${maven.javadoc.links}</util:tokenize>
<ant:property name="title" value="${pom.name} ${pom.currentVersion}"/>
<ant:javadoc destdir="${maven.build.dir}/docs/api"
doctitle="<h1>${title}</h1>"
noindex="false" author="true" use="true"
windowtitle="${title}"
bottom="${copyright}"
additionalparam="-breakiterator -J-Xmx128m "
packagenames="*,org.*">
<j:forEach var="packageGroup" items="${pom.packageGroups}">
<group title="${packageGroup.title}" packages="${packageGroup.packages}"/>
</j:forEach>
<j:forEach var="child" items="${reactorProjects}">
<sourcepath path="${child.file.parentFile}/src/java"/>
</j:forEach>
<j:forEach var="link" items="${links}">
<ant:link href="${link.trim()}"/>
</j:forEach>
<classpath>
<path refid="template.classpath"/>
</classpath>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/" />
<!-- allow custom tags -->
<util:tokenize var="listOfTags" delim="
">${maven.javadoc.customtags}</util:tokenize>
<j:forEach var="someTag" items="${listOfTags}">
<j:set var="nameVar" value="${someTag}.name"/>
<j:set var="name" value="${context.findVariable(nameVar)}"/>
<j:set var="descriptionVar" value="${someTag}.description"/>
<j:set var="description" value="${context.findVariable(descriptionVar)}"/>
<j:set var="enabledVar" value="${someTag}.enabled"/>
<j:set var="enabled" value="${context.findVariable(enabledVar)}"/>
<j:set var="scopeVar" value="${someTag}.scope"/>
<j:set var="scope" value="${context.findVariable(scopeVar)}"/>
<ant:tag name="${name}" description="${description}"
enabled="${enabled}" scope="${scope}"/>
</j:forEach>
</ant:javadoc>
</goal>
<goal name="template">
<ant:delete dir="${maven.build.dir}/template" />
<ant:mkdir dir="${maven.build.dir}/template" />
<ant:copy todir="${maven.build.dir}/template">
<ant:fileset dir=".">
<ant:include name="LICENSE*"/>
<ant:include name="project.properties"/>
<ant:include name="maven.xml"/>
<ant:include name="project.xml"/>
<ant:include name="master.xml"/>
</ant:fileset>
</ant:copy>
<ant:copy todir="${maven.build.dir}/template">
<ant:fileset dir="${basedir}">
<include name="api/**"/>
<include name="impl/**"/>
<include name="xdocs/**"/>
<exclude name="**/target/**"/>
<exclude name="**/*.log"/>
</ant:fileset>
</ant:copy>
</goal>
</project>
1.1 avalon/merlin/facilities/finder/project.properties
Index: project.properties
===================================================================
#
# custom tags spec
#
maven.javadoc.customtags = component service
component.name = avalon.component
component.description = Component:
component.enabled = true
component.scope = class
service.name = avalon.service
service.description = Service Export:
service.enabled = true
service.scope = class
1.1 avalon/merlin/facilities/finder/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<groupId>avalon-finder</groupId>
<name>Avalon Finder</name>
<currentVersion>1.0</currentVersion>
<shortDescription>Avalon Service Finder.</shortDescription>
<packageGroups>
<packageGroup>
<title>Avalon Finder API</title>
<packages>org.apache.avalon.finder</packages>
</packageGroup>
<packageGroup>
<title>Avalon Finder Implementation</title>
<packages>org.apache.avalon.finder.*</packages>
</packageGroup>
</packageGroups>
<build>
<nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress>
<sourceDirectory>${basedir}/src/java</sourceDirectory>
<unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*TestCase.*</include>
</includes>
<excludes>
<exclude>**/Abstract*.*</exclude>
</excludes>
<resources>
<resource>
<directory>${basedir}/src/test</directory>
<includes>
<include>**/*.dtd</include>
<include>**/*.properties</include>
<include>**/*.x*</include>
</includes>
</resource>
</resources>
</unitTest>
<resources>
<resource>
<directory>${basedir}/src/java</directory>
<includes>
<include>**/*.dtd</include>
<include>**/*.properties</include>
<include>**/*.x*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/conf</directory>
<targetPath>BLOCK-INF</targetPath>
<includes>
<include>block.xml</include>
</includes>
</resource>
</resources>
<jars></jars>
</build>
</project>
1.1 avalon/merlin/facilities/finder/api/maven.xml
Index: maven.xml
===================================================================
<project default="jar:install"/>
1.1 avalon/merlin/facilities/finder/api/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../../../project.xml</extend>
<groupId>avalon-finder</groupId>
<id>avalon-finder-api</id>
<name>Avalon Finder API</name>
<package>org.apache.avalon.finder</package>
<currentVersion>SNAPSHOT</currentVersion>
<shortDescription>Avalon Finder API</shortDescription>
</project>
1.1
avalon/merlin/facilities/finder/api/src/java/org/apache/avalon/finder/Finder.java
Index: Finder.java
===================================================================
/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder;
/**
* Defintion of the Finder service contract.
*/
public interface Finder
{
Object find( Class service ) throws FinderException;
}
1.1
avalon/merlin/facilities/finder/api/src/java/org/apache/avalon/finder/FinderException.java
Index: FinderException.java
===================================================================
/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder;
/**
* Exception to indicate that there was a finder related error.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2004/03/07 22:05:48 $
*/
public class FinderException
extends Exception
{
private final Throwable m_cause;
/**
* Construct a new <code>FinderException</code> instance.
*
* @param message The detail message for this exception.
*/
public FinderException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>FinderException</code> instance.
*
* @param message The detail message for this exception.
* @param cause the root cause of the exception
*/
public FinderException( final String message, final Throwable cause )
{
super( message );
m_cause = cause;
}
/**
* Return the causal exception.
* @return the cause
*/
public Throwable getCause()
{
return m_cause;
}
}
1.1 avalon/merlin/facilities/finder/impl/maven.xml
Index: maven.xml
===================================================================
<project default="jar:install">
<preGoal name="java:compile">
<attainGoal name="avalon:meta"/>
</preGoal>
</project>
1.1 avalon/merlin/facilities/finder/impl/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../../../project.xml</extend>
<groupId>avalon-finder</groupId>
<id>avalon-finder-impl</id>
<name>Avalon Finder Implementation</name>
<currentVersion>SNAPSHOT</currentVersion>
<shortDescription>Avalon Finder Implementation</shortDescription>
<package>org.apache.avalon.finder.impl</package>
<dependencies>
<!-- implementation dependencies -->
<dependency>
<groupId>avalon-finder</groupId>
<artifactId>avalon-finder-api</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
<groupId>avalon-composition</groupId>
<artifactId>avalon-composition-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-meta</groupId>
<artifactId>avalon-meta-api</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
1.1
avalon/merlin/facilities/finder/impl/src/java/org/apache/avalon/finder/impl/DefaultFinder.java
Index: DefaultFinder.java
===================================================================
/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.impl;
import org.apache.avalon.finder.Finder;
import org.apache.avalon.finder.FinderException;
import org.apache.avalon.composition.model.ContainmentModel;
import org.apache.avalon.composition.model.DeploymentModel;
import org.apache.avalon.composition.model.ComponentModel;
import org.apache.avalon.composition.model.ProviderNotFoundException;
import org.apache.avalon.composition.model.AssemblyException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.meta.info.ReferenceDescriptor;
/**
* A default implementation of a finder service that provides
* support for pull-based service activation semantics. The default
* implementation deals with activation of standard avalon components
* (i.e. components that declare semantics using the Avalon Meta
* contract).
*
* @avalon.component name="finder" lifestyle="singleton"
* @avalon.service type="org.apache.avalon.finder.Finder"
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2004/03/07 22:05:49 $
*/
public class DefaultFinder implements Finder, Contextualizable
{
//---------------------------------------------------------
// immutable state
//---------------------------------------------------------
/**
* The logging channel for this component.
*/
private final Logger m_logger;
//---------------------------------------------------------
// mutable state
//---------------------------------------------------------
private ContainmentModel m_model;
//---------------------------------------------------------
// constructor
//---------------------------------------------------------
/**
* Creation of a new default finder.
*
* @param logger the container assigned logging channel
*/
public DefaultFinder( final Logger logger )
{
if( null == logger )
{
throw new NullPointerException( "logger" );
}
m_logger = logger;
}
//---------------------------------------------------------
// Contextualizable
//---------------------------------------------------------
/**
* Contextulaization of the facility by the container during
* which we are supplied with the relative root containment model.
*
* @param context the supplied context
* @avalon.entry key="urn:composition:containment.model"
* type="org.apache.avalon.composition.model.ContainmentModel"
* @exception ContextException if a contextualization error occurs
*/
public void contextualize( Context context ) throws ContextException
{
m_model =
(ContainmentModel) context.get(
"urn:composition:containment.model" );
}
//---------------------------------------------------------
// Finder
//---------------------------------------------------------
public Object find( Class type ) throws FinderException
{
DeploymentModel model = resolveModel( type );
try
{
model.commission();
return model.resolve();
}
catch( Throwable e )
{
final String error =
"Service establishment failure for type ["
+ type.getName() + "].";
throw new FinderException( error, e );
}
}
public DeploymentModel resolveModel( Class type ) throws FinderException
{
ReferenceDescriptor reference =
new ReferenceDescriptor( type.getName() );
try
{
return (ComponentModel) m_model.getModel( reference );
}
catch( ProviderNotFoundException e )
{
final String error =
"Unresolvable type [" + type.getName() + "].";
throw new FinderException( error );
}
catch( AssemblyException e )
{
throw new FinderException( e.getMessage(), e.getCause() );
}
catch( Throwable e )
{
final String error =
"Unexpected resolution failure for type ["
+ type.getName() + "].";
throw new FinderException( error, e );
}
}
//---------------------------------------------------------
// private implementation
//---------------------------------------------------------
private Logger getLogger()
{
return m_logger;
}
}
1.1
avalon/merlin/facilities/finder/impl/src/test/org/apache/avalon/finder/impl/test/DefaultFinderTestCase.java
Index: DefaultFinderTestCase.java
===================================================================
/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.impl.test;
import junit.framework.TestCase;
import org.apache.avalon.finder.Finder;
import org.apache.avalon.finder.FinderException;
import org.apache.avalon.finder.impl.DefaultFinder;
/**
* DefaultFinder testcase.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2004/03/07 22:05:49 $
*/
public class DefaultFinderTestCase extends TestCase
{
//--------------------------------------------------------
// constructors
//--------------------------------------------------------
/**
* @param name the name of the test case
*/
public DefaultFinderTestCase( String name )
{
super( name );
}
//--------------------------------------------------------
// testcase
//--------------------------------------------------------
public void testFinderConstructor() throws Exception
{
try
{
Finder finder = new DefaultFinder( null );
}
catch( NullPointerException npe )
{
// good
}
catch( Throwable bad )
{
fail( "unexpected constructor error: " + bad.toString() );
}
}
}
1.1 avalon/merlin/facilities/finder/test/conf/block.xml
Index: block.xml
===================================================================
<container name="test">
<classloader>
<classpath>
<repository>
<resource id="avalon-finder:avalon-finder-api" version="SNAPSHOT"/>
<resource id="avalon-finder:avalon-finder-impl" version="SNAPSHOT"/>
</repository>
<fileset dir="target">
<include name="classes"/>
<include name="test-classes"/>
</fileset>
</classpath>
</classloader>
<component name="finder" class="org.apache.avalon.finder.impl.DefaultFinder"/>
</container>
1.1 avalon/merlin/facilities/finder/test/maven.xml
Index: maven.xml
===================================================================
<project default="test:test">
<preGoal name="java:compile">
<attainGoal name="avalon:meta"/>
</preGoal>
</project>
1.1 avalon/merlin/facilities/finder/test/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../../../project.xml</extend>
<groupId>avalon-finder</groupId>
<id>avalon-finder-test</id>
<name>Avalon Finder Test</name>
<currentVersion>SNAPSHOT</currentVersion>
<shortDescription>Avalon Finder Test</shortDescription>
<package>org.apache.avalon.finder</package>
<dependencies>
<!-- implementation dependencies -->
<dependency>
<groupId>avalon-finder</groupId>
<artifactId>avalon-finder-api</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>4.1.5</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-unit</artifactId>
<version>3.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
1.1
avalon/merlin/facilities/finder/test/src/java/org/apache/avalon/finder/test/DefaultGizmo.java
Index: DefaultGizmo.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.test;
import java.io.File;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
/**
* A component that implements the Gizmo service.
*
* @avalon.component name="gizmo" lifestyle="singleton"
* @avalon.service type="org.apache.avalon.finder.test.Gizmo"
*/
public class DefaultGizmo implements Gizmo, Contextualizable
{
//---------------------------------------------------------
// immutable state
//---------------------------------------------------------
/**
* The logging channel supplied by the container.
*/
private final Logger m_logger;
//---------------------------------------------------------
// constructor
//---------------------------------------------------------
/**
* Creation of a new hello facility.
* @param logger a logging channel
*/
public DefaultGizmo( Logger logger )
{
m_logger = logger;
m_logger.debug( "I've been created" );
}
//---------------------------------------------------------
// Contextualizable
//---------------------------------------------------------
/**
* Contextualization of the gizmo by the container.
* @param context the supplied runtime context
* @avalon.entry key="urn:avalon:home"
*/
public void contextualize( Context context ) throws ContextException
{
File home = (File) context.get( "urn:avalon:home" );
m_logger.debug( "home: " + home );
}
//---------------------------------------------------------
// Object
//---------------------------------------------------------
public String toString()
{
return "[gizmo:" + System.identityHashCode( this ) + "]";
}
}
1.1
avalon/merlin/facilities/finder/test/src/java/org/apache/avalon/finder/test/DefaultWidget.java
Index: DefaultWidget.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.test;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.activity.Disposable;
/**
* A component that implements the Widget service.
*
* @avalon.component name="widget" lifestyle="singleton"
* @avalon.service type="org.apache.avalon.finder.test.Widget"
*/
public class DefaultWidget implements Widget, Configurable, Disposable
{
//---------------------------------------------------------
// immutable state
//---------------------------------------------------------
/**
* The logging channel supplied by the container.
*/
private final Logger m_logger;
//---------------------------------------------------------
// constructor
//---------------------------------------------------------
/**
* Creation of a new hello facility.
* @param logger a logging channel
*/
public DefaultWidget( Logger logger )
{
m_logger = logger;
m_logger.debug( "hello" );
}
//---------------------------------------------------------
// Configurable
//---------------------------------------------------------
/**
* Configuration of the gizmo by the container.
* @param config the supplied configuration
*/
public void configure( Configuration config ) throws ConfigurationException
{
final String message = config.getChild( "message" ).getValue( null );
if( null != message )
{
m_logger.debug( message );
}
}
//---------------------------------------------------------
// Disposable
//---------------------------------------------------------
/**
* End-of-life processing initiated by the container.
*/
public void dispose()
{
m_logger.debug( "time to die" );
}
//---------------------------------------------------------
// Object
//---------------------------------------------------------
public String toString()
{
return "[widget:" + System.identityHashCode( this ) + "]";
}
}
1.1
avalon/merlin/facilities/finder/test/src/java/org/apache/avalon/finder/test/Gizmo.java
Index: Gizmo.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.test;
/**
* The Gizmo service interface.
*/
public interface Gizmo
{
}
1.1
avalon/merlin/facilities/finder/test/src/java/org/apache/avalon/finder/test/Widget.java
Index: Widget.java
===================================================================
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.test;
/**
* The Widget service interface.
*/
public interface Widget
{
}
1.1
avalon/merlin/facilities/finder/test/src/test/org/apache/avalon/finder/test/StandardTestCase.java
Index: StandardTestCase.java
===================================================================
/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avalon.finder.test;
import org.apache.avalon.merlin.unit.AbstractMerlinTestCase;
import org.apache.avalon.finder.Finder;
import org.apache.avalon.finder.FinderException;
/**
* DefaultFinder testcase.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2004/03/07 22:05:49 $
*/
public class StandardTestCase extends AbstractMerlinTestCase
{
//--------------------------------------------------------
// constructors
//--------------------------------------------------------
/**
* @param name the name of the test case
*/
public StandardTestCase( String name )
{
super( name );
}
//--------------------------------------------------------
// testcase
//--------------------------------------------------------
public void testWidgetResolution() throws Exception
{
Finder finder = (Finder) resolve( "/test/finder" );
assertNotNull( "finder", finder );
try
{
Widget widget = (Widget) finder.find( Widget.class );
}
catch( Throwable notOk )
{
fail( "Unexpected error: " + notOk );
}
}
public void testJunkResolution() throws Exception
{
Finder finder = (Finder) resolve( "/test/finder" );
try
{
Object object = finder.find( StandardTestCase.class );
}
catch( FinderException ok )
{
// ok
}
catch( Throwable e )
{
fail( "Unexpected error: " + e );
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]