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-phoenix/src/test/org/apache/avalon/phoenix/tools/assembler/test assembly2.xml AssemblerTestCase.java
Date Mon, 30 Sep 2002 23:45:24 GMT
donaldp     2002/09/30 16:45:23

  Modified:    src/test/org/apache/avalon/phoenix/tools/assembler/test
                        AssemblerTestCase.java
  Added:       src/test/org/apache/avalon/phoenix/tools/assembler/test
                        assembly2.xml
  Log:
  Add in some more unit tests for a slightly more complex example.
  
  Revision  Changes    Path
  1.3       +72 -1     jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/tools/assembler/test/AssemblerTestCase.java
  
  Index: AssemblerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/tools/assembler/test/AssemblerTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AssemblerTestCase.java	30 Sep 2002 23:27:03 -0000	1.2
  +++ AssemblerTestCase.java	30 Sep 2002 23:45:23 -0000	1.3
  @@ -19,6 +19,7 @@
   import org.apache.avalon.phoenix.tools.assembler.test.data.Component1;
   import org.apache.avalon.phoenix.tools.assembler.test.data.Service2;
   import org.apache.avalon.phoenix.tools.assembler.test.data.Component2;
  +import org.apache.avalon.phoenix.tools.assembler.test.data.Component3;
   import org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder;
   
   /**
  @@ -79,6 +80,76 @@
           assertTrue( "Block2 getBlockInfo non null",
                          null != block2.getBlockInfo() );
           assertEquals( "Block2 isDisableProxy", true, block2.isDisableProxy() );
  +    }
  +
  +    public void testComplex()
  +        throws Exception
  +    {
  +        final SarMetaData sarMetaData = assembleSar( "assembly2.xml" );
  +        final BlockMetaData[] blocks = sarMetaData.getBlocks();
  +        assertEquals( "Block Count", 4, blocks.length );
  +
  +        final BlockMetaData block1 = blocks[ 0 ];
  +        final BlockMetaData block2 = blocks[ 1 ];
  +        final BlockMetaData block3 = blocks[ 2 ];
  +        final BlockMetaData block4 = blocks[ 3 ];
  +        final DependencyMetaData[] dependencies1 = block1.getDependencies();
  +        final DependencyMetaData[] dependencies2 = block2.getDependencies();
  +        final DependencyMetaData[] dependencies3 = block3.getDependencies();
  +        final DependencyMetaData[] dependencies4 = block4.getDependencies();
  +
  +        assertEquals( "Block1 getImplementationKey",
  +                      Component2.class.getName(),
  +                      block1.getImplementationKey() );
  +        assertEquals( "Block1 getName", "c2a", block1.getName() );
  +        assertEquals( "Block1 getDependencies count",
  +                      0, dependencies1.length );
  +        assertTrue( "Block2 getBlockInfo non null",
  +                       null != block1.getBlockInfo() );
  +        assertEquals( "Block1 isDisableProxy", false, block1.isDisableProxy() );
  +
  +        assertEquals( "Block2 getImplementationKey",
  +                      Component2.class.getName(),
  +                      block2.getImplementationKey() );
  +        assertEquals( "Block2 getName", "c2b", block2.getName() );
  +        assertEquals( "Block2 getDependencies count",
  +                      0, dependencies2.length );
  +        assertTrue( "Block2 getBlockInfo non null",
  +                       null != block2.getBlockInfo() );
  +        assertEquals( "Block2 isDisableProxy", false, block2.isDisableProxy() );
  +
  +        assertEquals( "Block3 getImplementationKey",
  +                      Component2.class.getName(),
  +                      block3.getImplementationKey() );
  +        assertEquals( "Block3 getName", "c2c", block3.getName() );
  +        assertEquals( "Block3 getDependencies count",
  +                      0, dependencies3.length );
  +        assertTrue( "Block3 getBlockInfo non null",
  +                       null != block3.getBlockInfo() );
  +        assertEquals( "Block3 isDisableProxy", false, block3.isDisableProxy() );
  +
  +        assertEquals( "Block4 getImplementationKey",
  +                      Component3.class.getName(),
  +                      block4.getImplementationKey() );
  +        assertEquals( "Block4 getName", "c3", block4.getName() );
  +        assertEquals( "Block4 getDependencies count",
  +                      3, dependencies4.length );
  +        final DependencyMetaData dependency1 = dependencies4[ 0 ];
  +        final DependencyMetaData dependency2 = dependencies4[ 1 ];
  +        final DependencyMetaData dependency3 = dependencies4[ 2 ];
  +        assertEquals( "Block4 dep1 name", "c2a", dependency1.getName() );
  +        assertEquals( "Block4 dep1 role",
  +                      Service2.class.getName(), dependency1.getRole() );
  +        assertEquals( "Block4 dep1 name", "c2b", dependency2.getName() );
  +        assertEquals( "Block4 dep1 role",
  +                      Service2.class.getName(), dependency2.getRole() );
  +        assertEquals( "Block4 dep1 name", "c2c", dependency3.getName() );
  +        assertEquals( "Block4 dep1 role",
  +                      Service2.class.getName(), dependency3.getRole() );
  +        assertTrue( "Block4 getBlockInfo non null",
  +                       null != block4.getBlockInfo() );
  +        assertEquals( "Block4 isDisableProxy", false, block4.isDisableProxy() );
  +
       }
   
       private SarMetaData assembleSar( final String config ) throws Exception
  
  
  
  1.1                  jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/tools/assembler/test/assembly2.xml
  
  Index: assembly2.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
                    "http://jakarta.apache.org/avalon/dtds/phoenix/assembly_1.0.dtd">
  
  <assembly>
  
      <block class="org.apache.avalon.phoenix.tools.assembler.test.data.Component2"
          name="c2a"/>
  
      <block class="org.apache.avalon.phoenix.tools.assembler.test.data.Component2"
          name="c2b"/>
  
      <block class="org.apache.avalon.phoenix.tools.assembler.test.data.Component2"
          name="c2c"/>
  
      <block class="org.apache.avalon.phoenix.tools.assembler.test.data.Component3"
          name="c3">
          <provide name="c2a"
              role="org.apache.avalon.phoenix.tools.assembler.test.data.Service2"/>
          <provide name="c2b"
              role="org.apache.avalon.phoenix.tools.assembler.test.data.Service2"/>
          <provide name="c2c"
              role="org.apache.avalon.phoenix.tools.assembler.test.data.Service2"/>
      </block>
  
  </assembly>
  
  

--
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