You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2005/01/20 16:47:31 UTC
cvs commit: jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer BaseUnitTest.java Container.java
sgoeschl 2005/01/20 07:47:31
Modified: yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer
BaseUnitTest.java Container.java
Log:
Synchronizing the changes between Fulcrum and my ongoing development
Revision Changes Path
1.3 +30 -16 jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/BaseUnitTest.java
Index: BaseUnitTest.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/BaseUnitTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BaseUnitTest.java 8 Nov 2004 09:49:37 -0000 1.2
+++ BaseUnitTest.java 20 Jan 2005 15:47:31 -0000 1.3
@@ -2,7 +2,7 @@
/*
* Copyright 2001-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
@@ -20,6 +20,7 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
+import org.apache.avalon.framework.service.ServiceException;
/**
* Base class for unit tests for components. This version doesn't load the container until the
@@ -91,11 +92,11 @@
*/
protected void tearDown() throws Exception
{
- if (container != null)
+ if (this.container != null)
{
- container.dispose();
+ this.container.dispose();
}
- container = null;
+ this.container = null;
}
/**
* Gets the configuration file name for the container should use for this test.
@@ -104,7 +105,7 @@
*/
protected String getConfigurationFileName()
{
- return configurationFileName;
+ return this.configurationFileName;
}
/**
* Gets the role file name for the container should use for this test.
@@ -113,7 +114,7 @@
*/
protected String getRoleFileName()
{
- return roleFileName;
+ return this.roleFileName;
}
/**
* Gets the parameter file name for the container should use for this test.
@@ -122,7 +123,7 @@
*/
protected String getParameterFileName()
{
- return parameterFileName;
+ return this.parameterFileName;
}
/**
* Returns an instance of the named component. Starts the container if it hasn't been started.
@@ -132,12 +133,12 @@
*/
protected Object lookup(String roleName) throws ComponentException
{
- if (container == null)
+ if (this.container == null)
{
- container = new Container();
- container.startup(getConfigurationFileName(), getRoleFileName(), getParameterFileName());
+ this.container = new Container();
+ this.container.startup(getConfigurationFileName(), getRoleFileName(), getParameterFileName());
}
- return container.lookup(roleName);
+ return this.container.lookup(roleName);
}
/**
* Releases the component
@@ -146,9 +147,9 @@
*/
protected void release(Component component)
{
- if (container != null)
+ if (this.container != null)
{
- container.release(component);
+ this.container.release(component);
}
}
/**
@@ -158,9 +159,22 @@
*/
protected void release(Object component)
{
- if (container != null)
+ if (this.container != null)
+ {
+ this.container.release(component);
+ }
+ }
+
+ /**
+ * Decommision the service
+ * @param name the name of the service
+ */
+ protected void decommision( String name )
+ throws ServiceException, Exception
+ {
+ if (this.container != null)
{
- container.release(component);
+ this.container.decommision( name );
}
}
}
1.3 +15 -0 jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java
Index: Container.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/Container.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Container.java 8 Nov 2004 09:49:37 -0000 1.2
+++ Container.java 20 Jan 2005 15:47:31 -0000 1.3
@@ -26,6 +26,7 @@
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceException;
import org.apache.fulcrum.yaafi.framework.container.ServiceContainer;
import org.apache.fulcrum.yaafi.framework.container.ServiceContainerImpl;
import org.apache.fulcrum.yaafi.framework.factory.ServiceManagerFactory;
@@ -178,4 +179,18 @@
{
ServiceManagerService.getServiceManager().release(component);
}
+
+ /**
+ * Decommision the service
+ * @param name the name of the service
+ */
+ protected void decommision( String name )
+ throws ServiceException, Exception
+ {
+ if( this.manager != null )
+ {
+ this.manager.decommision( name );
+ }
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org