ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon AbstractProjectTest.java AbstractMyrmidonTest.java LogMessageTracker.java TrackingProjectListener.java
Date Thu, 18 Apr 2002 12:53:16 GMT
adammurdoch    02/04/18 05:53:16

  Modified:    aut/src/test/org/apache/aut/vfs/test
                        AbstractFileSystemTestCase.java
               container/src/test/org/apache/myrmidon/components
                        AbstractComponentTest.java
               container/src/test/org/apache/myrmidon/components/builder/test
                        DefaultProjectBuilderTestCase.java
               container/src/test/org/apache/myrmidon/components/classloader/test
                        DefaultClassLoaderManagerTestCase.java
               container/src/test/org/apache/myrmidon/components/configurer/test
                        MyRole1Adaptor.java
               container/src/test/org/apache/myrmidon/components/configurer/test/data
                        ConfigTestSetAndAdd.java
               container/src/test/org/apache/myrmidon/components/embeddor/test
                        DefaultEmbeddorTest.java
               container/src/test/org/apache/myrmidon/components/property/test
                        AbstractPropertyResolverTestCase.java
               container/src/test/org/apache/myrmidon/components/role/test
                        DefaultRoleManagerTestCase.java
               container/src/test/org/apache/myrmidon/interfaces/model/test
                        DefaultNameValidatorTestCase.java
               container/src/test/org/apache/myrmidon/interfaces/type/test
                        TypeFactoryTestCase.java
               framework/src/test/org/apache/myrmidon
                        AbstractProjectTest.java
  Added:       aut/src/test/org/apache/aut AbstractAutTestCase.java
               container/src/test/org/apache/myrmidon
                        AbstractContainerTestCase.java
  Removed:     antlib/src/test/org/apache/myrmidon
                        AbstractMyrmidonTest.java AbstractProjectTest.java
                        LogMessageTracker.java TrackingProjectListener.java
               container/src/test/org/apache/myrmidon
                        AbstractMyrmidonTest.java
               framework/src/test/org/apache/myrmidon
                        AbstractMyrmidonTest.java LogMessageTracker.java
                        TrackingProjectListener.java
  Log:
  - Replaced the various AbstractMyrmidonTest copies with a single
    AbstractAutTestCase super-class.
  - Got rid of the duplicated AbstractProjectTest and helper classes
    from antlib.
  
  Revision  Changes    Path
  1.1                  jakarta-ant-myrmidon/aut/src/test/org/apache/aut/AbstractAutTestCase.java
  
  Index: AbstractAutTestCase.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.aut;
  
  import java.io.File;
  import java.io.IOException;
  import junit.framework.TestCase;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.framework.ExceptionUtil;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.logger.ConsoleLogger;
  
  /**
   * A base class for Myrmidon tests.  Provides utility methods for locating
   * test resources.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/18 12:53:14 $
   */
  public abstract class AbstractAutTestCase
      extends TestCase
  {
      private final File m_testBaseDir;
      private final File m_baseDir;
      private Logger m_logger;
  
      public AbstractAutTestCase( final String name )
      {
          super( name );
          final String baseDirProp = System.getProperty( "test.basedir" );
          m_baseDir = getCanonicalFile( new File( baseDirProp ) );
          final String packagePath = getPackageName( getClass() ).replace( '.', File.separatorChar
);
          m_testBaseDir = getCanonicalFile( new File( m_baseDir, packagePath ) );
      }
  
      /**
       * Locates the error message resources for a class.
       */
      protected static final Resources getResourcesForTested( final Class clazz )
      {
          String baseName = getPackageName( clazz );
          if( baseName.endsWith( ".test" ) )
          {
              baseName = baseName.substring( 0, baseName.length() - 5 );
          }
  
          return ResourceManager.getBaseResources( baseName + ".Resources", AbstractAutTestCase.class.getClassLoader()
);
      }
  
      /**
       * Returns the name of the package containing a class.
       *
       * @return The . delimited package name, or an empty string if the class
       *         is in the default package.
       */
      protected static String getPackageName( final Class clazz )
      {
          final Package pkg = clazz.getPackage();
          if( null != pkg )
          {
              return pkg.getName();
          }
  
          final String name = clazz.getName();
          if( -1 == name.lastIndexOf( "." ) )
          {
              return "";
          }
          else
          {
              return name.substring( 0, name.lastIndexOf( "." ) );
          }
      }
  
      /**
       * Locates a test resource, and asserts that the resource exists
       *
       * @param name path of the resource, relative to this test's base directory.
       */
      protected File getTestResource( final String name )
      {
          return getTestResource( name, true );
      }
  
      /**
       * Locates a test resource.
       *
       * @param name path of the resource, relative to this test's base directory.
       */
      protected File getTestResource( final String name, final boolean mustExist )
      {
          File file = new File( m_testBaseDir, name );
          file = getCanonicalFile( file );
          if( mustExist )
          {
              assertTrue( "Test file \"" + file + "\" does not exist.", file.exists() );
          }
          else
          {
              assertTrue( "Test file \"" + file + "\" should not exist.", !file.exists() );
          }
  
          return file;
      }
  
      /**
       * Locates the base directory for this test.
       */
      protected File getTestDirectory()
      {
          return m_testBaseDir;
      }
  
      /**
       * Locates a test directory, creating it if it does not exist.
       *
       * @param name path of the directory, relative to this test's base directory.
       */
      protected File getTestDirectory( final String name )
      {
          File file = new File( m_testBaseDir, name );
          file = getCanonicalFile( file );
          assertTrue( "Test directory \"" + file + "\" does not exist or is not a directory.",
                      file.isDirectory() || file.mkdirs() );
          return file;
      }
  
      /**
       * Makes a file canonical
       */
      private File getCanonicalFile( final File file )
      {
          try
          {
              return file.getCanonicalFile();
          }
          catch( IOException e )
          {
              return file.getAbsoluteFile();
          }
      }
  
      /**
       * Creates a logger.
       */
      protected Logger getLogger()
      {
          if( m_logger == null )
          {
              m_logger = new ConsoleLogger( ConsoleLogger.LEVEL_INFO );
          }
          return m_logger;
      }
  
      /**
       * Asserts that an exception chain contains the expected messages.
       *
       * @param messages The messages, in order.  A null entry in this array
       *                 indicates that the message should be ignored.
       */
      protected void assertSameMessage( final String[] messages, final Throwable throwable
)
      {
          Throwable current = throwable;
          for( int i = 0; i < messages.length; i++ )
          {
              String message = messages[ i ];
              assertNotNull( current );
              if( message != null )
              {
                  assertEquals( message, current.getMessage() );
              }
  
              // Get the next exception in the chain
              current = ExceptionUtil.getCause( current, true );
          }
      }
  
      /**
       * Asserts that an exception contains the expected message.
       */
      protected void assertSameMessage( final String message, final Throwable throwable )
      {
          assertSameMessage( new String[]{message}, throwable );
      }
  
      /**
       * Compares 2 objects for equality, nulls are equal.  Used by the test
       * classes' equals() methods.
       */
      public static boolean equals( final Object o1, final Object o2 )
      {
          if( o1 == null && o2 == null )
          {
              return true;
          }
          if( o1 == null || o2 == null )
          {
              return false;
          }
          return o1.equals( o2 );
      }
  
  }
  
  
  
  1.5       +3 -113    jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java
  
  Index: AbstractFileSystemTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/aut/src/test/org/apache/aut/vfs/test/AbstractFileSystemTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractFileSystemTestCase.java	13 Apr 2002 04:30:57 -0000	1.4
  +++ AbstractFileSystemTestCase.java	18 Apr 2002 12:53:15 -0000	1.5
  @@ -8,15 +8,13 @@
   package org.apache.aut.vfs.test;
   
   import java.io.ByteArrayOutputStream;
  -import java.io.File;
  -import java.io.IOException;
   import java.io.InputStream;
   import java.util.ArrayList;
   import java.util.Arrays;
   import java.util.HashMap;
   import java.util.List;
   import java.util.Map;
  -import junit.framework.TestCase;
  +import org.apache.aut.AbstractAutTestCase;
   import org.apache.aut.vfs.FileContent;
   import org.apache.aut.vfs.FileName;
   import org.apache.aut.vfs.FileObject;
  @@ -28,9 +26,6 @@
   import org.apache.aut.vfs.provider.local.DefaultLocalFileSystemProvider;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.ExceptionUtil;
  -import org.apache.avalon.framework.logger.ConsoleLogger;
  -import org.apache.avalon.framework.logger.Logger;
   
   /**
    * File system test cases, which verifies the structure and naming
  @@ -40,17 +35,16 @@
    * that base folder.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  + * @version $Revision: 1.5 $ $Date: 2002/04/18 12:53:15 $
    */
   public abstract class AbstractFileSystemTestCase
  -    extends TestCase
  +    extends AbstractAutTestCase
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( AbstractFileObject.class );
   
       protected FileObject m_baseFolder;
       protected DefaultFileSystemManager m_manager;
  -    private final File m_testBaseDir;
  -    private Logger m_logger;
   
       // Contents of "file1.txt"
       private String m_charContent;
  @@ -58,30 +52,6 @@
       public AbstractFileSystemTestCase( String name )
       {
           super( name );
  -        final String baseDirProp = System.getProperty( "test.basedir" );
  -        final File baseDir = getCanonicalFile( new File( baseDirProp ) );
  -        final String packagePath = getPackageName( getClass() ).replace( '.', File.separatorChar
);
  -        m_testBaseDir = getCanonicalFile( new File( baseDir, packagePath ) );
  -    }
  -
  -    protected File getTestResource( final String name )
  -    {
  -        return getTestResource( name, true );
  -    }
  -
  -    protected File getTestDirectory( final String name )
  -    {
  -        File file = new File( m_testBaseDir, name );
  -        file = getCanonicalFile( file );
  -        if( file.exists() )
  -        {
  -            assertTrue( "Test directory \"" + file + "\" exists and is not a directory.",
file.isDirectory() );
  -        }
  -        else
  -        {
  -            assertTrue( "Could not create test directory \"" + file + "\".", file.mkdirs()
);
  -        }
  -        return file;
       }
   
       /**
  @@ -110,42 +80,6 @@
       }
   
       /**
  -     * Locates a test resource.
  -     *
  -     * @param name path of the resource, relative to this test's base directory.
  -     */
  -    protected File getTestResource( final String name, final boolean mustExist )
  -    {
  -        File file = new File( m_testBaseDir, name );
  -        file = getCanonicalFile( file );
  -        if( mustExist )
  -        {
  -            assertTrue( "Test file \"" + file + "\" does not exist.", file.exists() );
  -        }
  -        else
  -        {
  -            assertTrue( "Test file \"" + file + "\" should not exist.", !file.exists()
);
  -        }
  -
  -        return file;
  -    }
  -
  -    /**
  -     * Makes a file canonical
  -     */
  -    private File getCanonicalFile( final File file )
  -    {
  -        try
  -        {
  -            return file.getCanonicalFile();
  -        }
  -        catch( IOException e )
  -        {
  -            return file.getAbsoluteFile();
  -        }
  -    }
  -
  -    /**
        * Builds the expected folder structure.
        */
       private FileInfo buildExpectedStructure()
  @@ -199,18 +133,6 @@
       }
   
       /**
  -     * Creates a logger.
  -     */
  -    protected Logger getLogger()
  -    {
  -        if( m_logger == null )
  -        {
  -            m_logger = new ConsoleLogger( ConsoleLogger.LEVEL_WARN );
  -        }
  -        return m_logger;
  -    }
  -
  -    /**
        * Tests resolution of absolute URI.
        */
       public void testAbsoluteURI() throws Exception
  @@ -694,38 +616,6 @@
                   queueExpected.add( childInfo );
                   queueActual.add( child );
               }
  -        }
  -    }
  -
  -    /**
  -     * Asserts that an exception contains the expected message.
  -     */
  -    protected void assertSameMessage( final String message, final Throwable throwable )
  -    {
  -        assertSameMessage( new String[]{message}, throwable );
  -    }
  -
  -    /**
  -     * Asserts that an exception chain contains the expected messages.
  -     *
  -     * @param messages The messages, in order.  A null entry in this array
  -     *                 indicates that the message should be ignored.
  -     */
  -    protected void assertSameMessage( final String[] messages,
  -                                      final Throwable throwable )
  -    {
  -        Throwable current = throwable;
  -        for( int i = 0; i < messages.length; i++ )
  -        {
  -            String message = messages[ i ];
  -            assertNotNull( current );
  -            if( message != null )
  -            {
  -                assertEquals( message, current.getMessage() );
  -            }
  -
  -            // Get the next exception in the chain
  -            current = ExceptionUtil.getCause( current, true );
           }
       }
   
  
  
  
  1.1                  jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/AbstractContainerTestCase.java
  
  Index: AbstractContainerTestCase.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.myrmidon;
  
  import org.apache.aut.AbstractAutTestCase;
  
  /**
   * Base class for container test cases.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/04/18 12:53:15 $
   */
  public class AbstractContainerTestCase
      extends AbstractAutTestCase
  {
      public AbstractContainerTestCase( final String name )
      {
          super( name );
      }
  }
  
  
  
  1.25      +3 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/AbstractComponentTest.java
  
  Index: AbstractComponentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/AbstractComponentTest.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AbstractComponentTest.java	17 Apr 2002 11:57:28 -0000	1.24
  +++ AbstractComponentTest.java	18 Apr 2002 12:53:15 -0000	1.25
  @@ -23,7 +23,7 @@
   import org.apache.avalon.framework.service.DefaultServiceManager;
   import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.avalon.framework.service.Serviceable;
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   import org.apache.myrmidon.components.classloader.DefaultClassLoaderManager;
   import org.apache.myrmidon.components.configurer.DefaultConfigurer;
   import org.apache.myrmidon.components.converter.DefaultMasterConverter;
  @@ -33,7 +33,6 @@
   import org.apache.myrmidon.components.property.DefaultPropertyResolver;
   import org.apache.myrmidon.components.role.DefaultRoleManager;
   import org.apache.myrmidon.components.type.DefaultTypeManager;
  -import org.apache.myrmidon.components.TestDataType;
   import org.apache.myrmidon.interfaces.classloader.ClassLoaderManager;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
   import org.apache.myrmidon.interfaces.converter.ConverterRegistry;
  @@ -51,9 +50,10 @@
    * A base class for tests for the default components.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  + * @version $Revision: 1.25 $ $Date: 2002/04/18 12:53:15 $
    */
   public abstract class AbstractComponentTest
  -    extends AbstractMyrmidonTest
  +    extends AbstractContainerTestCase
   {
       private DefaultServiceManager m_serviceManager;
   
  
  
  
  1.2       +4 -5      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java
  
  Index: DefaultProjectBuilderTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/builder/test/DefaultProjectBuilderTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultProjectBuilderTestCase.java	17 Mar 2002 08:07:07 -0000	1.1
  +++ DefaultProjectBuilderTestCase.java	18 Apr 2002 12:53:15 -0000	1.2
  @@ -9,12 +9,11 @@
   
   import java.io.File;
   import java.util.Arrays;
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.excalibur.io.FileUtil;
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  -import org.apache.myrmidon.components.builder.DefaultProjectBuilder;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   import org.apache.myrmidon.components.builder.DefaultProject;
  +import org.apache.myrmidon.components.builder.DefaultProjectBuilder;
   import org.apache.myrmidon.interfaces.builder.ProjectException;
   import org.apache.myrmidon.interfaces.model.Project;
   
  @@ -22,10 +21,10 @@
    * Test cases for {@link org.apache.myrmidon.components.builder.DefaultProjectBuilder}.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:07 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:15 $
    */
   public class DefaultProjectBuilderTestCase
  -    extends AbstractMyrmidonTest
  +    extends AbstractContainerTestCase
   {
       private final static Resources REZ = getResourcesForTested( DefaultProjectBuilderTestCase.class
);
   
  
  
  
  1.4       +3 -1      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/classloader/test/DefaultClassLoaderManagerTestCase.java
  
  Index: DefaultClassLoaderManagerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/classloader/test/DefaultClassLoaderManagerTestCase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultClassLoaderManagerTestCase.java	9 Apr 2002 07:21:12 -0000	1.3
  +++ DefaultClassLoaderManagerTestCase.java	18 Apr 2002 12:53:15 -0000	1.4
  @@ -22,7 +22,7 @@
    * Test cases for the DefaultClassLoaderManager.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.3 $ $Date: 2002/04/09 07:21:12 $
  + * @version $Revision: 1.4 $ $Date: 2002/04/18 12:53:15 $
    */
   public class DefaultClassLoaderManagerTestCase
       extends AbstractComponentTest
  @@ -56,6 +56,8 @@
        */
       protected void setUp() throws Exception
       {
  +        super.setUp();
  +
           m_commonJar = getTestResource( "common.jar" );
           final URL commonJarUrl = m_commonJar.toURL();
           m_commonClassLoader = new URLClassLoader( new URL[]{commonJarUrl} );
  
  
  
  1.2       +3 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/MyRole1Adaptor.java
  
  Index: MyRole1Adaptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/MyRole1Adaptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MyRole1Adaptor.java	17 Mar 2002 08:07:08 -0000	1.1
  +++ MyRole1Adaptor.java	18 Apr 2002 12:53:15 -0000	1.2
  @@ -7,14 +7,14 @@
    */
   package org.apache.myrmidon.components.configurer.test;
   
  -import org.apache.myrmidon.AbstractMyrmidonTest;
   import org.apache.myrmidon.components.configurer.test.MyRole1;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   
   /**
    * Adapts an Object to MyRole
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:08 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:15 $
    */
   public class MyRole1Adaptor
       implements MyRole1
  @@ -29,6 +29,6 @@
       public boolean equals( Object obj )
       {
           final MyRole1Adaptor adaptor = (MyRole1Adaptor)obj;
  -        return AbstractMyrmidonTest.equals( m_object, adaptor.m_object );
  +        return AbstractContainerTestCase.equals( m_object, adaptor.m_object );
       }
   }
  
  
  
  1.2       +3 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAndAdd.java
  
  Index: ConfigTestSetAndAdd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/configurer/test/data/ConfigTestSetAndAdd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigTestSetAndAdd.java	19 Mar 2002 11:19:24 -0000	1.1
  +++ ConfigTestSetAndAdd.java	18 Apr 2002 12:53:15 -0000	1.2
  @@ -8,13 +8,13 @@
   package org.apache.myrmidon.components.configurer.test.data;
   
   import java.util.ArrayList;
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   
   /**
    * A test class with a setter and adder with the same property name.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/19 11:19:24 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:15 $
    */
   public class ConfigTestSetAndAdd
   {
  @@ -34,7 +34,7 @@
       public boolean equals( final Object obj )
       {
           ConfigTestSetAndAdd test = (ConfigTestSetAndAdd)obj;
  -        if( ! AbstractMyrmidonTest.equals( m_prop, test.m_prop) )
  +        if( ! AbstractContainerTestCase.equals( m_prop, test.m_prop) )
           {
               return false;
           }
  
  
  
  1.7       +4 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java
  
  Index: DefaultEmbeddorTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultEmbeddorTest.java	17 Apr 2002 11:57:28 -0000	1.6
  +++ DefaultEmbeddorTest.java	18 Apr 2002 12:53:15 -0000	1.7
  @@ -11,7 +11,7 @@
   import java.util.HashMap;
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.Logger;
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   import org.apache.myrmidon.LogMessageTracker;
   import org.apache.myrmidon.components.embeddor.DefaultEmbeddor;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
  @@ -24,10 +24,10 @@
    * Test cases for the default embeddor.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.6 $ $Date: 2002/04/17 11:57:28 $
  + * @version $Revision: 1.7 $ $Date: 2002/04/18 12:53:15 $
    */
   public class DefaultEmbeddorTest
  -    extends AbstractMyrmidonTest
  +    extends AbstractContainerTestCase
   {
       private DefaultEmbeddor m_embeddor;
   
  @@ -41,6 +41,7 @@
        */
       protected void tearDown() throws Exception
       {
  +        super.tearDown();
           if( m_embeddor != null )
           {
               m_embeddor.dispose();
  
  
  
  1.8       +3 -1      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java
  
  Index: AbstractPropertyResolverTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/property/test/AbstractPropertyResolverTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractPropertyResolverTestCase.java	9 Apr 2002 02:26:34 -0000	1.7
  +++ AbstractPropertyResolverTestCase.java	18 Apr 2002 12:53:15 -0000	1.8
  @@ -25,7 +25,7 @@
    * General-purpose property resolver test cases.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.7 $ $Date: 2002/04/09 02:26:34 $
  + * @version $Revision: 1.8 $ $Date: 2002/04/18 12:53:15 $
    */
   public abstract class AbstractPropertyResolverTestCase
       extends AbstractComponentTest
  @@ -40,6 +40,8 @@
   
       protected void setUp() throws Exception
       {
  +        super.setUp();
  +
           m_resolver = (PropertyResolver)getServiceManager().lookup( PropertyResolver.ROLE
);
   
           final PropertyStore store = new DefaultPropertyStore();
  
  
  
  1.2       +5 -5      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/role/test/DefaultRoleManagerTestCase.java
  
  Index: DefaultRoleManagerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/role/test/DefaultRoleManagerTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultRoleManagerTestCase.java	17 Mar 2002 08:07:09 -0000	1.1
  +++ DefaultRoleManagerTestCase.java	18 Apr 2002 12:53:15 -0000	1.2
  @@ -7,11 +7,10 @@
    */
   package org.apache.myrmidon.components.role.test;
   
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  -import org.apache.myrmidon.components.role.DefaultRoleManager;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   import org.apache.myrmidon.api.Task;
  +import org.apache.myrmidon.components.role.DefaultRoleManager;
   import org.apache.myrmidon.interfaces.role.RoleException;
   import org.apache.myrmidon.interfaces.role.RoleInfo;
   import org.apache.myrmidon.interfaces.role.RoleManager;
  @@ -20,10 +19,10 @@
    * Test cases for the DefaultRoleManager.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:09 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:15 $
    */
   public class DefaultRoleManagerTestCase
  -    extends AbstractMyrmidonTest
  +    extends AbstractContainerTestCase
   {
       private final static Resources REZ = getResourcesForTested( DefaultRoleManagerTestCase.class
);
   
  @@ -36,6 +35,7 @@
   
       protected void setUp() throws Exception
       {
  +        super.setUp();
           m_roleManager = new DefaultRoleManager();
       }
   
  
  
  
  1.2       +4 -4      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/interfaces/model/test/DefaultNameValidatorTestCase.java
  
  Index: DefaultNameValidatorTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/interfaces/model/test/DefaultNameValidatorTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultNameValidatorTestCase.java	17 Mar 2002 08:07:10 -0000	1.1
  +++ DefaultNameValidatorTestCase.java	18 Apr 2002 12:53:15 -0000	1.2
  @@ -7,21 +7,21 @@
    */
   package org.apache.myrmidon.interfaces.model.test;
   
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   import org.apache.myrmidon.interfaces.model.DefaultNameValidator;
   
   /**
    * TestCases for {@link org.apache.myrmidon.interfaces.model.DefaultNameValidator}.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:10 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:15 $
    */
   public class DefaultNameValidatorTestCase
  -    extends AbstractMyrmidonTest
  +    extends AbstractContainerTestCase
   {
       private DefaultNameValidator m_validator = new DefaultNameValidator();
   
  -    public DefaultNameValidatorTestCase( String name )
  +    public DefaultNameValidatorTestCase( final String name )
       {
           super( name );
       }
  
  
  
  1.2       +3 -3      jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/interfaces/type/test/TypeFactoryTestCase.java
  
  Index: TypeFactoryTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/interfaces/type/test/TypeFactoryTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TypeFactoryTestCase.java	17 Mar 2002 08:07:10 -0000	1.1
  +++ TypeFactoryTestCase.java	18 Apr 2002 12:53:15 -0000	1.2
  @@ -9,7 +9,7 @@
   
   import java.io.File;
   import java.net.URL;
  -import org.apache.myrmidon.AbstractMyrmidonTest;
  +import org.apache.myrmidon.AbstractContainerTestCase;
   import org.apache.myrmidon.interfaces.type.DefaultTypeFactory;
   import org.apache.myrmidon.interfaces.type.ReloadingTypeFactory;
   import org.apache.myrmidon.interfaces.type.TypeException;
  @@ -18,10 +18,10 @@
    * These are unit tests that test the basic operation of TypeFactories.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $ $Date: 2002/03/17 08:07:10 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:15 $
    */
   public class TypeFactoryTestCase
  -    extends AbstractMyrmidonTest
  +    extends AbstractContainerTestCase
   {
       private final static String TYPE_NAME1 = "my-type1";
       private final static String TYPE_NAME2 = "my-type2";
  
  
  
  1.2       +18 -3     jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/AbstractProjectTest.java
  
  Index: AbstractProjectTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/test/org/apache/myrmidon/AbstractProjectTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractProjectTest.java	14 Apr 2002 09:33:13 -0000	1.1
  +++ AbstractProjectTest.java	18 Apr 2002 12:53:16 -0000	1.2
  @@ -8,6 +8,7 @@
   package org.apache.myrmidon;
   
   import java.io.File;
  +import org.apache.aut.AbstractAutTestCase;
   import org.apache.myrmidon.interfaces.EmbeddedAnt;
   import org.apache.myrmidon.listeners.ProjectListener;
   import org.apache.avalon.framework.ExceptionUtil;
  @@ -16,10 +17,10 @@
    * A base class for test cases which need to execute projects.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.1 $ $Date: 2002/04/14 09:33:13 $
  + * @version $Revision: 1.2 $ $Date: 2002/04/18 12:53:16 $
    */
   public class AbstractProjectTest
  -    extends AbstractMyrmidonTest
  +    extends AbstractAutTestCase
   {
       public AbstractProjectTest( final String name )
       {
  @@ -78,8 +79,13 @@
   
           try
           {
  +            // Setup a dummy install
  +            final File distDir = getTestDirectory( "dist" );
  +            getTestDirectory( "dist/lib" );
  +            getTestDirectory( "dist/ext" );
  +
               // Configure embeddor
  -            embeddor.setHomeDirectory( getInstallDirectory() );
  +            embeddor.setHomeDirectory( distDir );
               embeddor.enableLogging( getLogger() );
               embeddor.setSharedClassLoader( getClass().getClassLoader() );
               embeddor.setProjectFile( projectFile.getAbsolutePath() );
  @@ -96,6 +102,15 @@
   
               // Now execute the target
               embeddor.executeTargets( new String[] { targetName } );
  +        }
  +        catch( Exception exc )
  +        {
  +            getLogger().info( "Project failed with unexpected exception" );
  +            for( Throwable t = exc; t != null; t = ExceptionUtil.getCause( t, true ) )
  +            {
  +                getLogger().info( "exception", t );
  +            }
  +            throw exc;
           }
           finally
           {
  
  
  

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


Mime
View raw message