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/tools/xsl build.xsl
Date Mon, 27 May 2002 07:03:53 GMT
adammurdoch    02/05/27 00:03:53

  Modified:    ant1compat/src/java/org/apache/tools/ant
                        Ant1CompatProject.java
               ant1compat/src/test/org/apache/tools/ant/test
                        Ant1CompatTestCase.java
               antlib/src/test/org/apache/antlib
                        AbstractProjectTestCase.java
               container/src/test/org/apache/myrmidon
                        LogMessageTracker.java
               tools/xsl build.xsl
  Log:
  Revive the ant1compat unit tests.
  
  Revision  Changes    Path
  1.8       +1 -2      jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatProject.java
  
  Index: Ant1CompatProject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatProject.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Ant1CompatProject.java	27 May 2002 02:10:18 -0000	1.7
  +++ Ant1CompatProject.java	27 May 2002 07:03:52 -0000	1.8
  @@ -35,7 +35,7 @@
    * Ant1 original, this class contains the extensions.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.7 $ $Date: 2002/05/27 02:10:18 $
  + * @version $Revision: 1.8 $ $Date: 2002/05/27 07:03:52 $
    */
   public class Ant1CompatProject
       extends Project
  @@ -100,7 +100,6 @@
        */
       public void log( String msg, int msgLevel )
       {
  -
           doLog( msg, msgLevel );
           super.log( msg, msgLevel );
       }
  
  
  
  1.3       +43 -50    jakarta-ant-myrmidon/ant1compat/src/test/org/apache/tools/ant/test/Ant1CompatTestCase.java
  
  Index: Ant1CompatTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/test/org/apache/tools/ant/test/Ant1CompatTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Ant1CompatTestCase.java	11 May 2002 12:44:00 -0000	1.2
  +++ Ant1CompatTestCase.java	27 May 2002 07:03:53 -0000	1.3
  @@ -10,12 +10,13 @@
   import java.io.File;
   import org.apache.antlib.AbstractProjectTestCase;
   import org.apache.myrmidon.LogMessageTracker;
  +import org.apache.myrmidon.api.event.LogLevel;
   
   /**
    * Simple tests for the Ant1 Compatibility layer.
    *
    * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
  - * @version $Revision: 1.2 $ $Date: 2002/05/11 12:44:00 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/27 07:03:53 $
    */
   public class Ant1CompatTestCase
       extends AbstractProjectTestCase
  @@ -30,16 +31,16 @@
           final File projectFile = getTestResource( "basic-test.xml" );
   
           // <echo> test
  -        LogMessageTracker tracker = new LogMessageTracker();
  -        tracker.addExpectedMessage( "echo-test", "Hello, hello, hello" );
  +        LogMessageTracker tracker = new LogMessageTracker( LogLevel.WARN );
  +        tracker.addExpectedMessage( "/ant1compat-test/echo-test/echo", "Hello, hello, hello"
);
           executeTarget( projectFile, "echo-test", tracker );
   
           // Property resolution tests
  -        tracker = new LogMessageTracker();
  -        tracker.addExpectedMessage( "property-test", "prop-1 = [value-1]" );
  -        tracker.addExpectedMessage( "property-test", "prop-2 = [value-2]" );
  -        tracker.addExpectedMessage( "property-test", "prop-undefined = [${prop-undefined}]"
);
  -        tracker.addExpectedMessage( "property-test", "Omit, replace$, but keep ${} and
$" );
  +        tracker = new LogMessageTracker( LogLevel.WARN );
  +        tracker.addExpectedMessage( "/ant1compat-test/property-test/echo", "prop-1 = [value-1]"
);
  +        tracker.addExpectedMessage( "/ant1compat-test/property-test/echo", "prop-2 = [value-2]"
);
  +        tracker.addExpectedMessage( "/ant1compat-test/property-test/echo", "prop-undefined
= [${prop-undefined}]" );
  +        tracker.addExpectedMessage( "/ant1compat-test/property-test/echo", "Omit, replace$,
but keep ${} and $" );
           executeTarget( projectFile, "property-test", tracker );
       }
   
  @@ -48,18 +49,19 @@
           final File projectFile = getTestResource( "if-unless-test.xml" );
   
           // if/unless tests.
  -        LogMessageTracker tracker = new LogMessageTracker();
  +        LogMessageTracker tracker = new LogMessageTracker( LogLevel.WARN );
  +
           // Should pass if for "set", "true" and "false"
  -        tracker.addExpectedMessage( "if-set-test", "Ran target: if-set-test" );
  -        tracker.addExpectedMessage( "if-true-test", "Ran target: if-true-test" );
  -        tracker.addExpectedMessage( "if-false-test", "Ran target: if-false-test" );
  +        tracker.addExpectedMessage( "/if-unless-test/if-set-test/if/echo", "Ran target:
if-set-test" );
  +        tracker.addExpectedMessage( "/if-unless-test/if-true-test/if/echo", "Ran target:
if-true-test" );
  +        tracker.addExpectedMessage( "/if-unless-test/if-false-test/if/echo", "Ran target:
if-false-test" );
   
           // Should only pass unless, when not defined.
  -        tracker.addExpectedMessage( "unless-unset-test",
  +        tracker.addExpectedMessage( "/if-unless-test/unless-unset-test/if/echo",
                                       "Ran target: unless-unset-test" );
   
           // If combined with unless on a single target.
  -        tracker.addExpectedMessage( "if-with-unless-test-1",
  +        tracker.addExpectedMessage( "/if-unless-test/if-with-unless-test-1/if/echo",
                                       "Ran target: if-with-unless-test-1" );
   
           executeTarget( projectFile, "if-unless-tests", tracker );
  @@ -69,58 +71,49 @@
       {
           final File projectFile = getTestResource( "ant-task-test.xml" );
   
  -        // TODO - Get the <ant> project listeners working, so we can test log messages.
  -
  -        LogMessageTracker tracker = new LogMessageTracker();
  -        tracker.addExpectedMessage( "default-target", "In default target." );
  -        tracker.addExpectedMessage( "echo-test", "Hello, hello, hello" );
  -        //        executeTarget( projectFile, "ant-samefile-test", tracker );
  -        executeTarget( projectFile, "ant-samefile-test" );
  +        LogMessageTracker tracker = new LogMessageTracker( LogLevel.WARN );
  +        tracker.addExpectedMessage( "/ant-task-test/default-target/echo", "In default target."
);
  +        tracker.addExpectedMessage( "/ant-task-test/echo-test/echo", "Hello, hello, hello"
);
  +        executeTarget( projectFile, "ant-samefile-test", tracker );
   
  -        tracker = new LogMessageTracker();
  -        tracker.addExpectedMessage( "main",
  +        tracker = new LogMessageTracker( LogLevel.WARN );
  +        tracker.addExpectedMessage( "/call-target/main/echo",
                                       "Executed subdir/build.xml (default target)" );
  -        tracker.addExpectedMessage( "main",
  +        tracker.addExpectedMessage( "/call-target/main/echo",
                                       "Executed subdir/build.xml (default target)" );
  -        tracker.addExpectedMessage( "main",
  +        tracker.addExpectedMessage( "/call-target/main/echo",
                                       "Executed subdir/build.xml (default target)" );
  -        tracker.addExpectedMessage( "echo",
  +        tracker.addExpectedMessage( "/call-target/echo/echo",
                                       "Executed subdir/build.xml (echo target)" );
  -        //        executeTarget( projectFile, "ant-otherfile-test", tracker );
  -        executeTarget( projectFile, "ant-otherfile-test" );
  +        executeTarget( projectFile, "ant-otherfile-test", tracker );
   
  -        tracker = new LogMessageTracker();
  -        tracker.addExpectedMessage( "property-test",
  +        tracker = new LogMessageTracker( LogLevel.WARN );
  +        tracker.addExpectedMessage( "/call-target/property-test/echo",
                                       "test-prop = [test-value]" );
  -        tracker.addExpectedMessage( "property-test",
  +        tracker.addExpectedMessage( "/call-target/property-test/echo",
                                       "test-prop = [set in calling task]" );
  -        tracker.addExpectedMessage( "property-test",
  +        tracker.addExpectedMessage( "/call-target/property-test/echo",
                                       "test-prop = [set in calling target]" );
  -        tracker.addExpectedMessage( "property-test",
  +        tracker.addExpectedMessage( "/call-target/property-test/echo",
                                          "test-prop = [test-value]" );
  -           //        executeTarget( projectFile, "ant-setprops-test", tracker );
  -        executeTarget( projectFile, "ant-setprops-test" );
  +        executeTarget( projectFile, "ant-setprops-test", tracker );
       }
   
       public void testAntcallTask() throws Exception
       {
           final File projectFile = getTestResource( "antcall-task-test.xml" );
   
  -        // TODO - Get the <ant> project listeners working, so we can test log messages.
  -
  -        LogMessageTracker tracker = new LogMessageTracker();
  -        tracker.addExpectedMessage( "default-target",
  +        LogMessageTracker tracker = new LogMessageTracker( LogLevel.WARN );
  +        tracker.addExpectedMessage( "/antcall-task-test/default-target/echo",
                                       "In default target." );
  -        tracker.addExpectedMessage( "antcall-target",
  -                                    "In antcall-target:  test-prop = [test-value]" );
  -        tracker.addExpectedMessage( "antcall-target",
  -                                    "In antcall-target:  test-prop = [set in calling task]"
);
  -        tracker.addExpectedMessage( "antcall-target",
  -                                    "In antcall-target:  test-prop = [set in calling target]"
);
  -        tracker.addExpectedMessage( "antcall-target",
  -                                    "In antcall-target:  test-prop = [test-value]" );
  -        //        executeTarget( projectFile, "ant-samefile-test", tracker );
  -        executeTarget( projectFile, "antcall-test" );
  +        tracker.addExpectedMessage( "/antcall-task-test/antcall-target/echo",
  +                                    "In antcall-target: test-prop = [test-value]" );
  +        tracker.addExpectedMessage( "/antcall-task-test/antcall-target/echo",
  +                                    "In antcall-target: test-prop = [set in calling task]"
);
  +        tracker.addExpectedMessage( "/antcall-task-test/antcall-target/echo",
  +                                    "In antcall-target: test-prop = [set in calling target]"
);
  +        tracker.addExpectedMessage( "/antcall-task-test/antcall-target/echo",
  +                                    "In antcall-target: test-prop = [test-value]" );
  +        executeTarget( projectFile, "antcall-test", tracker );
       }
  -
   }
  
  
  
  1.4       +2 -1      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractProjectTestCase.java	22 May 2002 07:36:21 -0000	1.3
  +++ AbstractProjectTestCase.java	27 May 2002 07:03:53 -0000	1.4
  @@ -18,7 +18,7 @@
    * 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.3 $ $Date: 2002/05/22 07:36:21 $
  + * @version $Revision: 1.4 $ $Date: 2002/05/27 07:03:53 $
    */
   public class AbstractProjectTestCase
       extends AbstractAutTestCase
  @@ -127,6 +127,7 @@
               embeddor.setContainerClassLoader( getClass().getClassLoader() );
               embeddor.setProjectFile( projectFile.getAbsolutePath() );
               embeddor.setProjectListener( null );
  +            embeddor.setEmbeddorProperty( "myrmidon.ext.path", System.getProperty( "test.libdir"
) );
   
               // Add a listener to make sure all is good
               embeddor.addTaskListener( tracker );
  
  
  
  1.6       +12 -2     jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/LogMessageTracker.java
  
  Index: LogMessageTracker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/LogMessageTracker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LogMessageTracker.java	27 May 2002 02:08:56 -0000	1.5
  +++ LogMessageTracker.java	27 May 2002 07:03:53 -0000	1.6
  @@ -17,7 +17,7 @@
    * correct order.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.5 $ $Date: 2002/05/27 02:08:56 $
  + * @version $Revision: 1.6 $ $Date: 2002/05/27 07:03:53 $
    */
   public class LogMessageTracker
       extends TrackingTaskListener
  @@ -25,6 +25,16 @@
       private final List m_tasks = new ArrayList();
       private final List m_messages = new ArrayList();
       private final List m_levels = new ArrayList();
  +    private LogLevel m_defaultLevel = LogLevel.INFO;
  +
  +    public LogMessageTracker()
  +    {
  +    }
  +
  +    public LogMessageTracker( final LogLevel defaultLevel )
  +    {
  +        m_defaultLevel = defaultLevel;
  +    }
   
       /**
        * Notify the listener that the task logged
  @@ -66,7 +76,7 @@
        */
       public void addExpectedMessage( final String taskPath, final String message )
       {
  -        addExpectedMessage( taskPath, message, LogLevel.INFO );
  +        addExpectedMessage( taskPath, message, m_defaultLevel );
       }
   
       /**
  
  
  
  1.21      +1 -0      jakarta-ant-myrmidon/tools/xsl/build.xsl
  
  Index: build.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/tools/xsl/build.xsl,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- build.xsl	22 May 2002 07:32:10 -0000	1.20
  +++ build.xsl	27 May 2002 07:03:53 -0000	1.21
  @@ -221,6 +221,7 @@
                               </classpath>
   
                               <sysproperty key="test.basedir" file="${{test.classes}}"/>
  +                            <sysproperty key="test.libdir" file="${{build.lib}}"/>
   
                               <formatter type="xml"/>    <!-- xml reports for junitreport
-->
                               <formatter type="plain"/>  <!-- text reports for humans
    -->
  
  
  

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