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/fortress/src/test/org/apache/excalibur/fortress/util/test ComponentClassLoaderTestCase.java empty.jar full.jar
Date Sat, 09 Nov 2002 23:16:28 GMT
donaldp     2002/11/09 15:16:27

  Modified:    fortress build.xml
  Added:       fortress/src/test/org/apache/excalibur/fortress/util/test
                        ComponentClassLoaderTestCase.java empty.jar
                        full.jar
  Log:
  Migrate across classloader tests,
  
  Revision  Changes    Path
  1.59      +1 -1      jakarta-avalon-excalibur/fortress/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/build.xml,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- build.xml	9 Nov 2002 07:44:51 -0000	1.58
  +++ build.xml	9 Nov 2002 23:16:27 -0000	1.59
  @@ -183,7 +183,7 @@
               target="1.2">
               <classpath refid="build.path"/>
               <include name="**/*.java"/>
  -            <exclude name="**/util/**/*.java" unless="include.meta"/>
  +            <exclude name="**/util/*.java" unless="include.meta"/>
               <exclude name="**/container/**/*.java" unless="include.meta"/>
           </javac>
   
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/util/test/ComponentClassLoaderTestCase.java
  
  Index: ComponentClassLoaderTestCase.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.excalibur.fortress.util.test;
  
  import java.net.URL;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.Set;
  import junit.framework.TestCase;
  import org.apache.excalibur.fortress.util.classloader.ComponentClassLoader;
  import org.apache.excalibur.fortress.util.classloader.JarEntries;
  import org.apache.excalibur.fortress.util.classloader.JarScanner;
  
  /**
  * A testcase for the @link{ComponentClassLoader}.
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   */
  public class ComponentClassLoaderTestCase extends TestCase
  {
      private Set m_blocks;
      private Set m_services;
      private Set m_types;
  
      public ComponentClassLoaderTestCase( String name )
      {
          super( name );
          m_blocks = new HashSet();
          m_blocks.add("org.apache.avalon.test.EphemeralComponent");
          m_blocks.add("org.apache.avalon.test.AnotherTest");
  
          m_types = new HashSet();
          m_types.add("org.apache.avalon.test.YetAnotherTest");
          m_types.add("org.apache.avalon.test.HooHa");
  
          m_services = new HashSet();
          m_services.add("org.apache.avalon.test.EphemeralComponent");
          m_services.add("org.apache.avalon.test.Nothing");
      }
  
      public void testEmptyManifest()
      {
          URL jar = getClass().getResource( "empty.jar" );
          assertTrue( jar != null );
  
          ComponentClassLoader loader = new ComponentClassLoader( new URL[] { jar } );
  
          assertEquals( loader.getServiceEntries().length, 0 );
          assertEquals( loader.getBlockEntries().length, 0 );
          assertEquals( loader.getTypeEntries().length, 0 );
      }
  
      public void testEmptyManifestJarScanner()
      {
          URL jar = this.getClass().getResource( "empty.jar" );
          assertTrue( jar != null );
  
          JarEntries entries = JarScanner.scan( jar );
  
          assertEquals( entries.getServiceEntries().size(), 0 );
          assertEquals( entries.getBlockEntries().size(), 0 );
          assertEquals( entries.getTypeEntries().size(), 0 );
      }
  
      public void testBlocksManifest()
      {
          URL jar = this.getClass().getResource( "full.jar" );
          assertTrue( jar != null );
          ComponentClassLoader loader = new ComponentClassLoader( new URL[] { jar } );
  
          String[] blocks = loader.getBlockEntries();
          assertEquals( m_blocks.size(), blocks.length );
  
          for ( int i = 0; i < blocks.length; i++ )
          {
              assertTrue( m_blocks.contains( blocks[i] ) );
          }
      }
  
      public void testBlocksManifestJarScanner()
      {
          URL jar = this.getClass().getResource( "full.jar" );
          assertTrue( jar != null );
          JarEntries entries = JarScanner.scan( jar );
  
          Set blocks = entries.getBlockEntries();
          assertEquals( m_blocks.size(), blocks.size() );
  
          Iterator it = blocks.iterator();
          while( it.hasNext() )
          {
              assertTrue( m_blocks.contains( it.next() ) );
          }
      }
  
      public void testServicesManifest()
      {
          URL jar = this.getClass().getResource( "full.jar" );
          assertTrue( jar != null );
          ComponentClassLoader loader = new ComponentClassLoader( new URL[] { jar } );
  
          String[] services = loader.getServiceEntries();
          assertEquals( m_services.size(), services.length );
  
          for ( int i = 0; i < services.length; i++ )
          {
              assertTrue( m_services.contains( services[i] ) );
          }
      }
  
      public void testServicesManifestJarScanner()
      {
          URL jar = this.getClass().getResource( "full.jar" );
          assertTrue( jar != null );
          JarEntries entries = JarScanner.scan( jar );
  
          Set services = entries.getServiceEntries();
          assertEquals( m_services.size(), services.size() );
  
          Iterator it = services.iterator();
          while( it.hasNext() )
          {
              assertTrue( m_services.contains( it.next() ) );
          }
      }
  
      public void testTypesManifest()
      {
          URL jar = this.getClass().getResource( "full.jar" );
          assertTrue( jar != null );
          ComponentClassLoader loader = new ComponentClassLoader( new URL[] { jar } );
  
          String[] types = loader.getTypeEntries();
          assertEquals( m_types.size(), types.length );
  
          for ( int i = 0; i < types.length; i++ )
          {
              assertTrue( m_types.contains( types[i] ) );
          }
      }
  
      public void testTypesManifestJarScanner()
      {
          URL jar = this.getClass().getResource( "full.jar" );
          assertTrue( jar != null );
          JarEntries entries = JarScanner.scan( jar );
  
          Set types = entries.getTypeEntries();
          assertEquals( m_types.size(), types.size() );
  
          Iterator it = types.iterator();
          while( it.hasNext() )
          {
              assertTrue( m_types.contains( it.next() ) );
          }
      }
  }
  
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/util/test/empty.jar
  
  	<<Binary file>>
  
  
  1.1                  jakarta-avalon-excalibur/fortress/src/test/org/apache/excalibur/fortress/util/test/full.jar
  
  	<<Binary file>>
  
  

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