avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data component2.xinfo component3-info.xml
Date Fri, 04 Oct 2002 06:10:35 GMT
donaldp     2002/10/03 23:10:35

  Modified:    info/src/test/org/apache/avalon/framework/tools/infobuilder/test
                        InfoBuilderTestCase.java
  Added:       info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data
                        component2.xinfo component3-info.xml
  Log:
  Add in unit tests to verify that blockinfo files are loaded correctly.
  
  Revision  Changes    Path
  1.2       +35 -5     jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/InfoBuilderTestCase.java
  
  Index: InfoBuilderTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/InfoBuilderTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InfoBuilderTestCase.java	4 Oct 2002 00:43:25 -0000	1.1
  +++ InfoBuilderTestCase.java	4 Oct 2002 06:10:35 -0000	1.2
  @@ -55,6 +55,30 @@
                             actual );
       }
   
  +    public void testLoadLegacyComponent()
  +        throws Exception
  +    {
  +        final ComponentInfo actual = loadComponentInfo( COMPONENT2 );
  +        final ComponentInfo expected = loadComponentInfo( COMPONENT3 );
  +
  +        assertEqualStructure( COMPONENT2 + " should be identical to " + COMPONENT3,
  +                              expected,
  +                              actual );
  +    }
  +
  +    private void assertEqualStructure( final String message,
  +                                       final ComponentInfo expected,
  +                                       final ComponentInfo actual )
  +    {
  +        final ComponentDescriptor expectedComponent = expected.getComponentDescriptor();
  +        final ComponentDescriptor actualComponent = actual.getComponentDescriptor();
  +        assertEqualAttributes( message + ": Component.attribute",
  +                               expectedComponent.getAttributes(),
  +                               actualComponent.getAttributes() );
  +
  +        assertEqualFeatures( message, expected, actual );
  +    }
  +
       private void assertEqualInfos( final String message,
                                      final ComponentInfo expected,
                                      final ComponentInfo actual )
  @@ -63,6 +87,13 @@
           final ComponentDescriptor actualComponent = actual.getComponentDescriptor();
           assertEqualComponents( message, expectedComponent, actualComponent );
   
  +        assertEqualFeatures( message, expected, actual );
  +    }
  +
  +    private void assertEqualFeatures( final String message,
  +                                      final ComponentInfo expected,
  +                                      final ComponentInfo actual )
  +    {
           final LoggerDescriptor[] expectedLoggers = expected.getLoggers();
           final LoggerDescriptor[] actualLoggers = actual.getLoggers();
           assertEqualLoggers( message, expectedLoggers, actualLoggers );
  @@ -161,7 +192,6 @@
                                           final ComponentDescriptor expected,
                                           final ComponentDescriptor actual )
       {
  -        assertEquals( message + ": Component.name", expected.getName(), actual.getName()
);
           assertEquals( message + ": Component.type", expected.getImplementationKey(),
                         actual.getImplementationKey() );
           assertEqualAttributes( message + ": Component.attribute",
  @@ -203,9 +233,9 @@
       private ComponentInfo constructDummyInfo()
       {
           final ComponentDescriptor component =
  -            new ComponentDescriptor( "component1",
  -                                     "org.realityforge.Component1",
  -                                     EMPTY_ATTRIBUTES );
  +            new ComponentDescriptor(
  +                "org.realityforge.Component1",
  +                EMPTY_ATTRIBUTES );
   
           final LoggerDescriptor logger1 = new LoggerDescriptor( "", EMPTY_ATTRIBUTES );
           final LoggerDescriptor logger2 = new LoggerDescriptor( "audit", EMPTY_ATTRIBUTES
);
  
  
  
  1.1                  jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component2.xinfo
  
  Index: component2.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>
  
    <!-- section to describe block -->
    <block>
      <version>1.0</version>
        <schema-type>rlng</schema-type>
    </block>
  
    <!-- services that are offered by this block -->
    <services>
      <service name="org.apache.avalon.cornerstone.services.scheduler.TimeScheduler"/>
    </services>
  
    <!-- interfaces that may be exported to manange this block -->
    <management-access-points>
        <service name="org.apache.avalon.cornerstone.services.scheduler.TimeScheduler2"/>
    </management-access-points>
  
    <!-- services that are required by this block -->
    <dependencies>
      <dependency>
        <service name="org.apache.avalon.cornerstone.services.threads.ThreadManager"/>
      </dependency>
    </dependencies>
  </blockinfo>
  
  
  
  1.1                  jakarta-avalon-excalibur/info/src/test/org/apache/avalon/framework/tools/infobuilder/test/data/component3-info.xml
  
  Index: component3-info.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8" ?>
  <!DOCTYPE component-info
        PUBLIC "-//AVALON/Component Info DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/info/componentinfo_1_0.dtd" >
  
  <component-info>
  
      <!-- This component should be identical to the one loaded out of component2 blockinfo
-->
      <component type="org.apache.avalon.framework.tools.infobuilder.test.data.component3">
          <attribute name="avalon">
              <param name="version" value="1.0"/>
          </attribute>
          <attribute name="phoenix">
              <param name="schema-type" value="rlng"/>
          </attribute>
      </component>
  
      <context type="org.apache.avalon.phoenix.BlockContext"/>
  
      <services>
          <service type="org.apache.avalon.cornerstone.services.scheduler.TimeScheduler"/>
          <service type="org.apache.avalon.cornerstone.services.scheduler.TimeScheduler2">
              <attribute name="phoenix">
                  <param name="mx" value="true"/>
              </attribute>
          </service>
      </services>
  
      <dependencies>
          <dependency type="org.apache.avalon.cornerstone.services.threads.ThreadManager"/>
      </dependencies>
  
  </component-info>
  
  

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


Mime
View raw message