throws Exception
{
//System.out.println( "setUp()" );
// Create and initialize a fortress container
FortressConfig config = new FortressConfig();
config.setContainerClass( DefaultContainer.class.getName() );
config.setContextDirectory( "./" );
config.setWorkDirectory( "./" );
// Set the container configuration. User is required to create it.
InputStream is = locateConfigurationResource( getClass(), m_className + ".xconf" );
if ( is == null )
{
fail( "Unable to locate the '" + m_className + ".xconf' resource in the same package "
+ "as " + getClass().getName() );
}
try
{
config.setContainerConfiguration( loadConfiguration( is ) );
}
finally
{
is.close();
}
// Set the logger manager configuration. The user may create it, but will fall back to
// using a default configuration.
is = locateConfigurationResource( getClass(), m_className + ".xlog" );
if ( is == null )
{
// Get the default
is = locateConfigurationResource(
FortressTestCase.class, "DefaultFortressTestCase.xlog" );
if ( is == null )
{
fail( "Unable to locate the 'DefaultFortressTestCase.xlog' default resource in "
+ "the same package as " + FortressTestCase.class.getName() );
}
}
try
{
config.setLoggerManagerConfiguration( loadConfiguration( is ) );
}
finally
{
is.close();
}
// Set up the instrument manager configuration if it exists, no problem it does not.
is = locateConfigurationResource( getClass(), m_className + ".instruments" );
if ( is != null )
{
try
{
config.setInstrumentManagerConfiguration( loadConfiguration( is ) );
}
finally
{
is.close();
}
}
Context context = initializeContext( config.getContext() );
m_containerManager = new DefaultContainerManager( config.getContext() );
ContainerUtil.initialize( m_containerManager );
m_container = (DefaultContainer)m_containerManager.getContainer();
m_serviceManager = m_container.getServiceManager();