CVS: plexus-container-new/src/test/org/apache/plexus DefaultServiceF.java,NONE,1.1 ServiceF.java,NONE,1.1 DefaultPlexusContainerTest.java,1.4,1.5 configuration.xml,1.6,1.7
[email protected] Sat, 31 May 2003 17:02:45 -0500
| Newsgroups | gmane.comp.java.plexus.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/plexus/plexus-container-new/src/test/org/apache/plexus
In directory eng.werken.com:/tmp/cvs-serv24889/src/test/org/apache/plexus
Modified Files:
DefaultPlexusContainerTest.java configuration.xml
Added Files:
DefaultServiceF.java ServiceF.java
Log Message:
o Adding preliminary support for the specification of addition configuration
files using the <configurations-directory/> element in the main configuration.
--- NEW FILE: DefaultServiceF.java ---
package org.apache.plexus;
import org.apache.plexus.logging.AbstractLogEnabled;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.logger.Logger;
/** This service implements all the start phases:
*
* LogEnabled
* Contexualize
* Serviceable
* Configurable
* Initializable
* Startable
*
*/
public class DefaultServiceF
extends AbstractLogEnabled
implements ServiceF, Contextualizable, Serviceable, Configurable, Initializable, Startable
{
boolean enableLogging;
boolean contextualize;
boolean service;
boolean configure;
boolean initialize;
boolean start;
boolean stop;
// ----------------------------------------------------------------------
// Lifecylce Management
// ----------------------------------------------------------------------
public void enableLogging( Logger logger )
{
enableLogging = true;
}
public void contextualize( Context context )
{
contextualize = true;
}
public void service( ServiceManager serviceManager )
{
service = true;
}
public void configure( Configuration configuration )
{
configure = true;
}
public void initialize()
throws Exception
{
initialize = true;
}
public void start()
throws Exception
{
start = true;
}
public void stop()
throws Exception
{
stop = true;
}
}
--- NEW FILE: ServiceF.java ---
package org.apache.plexus;
public interface ServiceF
{
static String ROLE = ServiceF.class.getName();
}
Index: DefaultPlexusContainerTest.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/test/org/apache/plexus/DefaultPlexusContainerTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- DefaultPlexusContainerTest.java 12 May 2003 18:57:28 -0000 1.4
+++ DefaultPlexusContainerTest.java 31 May 2003 22:02:43 -0000 1.5
@@ -14,11 +14,12 @@
public class DefaultPlexusContainerTest
extends TestCase
{
- /** */
+ /** Configuration stream to use for default container test. */
private InputStream configurationStream;
-
- /** */
+ /** Default container test classloader. */
private ClassLoader classLoader;
+ /** Basedir for default container test. */
+ private String basedir;
/**
* Constructor for the PlexusTest object
@@ -33,8 +34,8 @@
public void setUp()
throws Exception
{
+ basedir = System.getProperty( "basedir" );
classLoader = getClass().getClassLoader();
-
configurationStream = classLoader.getResourceAsStream( "/org/apache/plexus/configuration.xml" );
}
@@ -45,16 +46,15 @@
assertNotNull( configurationStream );
assertNotNull( classLoader );
- // Set the plexus.home for this test.
- System.setProperty( "plexus.home", System.getProperty( "basedir" ) + "/target/plexus-home" );
-
DefaultPlexusContainer container = new DefaultPlexusContainer();
+ container.addContextValue( "basedir", basedir );
+ container.addContextValue( "plexus.home", basedir + "/target/plexus-home" );
container.setConfigurationResource( new InputStreamReader( configurationStream ) );
container.initialize();
container.start();
int defaultComponents = 0;
- int testComponents = 5;
+ int testComponents = 6;
// These are some default components that we used internally. These components don't
// usually need to be replaced but they can be if the user desires.
Index: configuration.xml
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/test/org/apache/plexus/configuration.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- configuration.xml 12 May 2003 18:57:28 -0000 1.6
+++ configuration.xml 31 May 2003 22:02:43 -0000 1.7
@@ -1,7 +1,11 @@
<plexus>
+
+ <configurations-directory>${basedir}/src/test-input/configurations-directory</configurations-directory>
+
<service-repository>
<implementation>org.apache.plexus.service.repository.DefaultComponentRepository</implementation>
</service-repository>
+
<components>
<!--