You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/04/08 10:57:42 UTC

svn commit: r645799 - in /ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit: AntUnit.java AntUnitListener.java listener/BaseAntUnitListener.java

Author: bodewig
Date: Tue Apr  8 01:57:39 2008
New Revision: 645799

URL: http://svn.apache.org/viewvc?rev=645799&view=rev
Log:
Make AntUnitListener's aware of the Project instance executing the next test target

Modified:
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnitListener.java
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/listener/BaseAntUnitListener.java

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=645799&r1=645798&r2=645799&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Tue Apr  8 01:57:39 2008
@@ -424,6 +424,7 @@
             p.addBuildListener(new BuildToAntUnitListener(buildFile
                                                           .getAbsolutePath(),
                                                           al));
+            al.setCurrentTestProject(p);
         }
     }
 

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnitListener.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnitListener.java?rev=645799&r1=645798&r2=645799&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnitListener.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnitListener.java Tue Apr  8 01:57:39 2008
@@ -34,6 +34,15 @@
      */
     void setParentTask(Task t);
     /**
+     * Set a reference to the Project instance currently executing the
+     * test target.
+     *
+     * <p>This provides access to the logging system or the properties
+     * of the project under test.  Note that different test targets
+     * will be executed in different Ant Project instances.</p>
+     */
+    void setCurrentTestProject(Project p);
+    /**
      * Invoked once per build file, before any targets get executed.
      */
     void startTestSuite(Project testProject, String buildFile);

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/listener/BaseAntUnitListener.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/listener/BaseAntUnitListener.java?rev=645799&r1=645798&r2=645799&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/listener/BaseAntUnitListener.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/listener/BaseAntUnitListener.java Tue Apr  8 01:57:39 2008
@@ -194,6 +194,16 @@
         return l;
     }
 
+    private Project currentTest;
+
+    public void setCurrentTestProject(Project p) {
+        currentTest = p;
+    }
+
+    protected Project getCurrentTestProject() {
+        return currentTest;
+    }
+
     public static class SendLogTo extends EnumeratedAttribute {
         public static final String ANT_LOG = "ant";
         public static final String FILE = "file";