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/meta/src/test/org/apache/avalon/meta/legacy LegacyTestCase.java Test.java Test.xinfo
Date Sat, 21 Jun 2003 17:42:32 GMT
mcconnell    2003/06/21 10:42:32

  Modified:    merlin/meta/src/java/org/apache/avalon/meta/info/builder
                        XMLLegacyCreator.java
  Added:       merlin/meta/src/test/org/apache/avalon/meta/classic
                        ClassicTestCase.java Test.java Test.xinfo
               merlin/meta/src/test/org/apache/avalon/meta/compat
                        CompatTestCase.java Test.java Test.xinfo
               merlin/meta/src/test/org/apache/avalon/meta/legacy
                        LegacyTestCase.java Test.java Test.xinfo
  Log:
  Addition of testcases for the classic, compat and legacy meta-info descriptors.
  
  Revision  Changes    Path
  1.4       +24 -1     avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java
  
  Index: XMLLegacyCreator.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLLegacyCreator.java	29 Mar 2003 03:25:58 -0000	1.3
  +++ XMLLegacyCreator.java	21 Jun 2003 17:42:32 -0000	1.4
  @@ -172,6 +172,29 @@
               descriptor, loggers, context, services, dependencies, phases, extensions );
       }
   
  +    /**
  +     * A utility method to build a {@link InfoDescriptor}
  +     * object from specified configuraiton data and classname.
  +     *
  +     * @param classname The classname of Component (used to create descriptor)
  +     * @param info the component info configuration fragment
  +     * @return the created InfoDescriptor
  +     * @throws ConfigurationException if an error occurs
  +     */
  +    public InfoDescriptor buildInfoDescriptor(
  +      final String classname, final Configuration info )
  +      throws ConfigurationException
  +    {
  +        final String name = 
  +          info.getChild( "name" ).getValue( null );
  +        final Version version = 
  +          buildVersion( info.getChild( "version" ).getValue( "1.0" ) );
  +        final Properties attributes =
  +            buildAttributes( info.getChild( "attributes" ) );
  +        final String lifestyle = InfoDescriptor.SINGLETON;
  +        return new InfoDescriptor( name, classname, version, lifestyle, attributes );
  +    }
  +
       private ContextDescriptor buildPhoenixContext()
       {
           ReferenceDescriptor reference = 
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/classic/ClassicTestCase.java
  
  Index: ClassicTestCase.java
  ===================================================================
  
  
  package org.apache.avalon.meta.classic;
  
  import java.io.File;
  import java.io.IOException;
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.info.builder.TypeBuilder;
  import junit.framework.TestCase;
  
  public class ClassicTestCase extends TestCase
  {
      private Type m_type;
  
      public ClassicTestCase( )
      {
          this( "classic" );
      }
  
      public ClassicTestCase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          TypeBuilder builder = new TypeBuilder();
          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          Class clazz = loader.loadClass( "org.apache.avalon.meta.classic.Test" );
          m_type = builder.build( clazz );
      }
  
      public void testName() throws Exception
      {
          assertTrue( m_type.getInfo().getName().equals( "test" ) );
      }
  
      public void testLifestyle() throws Exception
      {
          assertTrue( m_type.getInfo().getLifestyle().equals( "singleton" ) );
      }
  
      public void testClassName() throws Exception
      {
          assertTrue( m_type.getInfo().getClassname().equals( "org.apache.avalon.meta.classic.Test"
) );
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/classic/Test.java
  
  Index: Test.java
  ===================================================================
  
  
  package org.apache.avalon.meta.classic;
  
  public class Test
  {
  }
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/classic/Test.xinfo
  
  Index: Test.xinfo
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE type PUBLIC "-//AVALON/Type DTD Version 1.0//EN" "http://avalon.apache.org/dtds/meta/type_1_1.dtd"
>
  
  <type>
    <info>
      <name>test</name>
      <version>1.0.0</version>
      <lifestyle>singleton</lifestyle>
    </info>
    <services>
      <service type="org.apache.avalon.merlin.test.Hello:1.0.0"/>
    </services>
  </type>
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/compat/CompatTestCase.java
  
  Index: CompatTestCase.java
  ===================================================================
  
  
  package org.apache.avalon.meta.compat;
  
  import java.io.File;
  import java.io.IOException;
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.info.builder.TypeBuilder;
  import junit.framework.TestCase;
  
  public class CompatTestCase extends TestCase
  {
      private Type m_type;
  
      public CompatTestCase( )
      {
          this( "compat" );
      }
  
      public CompatTestCase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          TypeBuilder builder = new TypeBuilder();
          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          Class clazz = loader.loadClass( "org.apache.avalon.meta.compat.Test" );
          m_type = builder.build( clazz );
      }
  
      public void testName() throws Exception
      {
          assertTrue( m_type.getInfo().getName().equals( "test" ) );
      }
  
      public void testLifestyle() throws Exception
      {
          assertTrue( m_type.getInfo().getLifestyle().equals( "singleton" ) );
      }
  
      public void testClassName() throws Exception
      {
          assertTrue( m_type.getInfo().getClassname().equals( "org.apache.avalon.meta.compat.Test"
) );
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/compat/Test.java
  
  Index: Test.java
  ===================================================================
  
  
  package org.apache.avalon.meta.compat;
  
  public class Test
  {
  }
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/compat/Test.xinfo
  
  Index: Test.xinfo
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE type PUBLIC "-//AVALON/Type DTD Version 1.0//EN" "http://avalon.apache.org/dtds/meta/type_1_1.dtd"
>
  
  <type>
    <info>
      <name>test</name>
      <version>1.0.0</version>
      <attributes>
        <attribute key="urn:avalon:lifestyle" value="singleton"/>
      </attributes>
    </info>
  </type>
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/legacy/LegacyTestCase.java
  
  Index: LegacyTestCase.java
  ===================================================================
  
  
  package org.apache.avalon.meta.legacy;
  
  import java.io.File;
  import java.io.IOException;
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.info.builder.TypeBuilder;
  import junit.framework.TestCase;
  
  public class LegacyTestCase extends TestCase
  {
      private Type m_type;
  
      public LegacyTestCase( )
      {
          this( "legacy" );
      }
  
      public LegacyTestCase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          TypeBuilder builder = new TypeBuilder();
          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          Class clazz = loader.loadClass( "org.apache.avalon.meta.legacy.Test" );
          m_type = builder.build( clazz );
      }
  
      public void testName() throws Exception
      {
          assertTrue( m_type.getInfo().getName().equals( "test" ) );
      }
  
      public void testLifestyle() throws Exception
      {
          assertTrue( m_type.getInfo().getLifestyle().equals( "singleton" ) );
      }
  
      public void testClassName() throws Exception
      {
          assertTrue( m_type.getInfo().getClassname().equals( "org.apache.avalon.meta.legacy.Test"
) );
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/legacy/Test.java
  
  Index: Test.java
  ===================================================================
  
  
  package org.apache.avalon.meta.legacy;
  
  public class Test
  {
  }
  
  
  
  1.1                  avalon-sandbox/merlin/meta/src/test/org/apache/avalon/meta/legacy/Test.xinfo
  
  Index: Test.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE blockinfo PUBLIC "-//PHOENIX/Block Info DTD Version 1.0//EN"
                    "http://jakarta.apache.org/avalon/dtds/phoenix/blockinfo_1_0.dtd">
  
  <blockinfo>
  
    <block>
      <version>1.0</version>
    </block>
  
    <services>
      <service name="org.apache.avalon.cornerstone.services.connection.ConnectionManager"/>
    </services>
  
    <dependencies>
      <dependency>
        <service name="org.apache.avalon.cornerstone.services.threads.ThreadManager" version="1.0"/>
      </dependency>
    </dependencies>
  
  </blockinfo>
  
  
  

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


Mime
View raw message