bloritsch 02/02/19 05:47:29
Modified: src/scratchpad/org/apache/avalon/excalibur/system
AbstractRoleManager.java ExcaliburRoleManager.java
Added: src/scratchpad/org/apache/avalon/excalibur/system/test
ContainerProfile.java ContainerProfile.xconf
ContainerProfile.xlog
ExcaliburRoleManagerTestCase.java
TestContainer.java
Log:
add Container tests
Revision Changes Path
1.2 +6 -5
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/AbstractRoleManager.java
Index: AbstractRoleManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/AbstractRoleManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractRoleManager.java 30 Jan 2002 15:44:06 -0000 1.1
+++ AbstractRoleManager.java 19 Feb 2002 13:47:29 -0000 1.2
@@ -11,7 +11,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -20,7 +19,7 @@
* information is hard-coded.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1 $ $Date: 2002/01/30 15:44:06 $
+ * @version CVS $Revision: 1.2 $ $Date: 2002/02/19 13:47:29 $
* @since 4.1
*/
public abstract class AbstractRoleManager
@@ -31,13 +30,13 @@
protected final ClassLoader m_loader;
/** Map for shorthand to class mapping */
- protected Map m_shorthands;
+ protected Map m_shorthands;
/** Map for role to classname mapping */
- protected Map m_classNames;
+ protected Map m_classNames;
/** Map for role to handler classname mapping */
- protected Map m_handlerNames;
+ protected Map m_handlerNames;
/** Parent <code>RoleManager</code> for nested resolution */
protected final RoleManager m_parent;
@@ -139,6 +138,8 @@
*/
public final Class getClassForName( final String shorthandName )
{
+ if (shorthandName == null) return null;
+
final Class component = (Class)m_shorthands.get( shorthandName );
if( null == component && null != m_parent )
1.4 +2 -2
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/ExcaliburRoleManager.java
Index: ExcaliburRoleManager.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/ExcaliburRoleManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ExcaliburRoleManager.java 30 Jan 2002 15:44:06 -0000 1.3
+++ ExcaliburRoleManager.java 19 Feb 2002 13:47:29 -0000 1.4
@@ -20,7 +20,7 @@
* information is hard-coded.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.3 $ $Date: 2002/01/30 15:44:06 $
+ * @version CVS $Revision: 1.4 $ $Date: 2002/02/19 13:47:29 $
* @since 4.1
*/
public class ExcaliburRoleManager
@@ -110,7 +110,7 @@
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
/* Set up SourceResolver relations */
- setup( shorts, classes, handlers, "jaxpath",
+ setup( shorts, classes, handlers, "resolver",
"org.apache.avalon.excalibur.source.SourceResolver",
"org.apache.avalon.excalibur.source.SourceResolverImpl",
"org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler" );
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/test/ContainerProfile.java
Index: ContainerProfile.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.test;
import junit.framework.TestCase;
import org.apache.avalon.excalibur.system.*;
import org.apache.avalon.excalibur.component.*;
import org.apache.avalon.excalibur.logger.*;
import org.apache.avalon.excalibur.testcase.*;
import org.apache.avalon.excalibur.monitor.Monitor;
import org.apache.avalon.excalibur.datasource.DataSourceComponent;
import org.apache.avalon.excalibur.xml.Parser;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.context.*;
import org.apache.avalon.framework.configuration.*;
import org.apache.avalon.framework.parameters.*;
import org.apache.avalon.framework.logger.*;
import java.net.URL;
/**
* Used as a basis for the PoolComparisonProfile Tests
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version $Id: ContainerProfile.java,v 1.1 2002/02/19 13:47:29 bloritsch
Exp $
*/
public final class ContainerProfile
extends TestCase
{
/**
* The TEST_SIZE defines the overall size of the tests. Decreasing this
will
* decrease the time the test takes to run, but also decrease its
efficiency.
*/
protected static final int TEST_SIZE = 50000;
protected static final int THREADS = 100;
protected static Throwable m_throwable = null;
protected static int m_getCount = 0;
protected Logger m_logger;
protected org.apache.log.Logger m_logKitLogger;
/*---------------------------------------------------------------
* Constructors
*-------------------------------------------------------------*/
public ContainerProfile(String name)
{
super(name);
// Set to debug to see more useful information.
org.apache.log.Logger logger =
org.apache.log.Hierarchy.getDefaultHierarchy().getLoggerFor(
"test" );
logger.setPriority( org.apache.log.Priority.INFO );
m_logKitLogger = logger;
m_logger = new LogKitLogger( logger );
}
/*---------------------------------------------------------------
* ECM vs. ContainerManager StartTimes
*-------------------------------------------------------------*/
/**
* Compare the ECM and ContainerManager start times.
*/
public void testCompare_ECM_ContainerManager_UseageTime()
throws Exception
{
resetMemory(); // Start clean
long ecmStart = System.currentTimeMillis();
ExcaliburComponentManager manager = new
ExcaliburComponentManager();
Context context = new DefaultContext();
manager.setLogger(m_logKitLogger);
manager.contextualize( context );
DefaultLogKitManager logmanager = new DefaultLogKitManager();
logmanager.setLogger(m_logKitLogger);
logmanager.contextualize(context);
logmanager.configure( getLogKitConfig() );
manager.setLogKitManager(logmanager);
manager.configure( getContainerConfig() );
manager.initialize();
long ecmStop = System.currentTimeMillis();
long ecmDuration = ecmStop - ecmStart;
resetMemory(); // Start clean
long cmStart = System.currentTimeMillis();
Parameters params = new Parameters();
params.setParameter( ContainerManager.CONTAINER_CLASS,
"org.apache.avalon.excalibur.system.test.TestContainer" );
params.setParameter( ContainerManager.CONTEXT_DIRECTORY, "./" );
params.setParameter( ContainerManager.WORK_DIRECTORY, "/tmp/" );
params.setParameter( ContainerManager.CONTAINER_CONFIG,
"resource://org/apache/avalon/excalibur/system/test/ContainerProfile.xconf" );
params.setParameter( ContainerManager.LOG_CATEGORY, "test" );
params.setParameter( ContainerManager.LOGKIT_CONFIG,
"resource://org/apache/avalon/excalibur/system/test/ContainerProfile.xlog" );
params.setParameter( ContainerManager.LOG_CATEGORY, "test" );
params.setParameter( ContainerManager.THREADS_CPU, "2" );
params.makeReadOnly();
ContainerManager cm = new ContainerManager( params, new
NullLogger() );
TestContainer container = (TestContainer) cm.getContainer();
assertNotNull(container);
long cmStop = System.currentTimeMillis();
long cmDuration = cmStop - cmStart;
// Show a summary
if ( m_logger.isInfoEnabled() )
{
m_logger.info( "Test Case: ECM_ContainerManager_StartTime" );
m_logger.info( " ECM time = " + ecmDuration + "ms." );
m_logger.info( " ContainerManager time = " + cmDuration +
"ms." );
double mult;
mult = ( cmDuration > 0 ? ( ecmDuration * 100 / cmDuration ) /
100.0 : Float.POSITIVE_INFINITY );
m_logger.info( " => ContainerManager is " + mult + " X as fast
as ExcaliburComponentManager on init." );
mult = ( ecmDuration > 0 ? ( cmDuration * 100 / ecmDuration ) /
100.0 : Float.POSITIVE_INFINITY );
m_logger.info( " => ExcaliburComponentManager is " + mult + " X
as fast as ContainerManager on init." );
}
resetMemory();
lookupTest( "Test Case: ECM_ContainerManager_UseageTime",
container.getCM(), manager );
resetMemory();
ecmStart = System.currentTimeMillis();
manager.dispose();
ecmStop = System.currentTimeMillis();
ecmDuration = ecmStop - ecmStart;
resetMemory();
cmStart = System.currentTimeMillis();
cm.dispose();
cmStop = System.currentTimeMillis();
cmDuration = cmStop - cmStart;
// Show a summary
if ( m_logger.isInfoEnabled() )
{
m_logger.info( "Test Case: ECM_ContainerManager_KillTime" );
m_logger.info( " ECM time = " + ecmDuration + "ms." );
m_logger.info( " ContainerManager time = " + cmDuration +
"ms." );
double mult;
mult = ( cmDuration > 0 ? ( ecmDuration * 100 / cmDuration ) /
100.0 : Float.POSITIVE_INFINITY );
m_logger.info( " => ContainerManager is " + mult + " X as fast
as ExcaliburComponentManager on dispose." );
mult = ( ecmDuration > 0 ? ( cmDuration * 100 / ecmDuration ) /
100.0 : Float.POSITIVE_INFINITY );
m_logger.info( " => ExcaliburComponentManager is " + mult + " X
as fast as ContainerManager on dispose." );
}
}
/*---------------------------------------------------------------
* Utility Methods
*-------------------------------------------------------------*/
protected void resetMemory()
{
System.gc();
System.gc();
// Let the system settle down.
try
{
Thread.sleep( 50 );
}
catch (InterruptedException e ) {}
Runtime runtime = Runtime.getRuntime();
m_logger.debug( "Memory: " + ( runtime.totalMemory() -
runtime.freeMemory() ) );
}
/**
* Get the LogKitManager Config file
*/
protected Configuration getLogKitConfig()
throws Exception
{
final String resourceName = this.getClass().getName().replace( '.',
'/' ) + ".xlog";
URL resource = this.getClass().getClassLoader().getResource(
resourceName );
return loadConfig( resource );
}
/**
* Get the Container Config file
*/
protected Configuration getContainerConfig()
throws Exception
{
final String resourceName = this.getClass().getName().replace( '.',
'/' ) + ".xconf";
URL resource = this.getClass().getClassLoader().getResource(
resourceName );
return loadConfig( resource );
}
/**
* Load Config
*/
protected Configuration loadConfig( URL path )
throws Exception
{
final DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
return builder.build( path.openStream() );
}
/**
* Get the short class name
*/
protected String getShortClassName( Object o )
{
String name = o.getClass().getName();
int pos = name.lastIndexOf('.');
if ( pos > 0 )
{
name = name.substring( pos + 1 );
}
return name;
}
/**
* The guts of the various test cases. Will dispose the pools
*/
protected void lookupTest(String name, ComponentManager cmA,
ComponentManager cmB)
throws Exception
{
m_logger.info( "Test Case: " + name );
// Get the short class names
final String cmAName = getShortClassName( cmA );
final String cmBName = getShortClassName( cmB );
// Start clean
resetMemory();
// Get the time for ecm
final long cmADuration = getLookupRunTime( cmA );
m_logger.info( " " + cmAName + " time = " + cmADuration + "ms. to
use " + TEST_SIZE + " calls on 3 components." );
resetMemory();
// Get the time for manager
final long cmBDuration = getLookupRunTime( cmB );
m_logger.info( " " + cmBName + " time = " + cmBDuration + "ms. to
use " + TEST_SIZE + " calls on 3 components." );
resetMemory();
// Show a summary
if ( m_logger.isInfoEnabled() )
{
double mult;
mult = ( cmADuration > 0 ? ( cmBDuration * 100 / cmADuration ) /
100.0 : Float.POSITIVE_INFINITY );
m_logger.info( " => " + cmAName + " is " + mult + " X as fast as
" + cmBName + "." );
mult = ( cmBDuration > 0 ? ( cmADuration * 100 / cmBDuration ) /
100.0 : Float.POSITIVE_INFINITY );
m_logger.info( " => " + cmBName + " is " + mult + " X as fast as
" + cmAName + "." );
}
}
protected long getLookupRunTime( ComponentManager manager )
{
// Create the runnable
LookupRunner runnable = new LookupRunner(manager, m_logger);
LatchedThreadGroup group = new LatchedThreadGroup( runnable, THREADS
);
group.enableLogging( m_logger );
long duration;
try
{
duration = group.go();
}
catch ( Throwable t )
{
// Throwable could have been thrown by one of the tests.
if (m_throwable == null) {
m_throwable = t;
}
duration = 0;
}
if ( m_throwable != null )
{
throw new CascadingAssertionFailedError( "Exception in test
thread.", m_throwable );
}
assertTrue( "m_getCount == 0 (" + m_getCount + ")", m_getCount == 0 );
return duration;
}
private static class LookupRunner implements Runnable
{
private Logger m_logger;
private ComponentManager m_manager;
private int m_getCount = 0;
private Throwable m_throwable = null;
public LookupRunner(ComponentManager manager, Logger logger)
{
m_manager = manager;
m_logger = logger;
}
public int getCount()
{
return m_getCount;
}
public Throwable getThrowable()
{
return m_throwable;
}
public void run()
{
// Perform this threads part of the test.
final int loops = (TEST_SIZE / THREADS);
for( int i = 0; i < loops; i++ )
{
Parser parser = null;
DataSourceComponent datasource = null;
Monitor monitor = null;
try
{
parser = (Parser) m_manager.lookup(Parser.ROLE);
// Make the loops hold the components longer than they
are released, but only slightly.
Thread.yield();
}
catch (Throwable t)
{
m_logger.error( "Unexpected error after " + m_getCount +
" iterations retrieved for Parser", t );
if (m_throwable == null) {
m_throwable = t;
}
return;
}
finally
{
if ( null != parser )
{
m_manager.release( parser );
}
}
try
{
datasource = (DataSourceComponent)
m_manager.lookup(DataSourceComponent.ROLE);
// Make the loops hold the components longer than they
are released, but only slightly.
Thread.yield();
}
catch (Throwable t)
{
m_logger.error( "Unexpected error after " + m_getCount +
" iterations retrieved for
DataSourceComponent", t );
if (m_throwable == null) {
m_throwable = t;
}
return;
}
finally
{
if ( null != datasource )
{
m_manager.release( datasource );
}
}
try
{
monitor = (Monitor) m_manager.lookup(Monitor.ROLE);
// Make the loops hold the components longer than they
are released, but only slightly.
Thread.yield();
}
catch (Throwable t)
{
m_logger.error( "Unexpected error after " + m_getCount +
" iterations retrieved for
DataSourceComponent", t );
if (m_throwable == null) {
m_throwable = t;
}
return;
}
finally
{
if ( null != monitor )
{
m_manager.release( monitor );
}
}
}
}
}
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/test/ContainerProfile.xconf
Index: ContainerProfile.xconf
===================================================================
<test>
<component id="test1"
class="org.apache.avalon.excalibur.datasource.JdbcDataSource"
role="org.apache.avalon.excalibur.datasource.DataSourceComponent"
handler="org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler"
logger="test">
<pool-controller min="5" max="10">
<keep-alive>SELECT 1 FROM groups</keep-alive>
</pool-controller>
<driver>@test.jdbc.driver@</driver>
<dburl>@test.jdbc.url@</dburl>
<user>@test.jdbc.user@</user>
<password>@test.jdbc.password@</password>
</component>
<component id="test2"
class="org.apache.avalon.excalibur.monitor.ActiveMonitor"
role="org.apache.avalon.excalibur.monitor.Monitor"
handler="org.apache.avalon.excalibur.system.handler.ThreadSafeComponentHandler"
logger="test">
<thread priority="10" frequency="1"/>
</component>
<component id="test3"
class="org.apache.avalon.excalibur.xml.JaxpParser"
role="org.apache.avalon.excalibur.xml.Parser"
handler="org.apache.avalon.excalibur.system.handler.PerThreadComponentHandler"
logger="test">
<parameter name="validate" value="false"/>
<parameter name="namespace-prefixes" value="false"/>
<parameter name="reuse-parsers" value="true"/>
<parameter name="stop-on-warning" value="false"/>
<parameter name="stop-on-recoverable-error" value="true"/>
</component>
</test>
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/test/ContainerProfile.xlog
Index: ContainerProfile.xlog
===================================================================
<logkit>
<factories>
<factory type="file"
class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
</factories>
<targets>
<file id="root">
<filename>container-test.log</filename>
<format type="extended">
%7.7{priority} %5.5{time} [%8.8{category}] (%{context}):
%{message}\n%{throwable}
</format>
</file>
</targets>
<categories>
<category name="test" log-level="INFO">
<log-target id-ref="root"/>
</category>
<category name="" log-level="INFO">
<log-target id-ref="root"/>
</category>
</categories>
</logkit>
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/test/ExcaliburRoleManagerTestCase.java
Index: ExcaliburRoleManagerTestCase.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.test;
import org.apache.avalon.excalibur.system.ExcaliburRoleManager;
import junit.framework.TestCase;
/**
* Configurable RoleManager implementation. It populates the RoleManager
* from a configuration hierarchy. This is based on the DefaultRoleManager
* in the org.apache.avalon.component package.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 13:47:29 $
* @since 4.1
*/
public class ExcaliburRoleManagerTestCase
extends TestCase
{
/**
* Default constructor--this RoleManager has no parent.
*/
public ExcaliburRoleManagerTestCase( String name )
{
super( name );
}
/**
* Test the shorthand return values.
*/
public void testShorthandReturnValues()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getClassForName( "cache" ),
Class.forName( "org.apache.avalon.excalibur.cache.DefaultCache" )
);
assertEquals(
roles.getClassForName( "lru-cache" ),
Class.forName( "org.apache.avalon.excalibur.cache.LRUCache" )
);
assertEquals(
roles.getClassForName( "jdbc-datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" )
);
assertEquals(
roles.getClassForName( "j2ee-datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" )
);
assertEquals(
roles.getClassForName( "informix-datasource" ),
Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" )
);
assertEquals(
roles.getClassForName( "i18n" ),
Class.forName( "org.apache.avalon.excalibur.i18n.BundleSelector" )
);
assertEquals(
roles.getClassForName( "monitor" ),
Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" )
);
assertEquals(
roles.getClassForName( "passive-monitor" ),
Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" )
);
assertEquals(
roles.getClassForName( "cache" ),
Class.forName( "org.apache.avalon.excalibur.cache.DefaultCache" )
);
assertEquals(
roles.getClassForName( "xalan-xpath" ),
Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" )
);
assertEquals(
roles.getClassForName( "jaxpath" ),
Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" )
);
assertEquals(
roles.getClassForName( "resolver" ),
Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" )
);
assertEquals(
roles.getClassForName( "parser" ),
Class.forName( "org.apache.avalon.excalibur.xml.JaxpParser" )
);
assertEquals(
roles.getClassForName( "xerces-parser" ),
Class.forName( "org.apache.avalon.excalibur.xml.XercesParser" )
);
}
/**
* Test the shorthand return values.
*/
public void testShorthandRemapReturnValues()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
"cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.LRUCache" ) ),
"lru-cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
"jdbc-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" ) ),
"j2ee-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" ) ),
"informix-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.i18n.BundleSelector" ) ),
"i18n"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
"monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" ) ),
"passive-monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
"cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" ) ),
"xalan-xpath"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" ) ),
"jaxpath"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" ) ),
"resolver"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
"parser"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.XercesParser" ) ),
"xerces-parser"
);
}
/**
* Test the shorthand return values.
*/
public void testRoleForClass()
throws Exception
{
ExcaliburRoleManager roles = new ExcaliburRoleManager( null,
this.getClass().getClassLoader() );
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
"cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.LRUCache" ) ),
"lru-cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.JdbcDataSource" ) ),
"jdbc-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.J2eeDataSource" ) ),
"j2ee-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.datasource.InformixDataSource" ) ),
"informix-datasource"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.i18n.BundleSelector" ) ),
"i18n"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.ActiveMonitor" ) ),
"monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.monitor.PassiveMonitor" ) ),
"passive-monitor"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.cache.DefaultCache" ) ),
"cache"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.XPathProcessorImpl" ) ),
"xalan-xpath"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.xpath.JaxenProcessorImpl" ) ),
"jaxpath"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.source.SourceResolverImpl" ) ),
"resolver"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.JaxpParser" ) ),
"parser"
);
assertEquals(
roles.getNameForClass( Class.forName(
"org.apache.avalon.excalibur.xml.XercesParser" ) ),
"xerces-parser"
);
}
}
1.1
jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/system/test/TestContainer.java
Index: TestContainer.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.avalon.excalibur.system.test;
import org.apache.avalon.excalibur.system.*;
import org.apache.avalon.framework.component.ComponentManager;
/**
* The Container is an interface used to mark the Containers in your system.
It
* exposes a protected getComponentManager() method so that the Container's
* Manager can expose that to the instantiating class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @version CVS $Revision: 1.1 $ $Date: 2002/02/19 13:47:29 $
*/
public final class TestContainer
extends AbstractContainer
{
public ComponentManager getCM()
{
return getComponentManager();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>