You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/11/04 13:42:57 UTC

cvs commit: jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container ServiceContainerImpl.java

epugh       2004/11/04 04:42:57

  Modified:    yaafi/src/test/org/apache/fulcrum/yaafi
                        TestComponentTest.java TestComponentImpl.java
               yaafi/xdocs changes.xml
               yaafi/src/java/org/apache/fulcrum/yaafi/framework/container
                        ServiceContainerImpl.java
  Log:
  Fix for compoentns implement Dispoable interface never being disposed!
  
  Revision  Changes    Path
  1.3       +16 -1     jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/TestComponentTest.java
  
  Index: TestComponentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/TestComponentTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestComponentTest.java	30 Oct 2004 13:18:51 -0000	1.2
  +++ TestComponentTest.java	4 Nov 2004 12:42:57 -0000	1.3
  @@ -87,4 +87,19 @@
           assertEquals( ((TestComponentImpl) testComponent).foo, "FOO" );
           assertNotNull( ((TestComponentImpl) testComponent).appRoot );
       }
  +    
  +    /**
  +     * Verify bug fix for not calling dispose method of components
  +     * @throws Exception
  +     */
  +    public void testTestComponentDecomissioned() throws Exception
  +    {
  +        TestComponent testComponent = (TestComponent) this.lookup( 
  +            TestComponent.ROLE 
  +            );
  +        assertFalse( TestComponentImpl.decomissioned );
  +        tearDown();  //only way to work
  +       //this.release((Object)testComponent);
  +       assertTrue( TestComponentImpl.decomissioned );
  +    }    
   }
  
  
  
  1.2       +4 -1      jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/TestComponentImpl.java
  
  Index: TestComponentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/yaafi/src/test/org/apache/fulcrum/yaafi/TestComponentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestComponentImpl.java	19 Oct 2004 22:03:51 -0000	1.1
  +++ TestComponentImpl.java	4 Nov 2004 12:42:57 -0000	1.2
  @@ -82,10 +82,12 @@
       public File appRoot;
       public String foo;
       public String bar;
  +    public static boolean decomissioned;
   
       public void initialize() throws Exception
       {
           getLogger().debug("initialize() was called");
  +        decomissioned = false;
       }
   
       public void contextualize(Context context) throws ContextException
  @@ -106,6 +108,7 @@
       public void dispose()
       {
           getLogger().debug("dispose() was called");
  +        TestComponentImpl.decomissioned=true;
       }
   
       public void test()
  
  
  
  1.2       +4 -0      jakarta-turbine-fulcrum/yaafi/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/yaafi/xdocs/changes.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- changes.xml	19 Oct 2004 22:03:50 -0000	1.1
  +++ changes.xml	4 Nov 2004 12:42:57 -0000	1.2
  @@ -7,6 +7,10 @@
   
     <body>
       <release version="1.0.3" date="">
  +      <action dev="epugh" type="fix" due-to="Siegfried Goeschl">
  +        Container was missing call to decomission objects, therefore
  +        Disposeable interface never working.
  +      </action>        
         <action dev="epugh" type="update">
           Initial import to Fulcrum project.
         </action>
  
  
  
  1.2       +13 -13    jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
  
  Index: ServiceContainerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceContainerImpl.java	19 Oct 2004 22:03:49 -0000	1.1
  +++ ServiceContainerImpl.java	4 Nov 2004 12:42:57 -0000	1.2
  @@ -122,18 +122,18 @@
       public void configure(Configuration configuration) throws ConfigurationException
       {        
           this.setComponentRolesLocation(
  -            configuration.getChild(this.COMPONENT_ROLE_KEYS).getValue( 
  -                this.COMPONENT_ROLE_VALUE )
  +            configuration.getChild(COMPONENT_ROLE_KEYS).getValue( 
  +                COMPONENT_ROLE_VALUE )
                   );
   
           this.setComponentConfigurationLocation(
  -            configuration.getChild(this.COMPONENT_CONFIG_KEY).getValue(
  -                this.COMPONENT_CONFIG_VALUE )
  +            configuration.getChild(COMPONENT_CONFIG_KEY).getValue(
  +                COMPONENT_CONFIG_VALUE )
               	);
   
           this.setParametersLocation(
  -            configuration.getChild( this.COMPONENT_PARAMETERS_KEY).getValue(
  -                this.COMPONENT_PARAMETERS_VALUE )
  +            configuration.getChild( COMPONENT_PARAMETERS_KEY).getValue(
  +                COMPONENT_PARAMETERS_VALUE )
               	);
       }
   
  @@ -220,9 +220,9 @@
           // check for URN_AVALON_HOME - according to the Merlin Spec it is a file 
           // but Fulcrum passes in a string ... :-(
            
  -        if( this.isInContext( context, this.URN_AVALON_HOME ) )
  +        if( this.isInContext( context, URN_AVALON_HOME ) )
           { 
  -            entry = context.get( this.URN_AVALON_HOME );
  +            entry = context.get( URN_AVALON_HOME );
               
               if( entry instanceof String )
               {
  @@ -240,7 +240,7 @@
               
               if( entry instanceof File )
               {
  -                currApplicationRootDir = (File) context.get( this.URN_AVALON_HOME );    
  +                currApplicationRootDir = (File) context.get( URN_AVALON_HOME );    
               }
           }
           
  @@ -251,9 +251,9 @@
                   
           // check for URN_AVALON_TEMP
           
  -        if( this.isInContext( context, this.URN_AVALON_TEMP ) )
  +        if( this.isInContext( context, URN_AVALON_TEMP ) )
           {
  -            entry = context.get( this.URN_AVALON_TEMP );
  +            entry = context.get( URN_AVALON_TEMP );
               
               if( entry instanceof String )
               {
  @@ -262,7 +262,7 @@
               
               if( entry instanceof File )
               {
  -                currTempRootDir = (File) context.get( this.URN_AVALON_TEMP );    
  +                currTempRootDir = (File) context.get( URN_AVALON_TEMP );    
               }
           }        
   
  @@ -533,7 +533,7 @@
           for( int i=serviceList.size()-1; i>=0; i-- )
           {
               serviceComponent = (ServiceComponent) this.getServiceList().get(i);
  -
  +            this.decommision( serviceComponent );
           }
       }
           
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org