CVS: plexus-container/src/test/org/apache/plexus DefaultPlexusContainerTest.java,1.7,1.8 DefaultServiceF.java,1.1,1.2 ServiceF.java,1.1,1.2

Jason van Zyl <[email protected]> Sun, 20 Jul 2003 21:16:33 -0500
Newsgroups gmane.comp.java.plexus.devel
Message-ID <[email protected]>
Update of /cvsroot/plexus/plexus-container/src/test/org/apache/plexus
In directory hogshead.codehaus.org:/tmp/cvs-serv30831/src/test/org/apache/plexus

Modified Files:
	DefaultPlexusContainerTest.java DefaultServiceF.java 
	ServiceF.java 
Log Message:
o Fixing a bug where configurations pulled in using the
'configurations-directory' directive were not being interpolated.


Index: DefaultPlexusContainerTest.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container/src/test/org/apache/plexus/DefaultPlexusContainerTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- DefaultPlexusContainerTest.java	21 Jul 2003 01:52:01 -0000	1.7
+++ DefaultPlexusContainerTest.java	21 Jul 2003 02:16:31 -0000	1.8
@@ -243,5 +243,10 @@
 
         assertNotNull( serviceF );
 
+        // The configuration for this service has been pulled in using the 'configurations-directory'
+        // directive and we want to make sure that context values are interpolated
+        // correctly. For the test we are using ${plexus.home} which should be
+        // interpolated so no "${" sequence should be present.
+        assertFalse( serviceF.getPlexusHome().indexOf( "${" ) > 0 );
     }
 }

Index: DefaultServiceF.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container/src/test/org/apache/plexus/DefaultServiceF.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- DefaultServiceF.java	31 May 2003 22:02:43 -0000	1.1
+++ DefaultServiceF.java	21 Jul 2003 02:16:31 -0000	1.2
@@ -5,6 +5,7 @@
 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.configuration.ConfigurationException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.activity.Initializable;
@@ -33,6 +34,8 @@
     boolean start;
     boolean stop;
 
+    String plexusHome;
+
     // ----------------------------------------------------------------------
     // Lifecylce Management
     // ----------------------------------------------------------------------
@@ -53,8 +56,11 @@
     }
 
     public void configure( Configuration configuration )
+        throws ConfigurationException
     {
         configure = true;
+
+        plexusHome = configuration.getChild( "plexus-home" ).getValue();
     }
 
     public void initialize()
@@ -73,5 +79,10 @@
         throws Exception
     {
         stop = true;
+    }
+
+    public String getPlexusHome()
+    {
+        return plexusHome;
     }
 }

Index: ServiceF.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container/src/test/org/apache/plexus/ServiceF.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ServiceF.java	31 May 2003 22:02:43 -0000	1.1
+++ ServiceF.java	21 Jul 2003 02:16:31 -0000	1.2
@@ -3,4 +3,6 @@
 public interface ServiceF
 {
     static String ROLE = ServiceF.class.getName();
+
+    String getPlexusHome();
 }