You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2003/04/22 14:37:12 UTC
cvs commit: avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test ContextManagerTestCase.java FortressConfigTestCase.java LifecycleExtensionManagerTestCase.java TestAccessor.java TestComponent.java TestCreator.java
bloritsch 2003/04/22 05:37:12
Modified: fortress default.properties
fortress/src/java/org/apache/avalon/fortress
ContainerManagerConstants.java MetaInfoEntry.java
fortress/src/java/org/apache/avalon/fortress/util
ContextManager.java ContextManagerConstants.java
FortressConfig.java LifecycleExtensionManager.java
fortress/src/test/org/apache/avalon/fortress/impl/extensions/test
InstrumentableCreatorTestCase.java
fortress/src/test/org/apache/avalon/fortress/test
MetaInfoEntryTestCase.java
Added: fortress/src/test/org/apache/avalon/fortress/impl/extensions/test
TestInstrumentManager.java
fortress/src/test/org/apache/avalon/fortress/util/test
ContextManagerTestCase.java
FortressConfigTestCase.java
LifecycleExtensionManagerTestCase.java
TestAccessor.java TestComponent.java
TestCreator.java
Log:
fix an error caught by a new testcase, add new testcases
Revision Changes Path
1.74 +1 -1 avalon-excalibur/fortress/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/default.properties,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- default.properties 22 Apr 2003 00:07:56 -0000 1.73
+++ default.properties 22 Apr 2003 12:37:06 -0000 1.74
@@ -125,7 +125,7 @@
build.optimize = off
build.deprecation = off
build.compress = false
-junit.failonerror = false
+junit.failonerror = true
# location of intermediate products
build.dir = build
1.5 +1 -6 avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/ContainerManagerConstants.java
Index: ContainerManagerConstants.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/ContainerManagerConstants.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ContainerManagerConstants.java 22 Mar 2003 12:46:32 -0000 1.4
+++ ContainerManagerConstants.java 22 Apr 2003 12:37:07 -0000 1.5
@@ -77,11 +77,6 @@
String CONFIGURATION = "impl.configuration";
/**
- * Assembly Configuration: The assembly info to give to the impl.
- */
- String ASSEMBLY_CONFIGURATION = "impl.assembly.config";
-
- /**
* Parameters: The Parameters object to give to the impl.
*/
String PARAMETERS = "impl.parameters";
1.3 +16 -12 avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/MetaInfoEntry.java
Index: MetaInfoEntry.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/MetaInfoEntry.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MetaInfoEntry.java 21 Apr 2003 17:40:17 -0000 1.2
+++ MetaInfoEntry.java 22 Apr 2003 12:37:08 -0000 1.3
@@ -55,8 +55,6 @@
import org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler;
import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* Keeps track of the relationship of all the associated meta data for a
@@ -77,8 +75,6 @@
/** Translate from lifestyle to component handler. */
private static final Map m_lifecycleMap;
- /** Used to split words in class names. */
- private static final Pattern upperCase = Pattern.compile( "([A-Z]+)" );
// Initialize the scope map
static
@@ -244,22 +240,30 @@
*/
public static final String createShortName( final String className )
{
- final Matcher matcher = upperCase.matcher( className.substring( className.lastIndexOf( '.' ) + 1 ) );
final StringBuffer shortName = new StringBuffer();
- while ( matcher.find() )
+ final char[] name = className.substring(
+ className.lastIndexOf( '.' ) + 1 ).toCharArray();
+ char last = '\0';
+
+ for (int i = 0; i < name.length; i++)
{
- if ( shortName.length() == 0 )
+ if (Character.isUpperCase(name[i]))
{
- matcher.appendReplacement( shortName, "$1" );
+ if ( Character.isLowerCase( last ) )
+ {
+ shortName.append('-');
+ }
+
+ shortName.append(Character.toLowerCase(name[i]));
}
else
{
- matcher.appendReplacement( shortName, "-$1" );
+ shortName.append(name[i]);
}
- }
- matcher.appendTail( shortName );
+ last = name[i];
+ }
return shortName.toString().toLowerCase();
}
1.23 +1 -41 avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java
Index: ContextManager.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ContextManager.java 21 Apr 2003 20:29:15 -0000 1.22
+++ ContextManager.java 22 Apr 2003 12:37:08 -0000 1.23
@@ -867,46 +867,6 @@
}
}
- /**
- * Will set up a Assembly Descriptor if none is supplied.
- *
- * <p>The postcondition is that
- * <code>childContext.get( LoggerManager.ROLE )</code> should
- * return a valid logger manager.</p>
- */
- protected void initializeAssemblyConfig()
- {
- try
- {
- m_containerManagerContext.put( ASSEMBLY_CONFIGURATION, m_rootContext.get( ASSEMBLY_CONFIGURATION ) );
- }
- catch ( ContextException ce )
- {
- final Configuration containerConfig = getConfiguration( ASSEMBLY_CONFIGURATION, ASSEMBLY_CONFIGURATION_URI );
- if ( containerConfig == null )
- {
- // No config.
- // Does the parent supply a logger manager?
- try
- {
- m_containerManagerContext.get( ASSEMBLY_CONFIGURATION );
-
- // OK, done.
- return;
- }
- catch ( ContextException cex )
- {
- // Guess there is none.
- return;
- }
- }
- else
- {
- m_containerManagerContext.put( ASSEMBLY_CONFIGURATION, containerConfig );
- }
- }
- }
-
private final class DestroyOrderComparator implements Comparator
{
public boolean equals( final Object other )
1.6 +1 -2 avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManagerConstants.java
Index: ContextManagerConstants.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManagerConstants.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ContextManagerConstants.java 29 Mar 2003 18:53:24 -0000 1.5
+++ ContextManagerConstants.java 22 Apr 2003 12:37:09 -0000 1.6
@@ -70,6 +70,5 @@
String ROLE_MANAGER_CONFIGURATION = "impl.roleManager.config";
String ROLE_MANAGER_CONFIGURATION_URI = "impl.roleManager.config.uri";
- String ASSEMBLY_CONFIGURATION_URI = "impl.assembly.config.uri";
String CONFIGURATION_URI = "impl.configuration.uri";
}
1.15 +1 -14 avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/FortressConfig.java
Index: FortressConfig.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/FortressConfig.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- FortressConfig.java 18 Apr 2003 20:02:30 -0000 1.14
+++ FortressConfig.java 22 Apr 2003 12:37:09 -0000 1.15
@@ -135,8 +135,6 @@
defaultContext.put( ClassLoader.class.getName(), classLoader );
defaultContext.put( ContextManagerConstants.CONFIGURATION_URI, "conf/system.xconf" );
defaultContext.put( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION_URI, "conf/logkit.xconf" );
- //defaultContext.put( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION_URI, "resource://ext/system.roles" );
- defaultContext.put( ContextManagerConstants.ASSEMBLY_CONFIGURATION_URI, "resource://ext/assembly.xml" );
defaultContext.makeReadOnly();
@@ -197,17 +195,6 @@
public void setContainerConfiguration( final String location )
{
m_context.put( ContextManagerConstants.CONFIGURATION_URI, location );
- }
-
- public void setAssemblyConfiguration( final Configuration config )
- {
- m_context.put( ContextManagerConstants.ASSEMBLY_CONFIGURATION, config );
- m_context.put( ContextManagerConstants.ASSEMBLY_CONFIGURATION_URI, null );
- }
-
- public void setAssemblyConfiguration( final String location )
- {
- m_context.put( ContextManagerConstants.ASSEMBLY_CONFIGURATION_URI, location );
}
public void setContextClassLoader( final ClassLoader loader )
1.8 +2 -2 avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/LifecycleExtensionManager.java
Index: LifecycleExtensionManager.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/LifecycleExtensionManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- LifecycleExtensionManager.java 18 Apr 2003 20:02:30 -0000 1.7
+++ LifecycleExtensionManager.java 22 Apr 2003 12:37:09 -0000 1.8
@@ -200,7 +200,7 @@
*/
public void insertCreatorExtension( final int position, final Creator extension )
{
- m_accessorExtensions.insert( position, extension );
+ m_creatorExtensions.insert( position, extension );
}
/**
1.4 +1 -16 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/impl/extensions/test/InstrumentableCreatorTestCase.java
Index: InstrumentableCreatorTestCase.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/impl/extensions/test/InstrumentableCreatorTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- InstrumentableCreatorTestCase.java 21 Apr 2003 20:30:04 -0000 1.3
+++ InstrumentableCreatorTestCase.java 22 Apr 2003 12:37:10 -0000 1.4
@@ -50,6 +50,7 @@
package org.apache.avalon.fortress.impl.extensions.test;
import junit.framework.TestCase;
+import junit.framework.Assert;
import org.apache.avalon.fortress.impl.extensions.InstrumentableCreator;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.lifecycle.Creator;
@@ -100,22 +101,6 @@
creator.create( m_instrumentable, m_context );
creator.destroy( m_instrumentable, m_context );
- }
-
- class TestInstrumentManager implements InstrumentManager
- {
- public void registerInstrumentable( Instrumentable instrumentable, String instrumentableName ) throws Exception
- {
- String name = instrumentable.getInstrumentableName();
- assertNotNull( name );
-
- name = "registered:" + instrumentableName;
- instrumentable.setInstrumentableName( name );
- assertEquals( name, instrumentable.getInstrumentableName() );
-
- assertNotNull( instrumentable.getChildInstrumentables() );
- assertNotNull( instrumentable.getInstruments() );
- }
}
class TestInstrumentable implements Instrumentable, InstrumentManageable
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/impl/extensions/test/TestInstrumentManager.java
Index: TestInstrumentManager.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.impl.extensions.test;
import junit.framework.Assert;
import org.apache.excalibur.instrument.InstrumentManager;
import org.apache.excalibur.instrument.Instrumentable;
/**
* TestInstrumentManager does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class TestInstrumentManager extends Assert implements InstrumentManager
{
public void registerInstrumentable( Instrumentable instrumentable, String instrumentableName ) throws Exception
{
String name = instrumentable.getInstrumentableName();
assertNotNull( name );
name = "registered:" + instrumentableName;
instrumentable.setInstrumentableName( name );
assertEquals( name, instrumentable.getInstrumentableName() );
assertNotNull( instrumentable.getChildInstrumentables() );
assertNotNull( instrumentable.getInstruments() );
}
}
1.5 +23 -0 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/test/MetaInfoEntryTestCase.java
Index: MetaInfoEntryTestCase.java
===================================================================
RCS file: /home/cvs/avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/test/MetaInfoEntryTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MetaInfoEntryTestCase.java 21 Apr 2003 20:30:05 -0000 1.4
+++ MetaInfoEntryTestCase.java 22 Apr 2003 12:37:11 -0000 1.5
@@ -214,6 +214,29 @@
}
}
+ public void testCreateShortName()
+ {
+ String start = "Regular";
+ String end = "regular";
+
+ assertEquals( end, MetaInfoEntry.createShortName(start));
+
+ start = "TwoWords";
+ end = "two-words";
+
+ assertEquals( end, MetaInfoEntry.createShortName(start));
+
+ start = "MANYcaps";
+ end = "manycaps";
+
+ assertEquals( end, MetaInfoEntry.createShortName( start ) );
+
+ start = "MANYcapsAndWords";
+ end = "manycaps-and-words";
+
+ assertEquals( end, MetaInfoEntry.createShortName( start ) );
+ }
+
private void checkMetaInfoEntry( MetaInfoEntry entry, Class handler, String name, boolean oneRole )
{
assertEquals( m_componentClass, entry.getComponentClass() );
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/ContextManagerTestCase.java
Index: ContextManagerTestCase.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.util.test;
import junit.framework.TestCase;
import org.apache.avalon.fortress.util.ContextManager;
import org.apache.avalon.fortress.util.FortressConfig;
import org.apache.avalon.framework.logger.NullLogger;
/**
* ContextManagerTestCase does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class ContextManagerTestCase extends TestCase
{
private ContextManager m_manager;
public ContextManagerTestCase( String name )
{
super( name );
}
public void setUp() throws Exception
{
FortressConfig config = new FortressConfig( FortressConfig.createDefaultConfig() );
config.setContainerConfiguration( "resource://org/apache/avalon/fortress/test/data/test1.xconf" );
config.setLoggerManagerConfiguration( "resource://org/apache/avalon/fortress/test/data/test1.xlog" );
m_manager = new ContextManager( config.getContext(), new NullLogger() );
m_manager.initialize();
}
public void testContextManager()
{
assertNotNull( m_manager.getChildContext() );
assertNotNull( m_manager.getContainerManagerContext() );
}
public void tearDown()
{
m_manager.dispose();
}
}
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/FortressConfigTestCase.java
Index: FortressConfigTestCase.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.util.test;
import junit.framework.TestCase;
import org.apache.avalon.excalibur.logger.DefaultLoggerManager;
import org.apache.avalon.excalibur.logger.LoggerManager;
import org.apache.avalon.fortress.ContainerManagerConstants;
import org.apache.avalon.fortress.RoleManager;
import org.apache.avalon.fortress.impl.extensions.test.TestInstrumentManager;
import org.apache.avalon.fortress.impl.role.FortressRoleManager;
import org.apache.avalon.fortress.util.ContextManagerConstants;
import org.apache.avalon.fortress.util.FortressConfig;
import org.apache.avalon.fortress.util.LifecycleExtensionManager;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.service.DefaultServiceManager;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.excalibur.event.Queue;
import org.apache.excalibur.event.impl.DefaultQueue;
import org.apache.excalibur.instrument.InstrumentManager;
import org.apache.excalibur.mpool.DefaultPoolManager;
import org.apache.excalibur.mpool.PoolManager;
import java.io.File;
/**
* FortressConfigTestCase does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class FortressConfigTestCase extends TestCase
{
private FortressConfig m_config;
public FortressConfigTestCase( String name )
{
super( name );
}
public void setUp() throws Exception
{
m_config = new FortressConfig( FortressConfig.createDefaultConfig() );
m_config.setCommandQueue( new DefaultQueue() );
m_config.setContextClassLoader( FortressConfigTestCase.class.getClassLoader() );
m_config.setInstrumentManager( new TestInstrumentManager() );
m_config.setLifecycleExtensionManager( new LifecycleExtensionManager() );
m_config.setLoggerCategory( "test" );
m_config.setLoggerManager( new DefaultLoggerManager() );
m_config.setNumberOfThreadsPerCPU( 10 );
m_config.setPoolManager( new DefaultPoolManager() );
m_config.setRoleManager( new FortressRoleManager() );
m_config.setServiceManager( new DefaultServiceManager() );
m_config.setThreadTimeout( 50 );
}
public void testFortressConfigUsingURI() throws Exception
{
m_config.setContainerClass( FullLifecycleComponent.class.getName() );
m_config.setContainerConfiguration( "resource://config.xml" );
m_config.setContextDirectory( "/" );
m_config.setWorkDirectory( "/" );
m_config.setInstrumentManagerConfiguration( "resource://config.xml" );
m_config.setLoggerManagerConfiguration( "resource://config.xml" );
m_config.setRoleManagerConfiguration( "resource://config.xml" );
checkContext( m_config.getContext(), true );
}
public void testFortressConfigUsingObject() throws Exception
{
m_config.setContainerClass( FullLifecycleComponent.class );
m_config.setContainerConfiguration( new DefaultConfiguration( "test" ) );
m_config.setContextDirectory( new File( "/" ) );
m_config.setWorkDirectory( new File( "/" ) );
m_config.setInstrumentManagerConfiguration( new DefaultConfiguration( "test" ) );
m_config.setLoggerManagerConfiguration( new DefaultConfiguration( "test" ) );
m_config.setRoleManagerConfiguration( new DefaultConfiguration( "test" ) );
checkContext( m_config.getContext(), false );
}
private void checkContext( Context context, boolean useURI ) throws Exception
{
assertNotNull( context.get( Queue.ROLE ) );
assertInstanceof( context.get( Queue.ROLE ), Queue.class );
assertNotNull( context.get( ContainerManagerConstants.CONTAINER_CLASS ) );
assertInstanceof( context.get( ContainerManagerConstants.CONTAINER_CLASS ), Class.class );
assertEquals( FullLifecycleComponent.class, context.get( ContainerManagerConstants.CONTAINER_CLASS ) );
assertNotNull( context.get( ClassLoader.class.getName() ) );
assertInstanceof( context.get( ClassLoader.class.getName() ), ClassLoader.class );
assertNotNull( context.get( ContextManagerConstants.CONTEXT_DIRECTORY ) );
assertInstanceof( context.get( ContextManagerConstants.CONTEXT_DIRECTORY ), File.class );
assertEquals( new File( "/" ), context.get( ContextManagerConstants.CONTEXT_DIRECTORY ) );
assertNotNull( context.get( ContextManagerConstants.WORK_DIRECTORY ) );
assertInstanceof( context.get( ContextManagerConstants.WORK_DIRECTORY ), File.class );
assertEquals( new File( "/" ), context.get( ContextManagerConstants.WORK_DIRECTORY ) );
assertNotNull( context.get( InstrumentManager.ROLE ) );
assertInstanceof( context.get( InstrumentManager.ROLE ), InstrumentManager.class );
assertNotNull( context.get( LifecycleExtensionManager.ROLE ) );
assertInstanceof( context.get( LifecycleExtensionManager.ROLE ), LifecycleExtensionManager.class );
assertNotNull( context.get( ContextManagerConstants.LOG_CATEGORY ) );
assertInstanceof( context.get( ContextManagerConstants.LOG_CATEGORY ), String.class );
assertEquals( "test", context.get( ContextManagerConstants.LOG_CATEGORY ) );
assertNotNull( context.get( LoggerManager.ROLE ) );
assertInstanceof( context.get( LoggerManager.ROLE ), LoggerManager.class );
assertNotNull( context.get( ContextManagerConstants.THREADS_CPU ) );
assertInstanceof( context.get( ContextManagerConstants.THREADS_CPU ), Integer.class );
assertEquals( new Integer( 10 ), context.get( ContextManagerConstants.THREADS_CPU ) );
assertNotNull( context.get( PoolManager.ROLE ) );
assertInstanceof( context.get( PoolManager.ROLE ), PoolManager.class );
assertNotNull( context.get( RoleManager.ROLE ) );
assertInstanceof( context.get( RoleManager.ROLE ), RoleManager.class );
assertNotNull( context.get( ContextManagerConstants.SERVICE_MANAGER ) );
assertInstanceof( context.get( ContextManagerConstants.SERVICE_MANAGER ), ServiceManager.class );
assertNotNull( context.get( ContextManagerConstants.THREAD_TIMEOUT ) );
assertInstanceof( context.get( ContextManagerConstants.THREAD_TIMEOUT ), Long.class );
assertEquals( new Long( 50 ), context.get( ContextManagerConstants.THREAD_TIMEOUT ) );
if ( useURI )
{
assertNotNull( context.get( ContextManagerConstants.CONFIGURATION_URI ) );
assertInstanceof( context.get( ContextManagerConstants.CONFIGURATION_URI ), String.class );
assertEquals( "resource://config.xml", context.get( ContextManagerConstants.CONFIGURATION_URI ) );
assertNotNull( context.get( ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION_URI ) );
assertInstanceof( context.get( ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION_URI ), String.class );
assertEquals( "resource://config.xml", context.get( ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION_URI ) );
assertNotNull( context.get( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION_URI ) );
assertInstanceof( context.get( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION_URI ), String.class );
assertEquals( "resource://config.xml", context.get( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION_URI ) );
assertNotNull( context.get( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION_URI ) );
assertInstanceof( context.get( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION_URI ), String.class );
assertEquals( "resource://config.xml", context.get( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION_URI ) );
}
else
{
assertNotNull( context.get( ContextManagerConstants.CONFIGURATION ) );
assertInstanceof( context.get( ContextManagerConstants.CONFIGURATION ), Configuration.class );
assertEquals( "test", ( (Configuration) context.get( ContextManagerConstants.CONFIGURATION ) ).getName() );
assertNotNull( context.get( ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION ) );
assertInstanceof( context.get( ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION ), Configuration.class );
assertEquals( "test", ( (Configuration) context.get( ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION ) ).getName() );
assertNotNull( context.get( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION ) );
assertInstanceof( context.get( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION ), Configuration.class );
assertEquals( "test", ( (Configuration) context.get( ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION ) ).getName() );
assertNotNull( context.get( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION ) );
assertInstanceof( context.get( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION ), Configuration.class );
assertEquals( "test", ( (Configuration) context.get( ContextManagerConstants.ROLE_MANAGER_CONFIGURATION ) ).getName() );
}
}
protected void assertInstanceof( Object obj, Class klass )
{
assertTrue( obj.getClass().getName() + " is not an instance of " + klass.getName(),
klass.isAssignableFrom( obj.getClass() ) );
}
}
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/LifecycleExtensionManagerTestCase.java
Index: LifecycleExtensionManagerTestCase.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.util.test;
import junit.framework.TestCase;
import org.apache.avalon.fortress.util.LifecycleExtensionManager;
import org.apache.avalon.framework.logger.NullLogger;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.lifecycle.Creator;
import org.apache.avalon.lifecycle.Accessor;
import java.util.Iterator;
/**
* LifecycleExtensionManagerTestCase does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class LifecycleExtensionManagerTestCase extends TestCase
{
private LifecycleExtensionManager m_manager;
public LifecycleExtensionManagerTestCase( String name )
{
super( name );
}
public void setUp()
{
m_manager = new LifecycleExtensionManager();
m_manager.enableLogging(new NullLogger());
}
public void testCreators()
{
TestCreator testCreator = new TestCreator(0);
assertEquals(0, m_manager.creatorExtensionsCount());
m_manager.addCreatorExtension(testCreator);
assertEquals(1, m_manager.creatorExtensionsCount());
assertEquals( testCreator, m_manager.getCreatorExtension( 0 ) );
int count = 0;
Iterator it = m_manager.creatorExtensionsIterator();
while (it.hasNext())
{
count++;
TestCreator creator = (TestCreator)it.next();
assertEquals(testCreator, creator);
assertEquals( testCreator.m_id, creator.m_id );
}
assertEquals(1, count);
TestCreator second = new TestCreator( 1 );
m_manager.insertCreatorExtension( 0, second );
assertEquals( 2, m_manager.creatorExtensionsCount() );
assertEquals( second.m_id, ( (TestCreator) m_manager.getCreatorExtension( 0 ) ).m_id );
assertEquals( testCreator.m_id, ( (TestCreator) m_manager.getCreatorExtension( 1 ) ).m_id );
m_manager.removeCreatorExtension( 0 );
assertEquals( 1, m_manager.creatorExtensionsCount() );
assertEquals( testCreator.m_id, ( (TestCreator) m_manager.getCreatorExtension( 0 ) ).m_id );
m_manager.clearCreatorExtensions();
assertEquals(0, m_manager.creatorExtensionsCount());
}
public void testAccessors()
{
TestAccessor testAccessor = new TestAccessor(0);
assertEquals( 0, m_manager.accessorExtensionsCount() );
m_manager.addAccessorExtension( testAccessor );
assertEquals(1, m_manager.accessorExtensionsCount());
assertEquals( testAccessor, m_manager.getAccessorExtension( 0 ) );
int count = 0;
Iterator it = m_manager.accessorExtensionsIterator();
while ( it.hasNext() )
{
count++;
TestAccessor accessor = (TestAccessor) it.next();
assertEquals( testAccessor, accessor );
assertEquals( testAccessor.m_id, accessor.m_id);
}
assertEquals( 1, count );
TestAccessor second = new TestAccessor(1);
m_manager.insertAccessorExtension(0, second);
assertEquals( 2, m_manager.accessorExtensionsCount());
assertEquals( second.m_id, ( (TestAccessor) m_manager.getAccessorExtension( 0 ) ).m_id );
assertEquals( testAccessor.m_id, ( (TestAccessor) m_manager.getAccessorExtension( 1 ) ).m_id );
m_manager.removeAccessorExtension(0);
assertEquals( 1, m_manager.accessorExtensionsCount() );
assertEquals( testAccessor.m_id, ( (TestAccessor) m_manager.getAccessorExtension( 0 ) ).m_id );
m_manager.clearAccessorExtensions();
assertEquals( 0, m_manager.accessorExtensionsCount());
}
public void testLifecycle() throws Exception
{
Accessor testAccessor = new TestAccessor(1);
Creator testCreator = new TestCreator(1);
m_manager.addCreatorExtension( testCreator );
m_manager.addAccessorExtension( testAccessor );
TestComponent component = new TestComponent();
Context context = new DefaultContext();
m_manager.executeCreationExtensions( component, context );
m_manager.executeAccessExtensions( component, context );
m_manager.executeReleaseExtensions( component, context );
m_manager.executeDestructionExtensions( component, context );
}
}
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/TestAccessor.java
Index: TestAccessor.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.util.test;
import org.apache.avalon.lifecycle.Accessor;
import org.apache.avalon.framework.context.Context;
import junit.framework.Assert;
/**
* TestAccessor does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class TestAccessor extends Assert implements Accessor
{
public final int m_id;
public TestAccessor( int id )
{
m_id = id;
}
public void access( Object object, Context context ) throws Exception
{
assertNotNull( object );
assertNotNull( context );
}
public void release( Object object, Context context )
{
assertNotNull( object );
assertNotNull( context );
}
}
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/TestComponent.java
Index: TestComponent.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.util.test;
import junit.framework.Assert;
/**
* TestComponent does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class TestComponent extends Assert
{
private boolean m_isCreated;
private boolean m_isDestroyed;
private boolean m_isAccessed;
private boolean m_isReleased;
public void create()
{
assertTrue( !m_isCreated);
assertTrue( !m_isAccessed );
assertTrue( !m_isReleased );
assertTrue( !m_isDestroyed );
m_isCreated = true;
assertTrue(m_isCreated);
}
public void access()
{
assertTrue( m_isCreated );
assertTrue( !m_isAccessed );
assertTrue( !m_isReleased );
assertTrue( !m_isDestroyed );
m_isAccessed = true;
assertTrue( m_isAccessed );
}
public void release()
{
assertTrue( m_isCreated );
assertTrue( m_isAccessed );
assertTrue( !m_isReleased );
assertTrue( !m_isDestroyed );
m_isReleased = true;
assertTrue( m_isReleased );
}
public void destroy()
{
assertTrue( m_isCreated );
assertTrue( m_isAccessed );
assertTrue( m_isReleased );
assertTrue( !m_isDestroyed );
m_isDestroyed = true;
assertTrue(m_isDestroyed);
}
}
1.1 avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/util/test/TestCreator.java
Index: TestCreator.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this software
without prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.fortress.util.test;
import org.apache.avalon.lifecycle.Creator;
import org.apache.avalon.framework.context.Context;
import junit.framework.Assert;
/**
* TestCreator does XYZ
*
* @author <a href="bloritsch.at.apache.org">Berin Loritsch</a>
* @version CVS $ Revision: 1.1 $
*/
public class TestCreator extends Assert implements Creator
{
public final int m_id;
public TestCreator(int id)
{
m_id = id;
}
/**
* Create stage handler.
*
* @param object the object that is being created
* @param context the context instance required by the create handler
* implementation
* @exception Exception if an error occurs
*/
public void create( Object object, Context context ) throws Exception
{
assertNotNull(object);
assertNotNull(context);
}
/**
* Destroy stage handler.
*
* @param object the object that is being destroyed
* @param context the context instance required by the handler
* implementation
*/
public void destroy( Object object, Context context )
{
assertNotNull( object );
assertNotNull( context );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org