avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/testc TestC.java TestC.xinfo
Date Sat, 19 Jul 2003 06:16:43 GMT
mcconnell    2003/07/18 23:16:43

  Modified:    merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        DefaultContainmentModel.java
                        DefaultDependencyModel.java
                        DefaultDeploymentModel.java DefaultModel.java
                        Resources.properties
               merlin/composition/src/test/conf dependency.xml
               merlin/composition/src/test/org/apache/avalon/composition/model/test
                        DependencyTestCase.java
               merlin/composition/src/test/org/apache/avalon/composition/model/testc
                        TestC.java TestC.xinfo
  Log:
  Validation of explicit selection under the test case including relative references.
  
  Revision  Changes    Path
  1.14      +2 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultContainmentModel.java	17 Jul 2003 21:21:57 -0000	1.13
  +++ DefaultContainmentModel.java	19 Jul 2003 06:16:42 -0000	1.14
  @@ -403,6 +403,6 @@
   
       public String toString()
       {
  -        return "[containment model: " + getFQN() + "]";
  +        return "[containment model: " + getQualifiedName() + "]";
       }
   }
  
  
  
  1.2       +11 -5     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDependencyModel.java
  
  Index: DefaultDependencyModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDependencyModel.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultDependencyModel.java	19 Jul 2003 05:25:35 -0000	1.1
  +++ DefaultDependencyModel.java	19 Jul 2003 06:16:42 -0000	1.2
  @@ -153,7 +153,6 @@
       */
       public Model select( String key, Model[] candidates )
       {
  -        getLogger().debug( "handling dependency for key: " + key );
           DependencyDirective directive = getDirective( key );
           if( directive != null )
           {
  @@ -162,16 +161,16 @@
                   if( directive.getSource() != null )
                   {
                       String path = directive.getSource();
  -                    getLogger().debug( "located path: " + path );
                       String source = resolvePath( m_partition, path );
  -                    getLogger().debug( "resolved path: " + source );
                       for( int i=0; i<candidates.length; i++ )
                       {
                           final Model candidate = candidates[i];
                           final String name = candidate.getQualifiedName();
  -                        getLogger().debug( "candidate: " + name );
                           if( source.equals( name ) )
                           {
  +                            getLogger().debug( 
  +                              "selected [" + name + "] for key [" 
  +                              + key + "] using [" + path + "].");
                               return candidate;
                           }
                       }
  @@ -208,7 +207,14 @@
           if( n > 0 )
           {
               int index = partition.substring( 0, n-1 ).lastIndexOf( "/" );
  -            return partition.substring( 0, index );
  +            if( index == 0 )
  +            {
  +                return "/";
  +            }
  +            else
  +            {
  +                return partition.substring( 0, index );
  +            }
           }
           else
           {
  
  
  
  1.15      +2 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java
  
  Index: DefaultDeploymentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DefaultDeploymentModel.java	19 Jul 2003 05:25:35 -0000	1.14
  +++ DefaultDeploymentModel.java	19 Jul 2003 06:16:42 -0000	1.15
  @@ -214,7 +214,7 @@
   
           m_dependencyModel = 
             new DefaultDependencyModel( 
  -            context.getLogger().getChildLogger( "dependencies" ), 
  +            context.getLogger().getChildLogger( "deps" ), 
               context.getPartitionName(), 
               context.getProfile().getName(), 
               context.getType().getDependencies(),
  @@ -628,6 +628,6 @@
   
       public String toString()
       {
  -        return "[deployment model : " + getFQN() + "]";
  +        return "[deployment model : " + getQualifiedName() + "]";
       }
   }
  
  
  
  1.8       +1 -13     avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModel.java
  
  Index: DefaultModel.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModel.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultModel.java	19 Jul 2003 05:25:35 -0000	1.7
  +++ DefaultModel.java	19 Jul 2003 06:16:42 -0000	1.8
  @@ -102,13 +102,6 @@
           m_name = name;
           m_path = path;
           m_mode = mode;
  -
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message = 
  -              REZ.getString( "created", this.toString() );
  -            getLogger().debug( message );
  -        }
       }
   
       //==============================================================
  @@ -162,11 +155,6 @@
       protected Logger getLogger()
       {
           return m_logger;
  -    }
  -
  -    protected String getFQN()
  -    {
  -        return getPath() + getName();
       }
   
       public String toString()
  
  
  
  1.12      +0 -6      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Resources.properties,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Resources.properties	19 Jul 2003 05:25:35 -0000	1.11
  +++ Resources.properties	19 Jul 2003 06:16:42 -0000	1.12
  @@ -38,12 +38,6 @@
   deployment.context.internal.error=The context key [{0}] was recognized but could not be
fulfilled as no context entry model has be assigned to handle the request.
   deployment.registration.override.error=Illegal attempt to override an existing model entry
[{0}].
   
  -
  -# DefaultModel
  -# ============
  -created=created: {0}
  -
  -
   # DefaultSystemContext
   # ====================
   system.context.base.not-a-directory.error="Base directory argument is not a directory:
{0}.
  
  
  
  1.2       +12 -7     avalon-sandbox/merlin/composition/src/test/conf/dependency.xml
  
  Index: dependency.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/conf/dependency.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- dependency.xml	19 Jul 2003 05:25:35 -0000	1.1
  +++ dependency.xml	19 Jul 2003 06:16:42 -0000	1.2
  @@ -31,13 +31,18 @@
        </context>
      </component>
   
  -   <component name="test-b" class="org.apache.avalon.composition.model.testb.TestB"/>
  +   <container name="fred">
   
  -   <component name="test-c" class="org.apache.avalon.composition.model.testc.TestC">
  -     <dependencies>
  -       <dependency key="a" source="test-a"/>
  -       <dependency key="b" source="test-b"/>
  -     </dependencies>
  -   </component>
  +     <component name="test-b" class="org.apache.avalon.composition.model.testb.TestB"/>
  +
  +     <component name="test-c" class="org.apache.avalon.composition.model.testc.TestC">
  +       <dependencies>
  +         <dependency key="a" source="../test-a"/>
  +         <dependency key="a2" source="/test-a"/>
  +         <dependency key="b" source="test-b"/>
  +       </dependencies>
  +     </component>
  +
  +   </container>
   
   </container>
  
  
  
  1.2       +8 -6      avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/test/DependencyTestCase.java
  
  Index: DependencyTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/test/DependencyTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DependencyTestCase.java	19 Jul 2003 05:25:35 -0000	1.1
  +++ DependencyTestCase.java	19 Jul 2003 06:16:42 -0000	1.2
  @@ -8,6 +8,7 @@
   import java.util.Date;
   
   import org.apache.avalon.composition.model.Model;
  +import org.apache.avalon.composition.model.ContainmentModel;
   import org.apache.avalon.composition.model.DeploymentModel;
   import org.apache.avalon.composition.model.DependencyModel;
   import org.apache.avalon.composition.model.AbstractTestCase;
  @@ -34,16 +35,17 @@
       public void testStandardDependencyModel() throws Exception
       {
           DeploymentModel a = (DeploymentModel) m_model.getModel( "test-a" );
  -        DeploymentModel b = (DeploymentModel) m_model.getModel( "test-b" );
   
  -        DeploymentModel model = (DeploymentModel) m_model.getModel( "test-c" );
  +        ContainmentModel fred = (ContainmentModel) m_model.getModel( "fred" );
  +        DeploymentModel b = (DeploymentModel) fred.getModel( "test-b" );
  +        DeploymentModel c = (DeploymentModel) fred.getModel( "test-c" );
   
  -        if( model == null )
  +        if( c == null )
           {
               fail( "null deployment model 'test-c'" );
           }
   
  -        DependencyModel dependencyModel = model.getDependencyModel();
  +        DependencyModel dependencyModel = c.getDependencyModel();
           if( dependencyModel == null )
           {
               fail( "null dependency model" );
  @@ -52,7 +54,7 @@
           DependencyDescriptor[] deps = dependencyModel.getDependencies();
           if( deps != null )
           {
  -            assertTrue( "dependency count", deps.length == 2 );
  +            assertTrue( "dependency count", deps.length == 3 );
           }
           else
           {
  @@ -66,7 +68,7 @@
               try
               {
                   Model selection = dependencyModel.select( key, candidates );
  -                System.out.println( "selection: " + selection );
  +                assertNotNull( "selection for key: " + key, selection );
               }
               catch( Throwable e )
               {
  
  
  
  1.2       +2 -0      avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/testc/TestC.java
  
  Index: TestC.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/testc/TestC.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestC.java	4 Jul 2003 07:27:43 -0000	1.1
  +++ TestC.java	19 Jul 2003 06:16:43 -0000	1.2
  @@ -24,6 +24,8 @@
           Logger logger = getLogger().getChildLogger( "service" );
           logger.info( "lookup A" );
           manager.lookup( "a" );
  +        logger.info( "lookup A2" );
  +        manager.lookup( "a2" );
           logger.info( "lookup B" );
           manager.lookup( "b" );
           logger.info( "ok" );
  
  
  
  1.2       +1 -0      avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/testc/TestC.xinfo
  
  Index: TestC.xinfo
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/testc/TestC.xinfo,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestC.xinfo	4 Jul 2003 07:27:43 -0000	1.1
  +++ TestC.xinfo	19 Jul 2003 06:16:43 -0000	1.2
  @@ -9,6 +9,7 @@
     </services>
     <dependencies>
       <dependency type="org.apache.avalon.composition.model.testa.A" key="a"/>
  +    <dependency type="org.apache.avalon.composition.model.testa.A" key="a2"/>
       <dependency type="org.apache.avalon.composition.model.testb.B" key="b"/>
     </dependencies>
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message