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/verifier/test VerifierTestCase.java assembly2.xml
Date Tue, 01 Oct 2002 00:08:41 GMT
donaldp     2002/09/30 17:08:40

  Added:       src/test/org/apache/avalon/phoenix/tools/verifier/test
                        VerifierTestCase.java assembly2.xml
  Log:
  STart to add in some unit tests for assembly verification
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/tools/verifier/test/VerifierTestCase.java
  
  Index: VerifierTestCase.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.tools.verifier.test;
  
  import java.io.File;
  import java.net.URL;
  import junit.framework.TestCase;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.logger.ConsoleLogger;
  import org.apache.avalon.phoenix.metadata.SarMetaData;
  import org.apache.avalon.phoenix.tools.assembler.Assembler;
  import org.apache.avalon.phoenix.tools.configuration.ConfigurationBuilder;
  import org.apache.avalon.phoenix.tools.verifier.SarVerifier;
  
  /**
   *  An basic test case for the LogManager.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/10/01 00:08:40 $
   */
  public class VerifierTestCase
      extends TestCase
  {
      public VerifierTestCase( final String name )
      {
          super( name );
      }
  
      public void testBasic()
          throws Exception
      {
          verify( "assembly1.xml" );
      }
  
      public void testComplex()
          throws Exception
      {
          verify( "assembly2.xml" );
      }
  
      private void verify( final String config ) throws Exception
      {
          final SarMetaData sarMetaData = assembleSar( config );
          final ClassLoader classLoader = getClass().getClassLoader();
          final SarVerifier verifier = new SarVerifier();
          verifier.enableLogging( new ConsoleLogger() );
          verifier.verifySar( sarMetaData, classLoader );
      }
  
      private SarMetaData assembleSar( final String config ) throws Exception
      {
          final Assembler assembler = new Assembler();
          assembler.enableLogging( new ConsoleLogger() );
          final ClassLoader classLoader = getClass().getClassLoader();
          final Configuration assembly = loadConfig( config );
          return assembler.assembleSar( "test", assembly,
                                        new File( "." ), classLoader );
      }
  
      private Configuration loadConfig( final String config )
          throws Exception
      {
          final URL resource = getClass().getResource( config );
          return ConfigurationBuilder.build( resource.toExternalForm() );
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/test/org/apache/avalon/phoenix/tools/verifier/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.test.data.Component2"
          name="c2a"/>
  
      <block class="org.apache.avalon.phoenix.test.data.Component2"
          name="c2b"/>
  
      <block class="org.apache.avalon.phoenix.test.data.Component2"
          name="c2c"/>
  
      <block class="org.apache.avalon.phoenix.test.data.Component3"
          name="c3">
          <provide name="c2a"
              role="org.apache.avalon.phoenix.test.data.Service2"/>
          <provide name="c2b"
              role="org.apache.avalon.phoenix.test.data.Service2"/>
          <provide name="c2c"
              role="org.apache.avalon.phoenix.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