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/antlib/src/test/org/apache/antlib/runtime/test converter-def.ant task-def.ant
Date Tue, 04 Jun 2002 12:47:51 GMT
adammurdoch    2002/06/04 05:47:51

  Modified:    ant1compat project.xml
               antlib/src/test/org/apache/antlib
                        AbstractProjectTestCase.java
               antlib/src/test/org/apache/antlib/runtime/test
                        converter-def.ant task-def.ant
  Log:
  Reuse the unit test base class from framework.
  
  Revision  Changes    Path
  1.10      +1 -0      jakarta-ant-myrmidon/ant1compat/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/project.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- project.xml	29 May 2002 06:10:48 -0000	1.9
  +++ project.xml	4 Jun 2002 12:47:51 -0000	1.10
  @@ -56,6 +56,7 @@
               <fileset dir="../antlib/build/lib" includes="*.jar"/>
               <path location="../aut/build/test/classes"/>
               <path location="../container/build/test/classes"/>
  +            <path location="../framework/build/test/classes"/>
               <path location="../antlib/build/test/classes"/>
           </classpath>
       </unitTest>
  
  
  
  1.7       +6 -133    jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/AbstractProjectTestCase.java
  
  Index: AbstractProjectTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/AbstractProjectTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractProjectTestCase.java	29 May 2002 13:03:31 -0000	1.6
  +++ AbstractProjectTestCase.java	4 Jun 2002 12:47:51 -0000	1.7
  @@ -7,149 +7,22 @@
    */
   package org.apache.antlib;
   
  -import java.io.File;
  -import org.apache.aut.AbstractAutTestCase;
  -import org.apache.myrmidon.TrackingTaskListener;
  -import org.apache.myrmidon.api.event.TaskListener;
  -import org.apache.myrmidon.interfaces.EmbeddedAnt;
  -import org.apache.avalon.framework.ExceptionUtil;
  +import org.apache.myrmidon.AbstractTaskTestCase;
   
   /**
    * A base class for test cases which need to execute projects or tasks.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.6 $ $Date: 2002/05/29 13:03:31 $
  + * @version $Revision: 1.7 $ $Date: 2002/06/04 12:47:51 $
  + *
  + * @todo - use the real project builder, rather than the simplified one
  + * from framework.
    */
   public class AbstractProjectTestCase
  -    extends AbstractAutTestCase
  +    extends AbstractTaskTestCase
   {
       public AbstractProjectTestCase( final String name )
       {
           super( name );
  -    }
  -
  -    /**
  -     * Executes a target in a project, and asserts that it fails.
  -     */
  -    protected void executeTargetExpectError( final File projectFile,
  -                                             final String targetName )
  -    {
  -        executeTargetExpectError( projectFile, targetName, new String[ 0 ] );
  -    }
  -
  -    /**
  -     * Executes a target in a project, and asserts that it fails with the
  -     * given error message.
  -     */
  -    protected void executeTargetExpectError( final File projectFile,
  -                                             final String targetName,
  -                                             final String message )
  -    {
  -        executeTargetExpectError( projectFile, targetName, new String[]{message} );
  -    }
  -
  -    /**
  -     * Executes a target in a project, and asserts that it fails with the
  -     * given error messages.
  -     */
  -    protected void executeTargetExpectError( final File projectFile,
  -                                             final String targetName,
  -                                             final String[] messages )
  -    {
  -        try
  -        {
  -            doExecuteTarget( projectFile, targetName, null );
  -            fail( "target execution did not fail" );
  -        }
  -        catch( final Exception e )
  -        {
  -            // Add in the 'could not execute task <blah>' message
  -            final String[] allMessages = new String[ 1 + messages.length ];
  -            System.arraycopy( messages, 0, allMessages, 1, messages.length );
  -            assertSameMessage( allMessages, e );
  -        }
  -    }
  -
  -    /**
  -     * Executes a target in a project, and asserts that it does not fail.
  -     */
  -    protected void executeTarget( final File projectFile, final String targetName )
  -        throws Exception
  -    {
  -        executeTarget( projectFile, targetName, null );
  -    }
  -
  -    /**
  -     * Executes a target in a project, and asserts that it does not fail.
  -     */
  -    protected void executeTarget( final File projectFile,
  -                                  final String targetName,
  -                                  final TaskListener listener )
  -        throws Exception
  -    {
  -        try
  -        {
  -            doExecuteTarget( projectFile, targetName, listener );
  -        }
  -        catch( final Exception e )
  -        {
  -            // Log the entire exception chain, then rethrow
  -            //for( Throwable t = e; t != null; t = ExceptionUtil.getCause( t, true ) )
  -            //{
  -            //    getLogger().error( t.getMessage(), t );
  -            //}
  -            throw e;
  -        }
  -    }
  -
  -    /**
  -     * Executes a target in a project, and asserts that it does not fail.
  -     */
  -    private void doExecuteTarget( final File projectFile,
  -                                  final String targetName,
  -                                  final TaskListener listener )
  -        throws Exception
  -    {
  -        final EmbeddedAnt embeddor = new EmbeddedAnt();
  -        final TrackingTaskListener tracker = new TrackingTaskListener();
  -
  -        try
  -        {
  -            // Setup a dummy install
  -            final File distDir = getTestDirectory( "dist" );
  -            getTestDirectory( "dist/lib/core" );
  -            getTestDirectory( "dist/ext" );
  -
  -            // Configure embeddor
  -            embeddor.setHomeDirectory( distDir );
  -            embeddor.enableLogging( getLogger() );
  -            embeddor.setSharedClassLoader( getClass().getClassLoader() );
  -            embeddor.setContainerClassLoader( getClass().getClassLoader() );
  -            embeddor.setProjectFile( projectFile.getAbsolutePath() );
  -            embeddor.setEmbeddorProperty( "myrmidon.ext.path", System.getProperty( "test.libdir"
) );
  -
  -            // Add a listener to make sure all is good
  -            embeddor.addTaskListener( tracker );
  -
  -            // Add supplied listener
  -            if( listener != null )
  -            {
  -                embeddor.addTaskListener( listener );
  -            }
  -
  -            // Now execute the target
  -            embeddor.executeTargets( new String[]{targetName} );
  -        }
  -        finally
  -        {
  -            embeddor.stop();
  -        }
  -
  -        // Make sure all expected events were delivered
  -        tracker.assertComplete();
  -        if( listener instanceof TrackingTaskListener )
  -        {
  -            ( (TrackingTaskListener)listener ).assertComplete();
  -        }
       }
   }
  
  
  
  1.2       +2 -4      jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/runtime/test/converter-def.ant
  
  Index: converter-def.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/runtime/test/converter-def.ant,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- converter-def.ant	22 May 2002 07:36:21 -0000	1.1
  +++ converter-def.ant	4 Jun 2002 12:47:51 -0000	1.2
  @@ -1,6 +1,4 @@
   <project version="2.0">
  -    <path id="test.path" path="empty-lib.jar"/>
  -
       <target name="no-classpath">
           <converter-def source="org.apache.antlib.runtime.test.ConverterDefTestType"
                          destination="java.lang.String"
  @@ -10,7 +8,7 @@
       <target name="no-classname">
           <converter-def source="org.apache.antlib.runtime.test.ConverterDefTestType"
                          destination="java.lang.String">
  -            <classpath-ref id="test.path"/>
  +            <classpath path="empty-lib.jar"/>
           </converter-def>
       </target>
   
  @@ -18,7 +16,7 @@
           <converter-def source="org.apache.antlib.runtime.test.ConverterDefTestType"
                          destination="java.lang.String"
                          classname="org.apache.antlib.runtime.test.ConverterDefTestConverter">
  -            <classpath-ref id="test.path"/>
  +            <classpath path="empty-lib.jar"/>
           </converter-def>
           <property name="test.prop">
               <converter-def-test-type>some content</converter-def-test-type>
  
  
  
  1.3       +4 -5      jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/runtime/test/task-def.ant
  
  Index: task-def.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/runtime/test/task-def.ant,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- task-def.ant	23 May 2002 09:33:50 -0000	1.2
  +++ task-def.ant	4 Jun 2002 12:47:51 -0000	1.3
  @@ -1,12 +1,11 @@
   <project version="2.0">
  -    <path id="test.path" path="empty-lib.jar"/>
   
       <!-- Define and use a task -->
       <target name="task-def">
           <type-def role="task"
                     name="test-task"
                     classname="org.apache.antlib.runtime.test.TypeDefTestTask">
  -            <classpath-ref id="test.path"/>
  +            <classpath path="empty-lib.jar"/>
           </type-def>
           <test-task/>
       </target>
  @@ -16,7 +15,7 @@
           <type-def role="data-type"
                     name="test-type"
                     classname="org.apache.antlib.runtime.test.TypeDefTestType">
  -            <classpath-ref id="test.path"/>
  +            <classpath path="empty-lib.jar"/>
           </type-def>
           <test-type id="test.prop">this is prop1</test-type>
           <property name="test.prop2">
  @@ -31,7 +30,7 @@
           <type-def role="path"
                     name="test-path"
                     classname="org.apache.antlib.runtime.test.TypeDefTestFileList">
  -            <classpath-ref id="test.path"/>
  +            <classpath path="empty-lib.jar"/>
           </type-def>
           <list-path>
               <test-path file="some-file"/>
  @@ -49,7 +48,7 @@
       <target name="no-classname">
           <type-def role="task"
                     name="test-task">
  -            <classpath-ref id="test.path"/>
  +            <classpath path="empty-lib.jar"/>
           </type-def>
       </target>
   
  
  
  

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