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/data/test ContextDirectiveTestCase.java
Date Fri, 25 Jul 2003 06:14:06 GMT
mcconnell    2003/07/24 23:14:06

  Modified:    merlin/composition/src/java/org/apache/avalon/composition/data/builder
                        XMLDeploymentProfileCreator.java
               merlin/composition/src/java/org/apache/avalon/composition/data/writer
                        XMLDeploymentProfileWriter.java
               merlin/composition/src/java/org/apache/avalon/composition/model/impl
                        DefaultDependencyModel.java
                        DefaultTypeRepository.java
               merlin/composition/src/test/conf data-test.xml
               merlin/composition/src/test/org/apache/avalon/composition/data/test
                        ContextDirectiveTestCase.java
  Log:
  Housekeeping.
  
  Revision  Changes    Path
  1.3       +3 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLDeploymentProfileCreator.java
  
  Index: XMLDeploymentProfileCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLDeploymentProfileCreator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLDeploymentProfileCreator.java	24 Jul 2003 22:14:55 -0000	1.2
  +++ XMLDeploymentProfileCreator.java	25 Jul 2003 06:14:04 -0000	1.3
  @@ -282,8 +282,9 @@
           }
   
           final String classname = config.getAttribute( "class", null );
  +        final String source = config.getAttribute( "source", null );
           EntryDirective[] entries = getEntries( config.getChildren( "entry" ) );
  -        return new ContextDirective( classname, entries );
  +        return new ContextDirective( classname, entries, source );
       }
   
       /**
  
  
  
  1.3       +5 -1      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLDeploymentProfileWriter.java
  
  Index: XMLDeploymentProfileWriter.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLDeploymentProfileWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLDeploymentProfileWriter.java	24 Jul 2003 22:14:55 -0000	1.2
  +++ XMLDeploymentProfileWriter.java	25 Jul 2003 06:14:05 -0000	1.3
  @@ -370,6 +370,10 @@
           {
               writer.write( " class=\"" + context.getClassname() + "\"");
           }
  +        if( context.getSource() != null )
  +        {
  +            writer.write( " source=\"" + context.getSource() + "\"");
  +        }
   
           EntryDirective[] entries = context.getEntryDirectives();
   
  
  
  
  1.5       +1 -92     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultDependencyModel.java	24 Jul 2003 13:14:53 -0000	1.4
  +++ DefaultDependencyModel.java	25 Jul 2003 06:14:05 -0000	1.5
  @@ -333,97 +333,6 @@
           }
       }
   
  -
  -   /**
  -    * Rank a service relative to the service it provides matching
  -    * the dependency key.
  -    *
  -    * @param directive the dependency directive
  -    * @param candidate a candidate model
  -    */
  -/*
  -    private int rank( DependencyDirective directive, ServiceDescriptor service )
  -    {
  -        int n = 0;
  -        SelectionDirective[] selections = 
  -          directive.getSelectionDirectives();
  -        for( int i=0; i<selections.length; i++ )
  -        {
  -            int ranking = rank( service, selections[i] );
  -            if( ranking > -1 )
  -            {
  -                n = n + ranking;
  -            }
  -            else
  -            {
  -                return -1;
  -            }
  -        }
  -        return n;
  -    }
  -
  -    private int rank( ServiceDescriptor service, SelectionDirective directive )
  -    {
  -        String feature = directive.getFeature();
  -        String value = directive.getValue();
  -        if( directive.getCriteria().equals( SelectionDirective.EQUALS ) )
  -        {
  -            if( value.equals( service.getAttribute( feature ) )
  -            {
  -                return 1;
  -            }
  -            else
  -            {
  -                if( directive.isRequired() )
  -                {
  -                    return -1;
  -                }
  -                else
  -                {
  -                    return 0;
  -                }
  -            }
  -        }
  -        else if( directive.getCriteria().equals( SelectionDirective.INCLUDES ) )
  -        {
  -            final String v = service.getAttribute( feature );
  -            if( v != null )
  -            {
  -                if( v.indexOf( value ) > -1 )
  -                {
  -                    return 1;
  -                }
  -            }
  -            if( directive.isRequired() )
  -            {
  -                return -1;
  -            }
  -            else
  -            {
  -                return 0;
  -            }
  -        }
  -        else if( directive.getCriteria().equals( SelectionDirective.EXISTS ) )
  -        {
  -            if( service.getAttribute( feature ) != null )
  -            {
  -                return 1;
  -            }
  -            else
  -            {
  -                if( directive.isRequired() )
  -                {
  -                    return -1;
  -                }
  -                else
  -                {
  -                    return 0;
  -                }
  -            }
  -        }
  -    }
  -*/
  -
       private String resolvePath( String partition, String path )
       {
           if( path.startsWith( "/" ) )
  
  
  
  1.10      +1 -2      avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultTypeRepository.java
  
  Index: DefaultTypeRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultTypeRepository.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultTypeRepository.java	17 Jul 2003 21:21:57 -0000	1.9
  +++ DefaultTypeRepository.java	25 Jul 2003 06:14:05 -0000	1.10
  @@ -61,7 +61,6 @@
   import org.apache.avalon.composition.model.TypeRuntimeException;
   import org.apache.avalon.composition.model.TypeDuplicateException;
   import org.apache.avalon.composition.model.TypeUnknownException;
  -import org.apache.avalon.composition.util.ExceptionHelper;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.logger.Logger;
  
  
  
  1.4       +3 -3      avalon-sandbox/merlin/composition/src/test/conf/data-test.xml
  
  Index: data-test.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/conf/data-test.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- data-test.xml	24 Jul 2003 22:24:50 -0000	1.3
  +++ data-test.xml	25 Jul 2003 06:14:06 -0000	1.4
  @@ -59,9 +59,9 @@
            </dependency>
          </dependencies>
          <stages>
  -         <stage key="first-key" source="../comp"/>
  -         <stage key="second-key">
  -           <select feature="color" value="red" match="equals"/>
  +         <stage key="urn:somewhere:my-extension" source="../comp"/>
  +         <stage key="urn:somewhere:another-extension">
  +           <select feature="speed" value="fast" match="equals"/>
              <select feature="publisher" value="ASF" match="exists" optional="true"/>
            </stage>
          </stages>
  
  
  
  1.2       +5 -1      avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/data/test/ContextDirectiveTestCase.java
  
  Index: ContextDirectiveTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/data/test/ContextDirectiveTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextDirectiveTestCase.java	17 Jul 2003 21:21:58 -0000	1.1
  +++ ContextDirectiveTestCase.java	25 Jul 2003 06:14:06 -0000	1.2
  @@ -62,6 +62,8 @@
    */
   public class ContextDirectiveTestCase extends TestCase
   {
  +    private String m_source = "../xxx";
  +
       public ContextDirectiveTestCase( String name )
       {
           super( name );
  @@ -100,9 +102,11 @@
       public void testContextDirective()
       {
           EntryDirective[] entries = new EntryDirective[0];
  -        ContextDirective cd = new ContextDirective( getClass().getName(), entries);
  +        ContextDirective cd = 
  +          new ContextDirective( getClass().getName(), entries, m_source );
   
           assertEquals( "classname", getClass().getName(), cd.getClassname());
  +        assertEquals( "source", m_source, cd.getSource());
           assertEquals( "entries", entries, cd.getEntryDirectives());
           assertEquals( "length", entries.length, cd.getEntryDirectives().length);
       }
  
  
  

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


Mime
View raw message