You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/10/05 22:14:04 UTC

svn commit: r453350 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

Author: peterreilly
Date: Thu Oct  5 13:14:03 2006
New Revision: 453350

URL: http://svn.apache.org/viewvc?view=rev&rev=453350
Log:
Bugzilla 40682: junit regression

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=453350&r1=453349&r2=453350
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Oct  5 13:14:03 2006
@@ -37,6 +37,9 @@
 * no check for refid when prefix attribute is set in zipfileset.
   Bugzilla report 30498.
 
+* fix for junit4 issue introducted since beta2.
+  Bugzilla report 40682.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java?view=diff&rev=453350&r1=453349&r2=453350
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Thu Oct  5 13:14:03 2006
@@ -154,6 +154,14 @@
     private boolean splitJunit = false;
     private JUnitTaskMirror delegate;
 
+    //   Attributes for basetest
+    private boolean haltOnError = false;
+    private boolean haltOnFail  = false;
+    private boolean filterTrace = true;
+    private boolean fork        = false;
+    private String  failureProperty;
+    private String  errorProperty;
+
     private static final int STRING_BUFFER_SIZE = 128;
     /**
      * @since Ant 1.7
@@ -185,11 +193,7 @@
      * @since Ant 1.5
      */
     public void setFiltertrace(boolean value) {
-        Enumeration e = allTests();
-        while (e.hasMoreElements()) {
-            BaseTest test = (BaseTest) e.nextElement();
-            test.setFiltertrace(value);
-        }
+        this.filterTrace = value;
     }
 
     /**
@@ -203,11 +207,7 @@
      * @since Ant 1.2
      */
     public void setHaltonerror(boolean value) {
-        Enumeration e = allTests();
-        while (e.hasMoreElements()) {
-            BaseTest test = (BaseTest) e.nextElement();
-            test.setHaltonerror(value);
-        }
+        this.haltOnError = value;
     }
 
     /**
@@ -222,11 +222,7 @@
      * @since Ant 1.4
      */
     public void setErrorProperty(String propertyName) {
-        Enumeration e = allTests();
-        while (e.hasMoreElements()) {
-            BaseTest test = (BaseTest) e.nextElement();
-            test.setErrorProperty(propertyName);
-        }
+        this.errorProperty = propertyName;
     }
 
     /**
@@ -241,11 +237,7 @@
      * @since Ant 1.2
      */
     public void setHaltonfailure(boolean value) {
-        Enumeration e = allTests();
-        while (e.hasMoreElements()) {
-            BaseTest test = (BaseTest) e.nextElement();
-            test.setHaltonfailure(value);
-        }
+        this.haltOnFail = value;
     }
 
     /**
@@ -260,11 +252,7 @@
      * @since Ant 1.4
      */
     public void setFailureProperty(String propertyName) {
-        Enumeration e = allTests();
-        while (e.hasMoreElements()) {
-            BaseTest test = (BaseTest) e.nextElement();
-            test.setFailureProperty(propertyName);
-        }
+        this.failureProperty = propertyName;
     }
 
     /**
@@ -281,11 +269,7 @@
      * @since Ant 1.2
      */
     public void setFork(boolean value) {
-        Enumeration e = allTests();
-        while (e.hasMoreElements()) {
-            BaseTest test = (BaseTest) e.nextElement();
-            test.setFork(value);
-        }
+        this.fork = value;
     }
 
     /**
@@ -722,6 +706,22 @@
      * @since Ant 1.2
      */
     public void execute() throws BuildException {
+        // Apply the basetest attributes
+        Enumeration e = allTests();
+        while (e.hasMoreElements()) {
+            BaseTest test = (BaseTest) e.nextElement();
+            test.setFiltertrace(filterTrace);
+            test.setHaltonerror(haltOnError);
+            if (errorProperty != null) {
+                test.setErrorProperty(errorProperty);
+            }
+            test.setHaltonfailure(haltOnFail);
+            if (failureProperty != null) {
+                test.setFailureProperty(failureProperty);
+            }
+            test.setFork(fork);
+        }
+
         ClassLoader myLoader = JUnitTask.class.getClassLoader();
         ClassLoader mirrorLoader;
         if (splitJunit) {



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


Re: svn commit: r453350 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hi Peter,

this looks cleaner than the original implementation.

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Thu, 05 Oct 2006 20:14:04 -0000
Von: peterreilly@apache.org
An: ant-cvs@apache.org
Betreff: svn commit: r453350 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

> Author: peterreilly
> Date: Thu Oct  5 13:14:03 2006
> New Revision: 453350
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=453350
> Log:
> Bugzilla 40682: junit regression
> 
> Modified:
>     ant/core/trunk/WHATSNEW
>    
> ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
> 
> Modified: ant/core/trunk/WHATSNEW
> URL:
> http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?view=diff&rev=453350&r1=453349&r2=453350
> ==============================================================================
> --- ant/core/trunk/WHATSNEW (original)
> +++ ant/core/trunk/WHATSNEW Thu Oct  5 13:14:03 2006
> @@ -37,6 +37,9 @@
>  * no check for refid when prefix attribute is set in zipfileset.
>    Bugzilla report 30498.
>  
> +* fix for junit4 issue introducted since beta2.
> +  Bugzilla report 40682.
> +
>  Other changes:
>  --------------
>  
> 
> Modified:
> ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
> URL:
> http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java?view=diff&rev=453350&r1=453349&r2=453350
> ==============================================================================
> ---
> ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java (original)
> +++
> ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Thu Oct  5 13:14:03 2006
> @@ -154,6 +154,14 @@
>      private boolean splitJunit = false;
>      private JUnitTaskMirror delegate;
>  
> +    //   Attributes for basetest
> +    private boolean haltOnError = false;
> +    private boolean haltOnFail  = false;
> +    private boolean filterTrace = true;
> +    private boolean fork        = false;
> +    private String  failureProperty;
> +    private String  errorProperty;
> +
>      private static final int STRING_BUFFER_SIZE = 128;
>      /**
>       * @since Ant 1.7
> @@ -185,11 +193,7 @@
>       * @since Ant 1.5
>       */
>      public void setFiltertrace(boolean value) {
> -        Enumeration e = allTests();
> -        while (e.hasMoreElements()) {
> -            BaseTest test = (BaseTest) e.nextElement();
> -            test.setFiltertrace(value);
> -        }
> +        this.filterTrace = value;
>      }
>  
>      /**
> @@ -203,11 +207,7 @@
>       * @since Ant 1.2
>       */
>      public void setHaltonerror(boolean value) {
> -        Enumeration e = allTests();
> -        while (e.hasMoreElements()) {
> -            BaseTest test = (BaseTest) e.nextElement();
> -            test.setHaltonerror(value);
> -        }
> +        this.haltOnError = value;
>      }
>  
>      /**
> @@ -222,11 +222,7 @@
>       * @since Ant 1.4
>       */
>      public void setErrorProperty(String propertyName) {
> -        Enumeration e = allTests();
> -        while (e.hasMoreElements()) {
> -            BaseTest test = (BaseTest) e.nextElement();
> -            test.setErrorProperty(propertyName);
> -        }
> +        this.errorProperty = propertyName;
>      }
>  
>      /**
> @@ -241,11 +237,7 @@
>       * @since Ant 1.2
>       */
>      public void setHaltonfailure(boolean value) {
> -        Enumeration e = allTests();
> -        while (e.hasMoreElements()) {
> -            BaseTest test = (BaseTest) e.nextElement();
> -            test.setHaltonfailure(value);
> -        }
> +        this.haltOnFail = value;
>      }
>  
>      /**
> @@ -260,11 +252,7 @@
>       * @since Ant 1.4
>       */
>      public void setFailureProperty(String propertyName) {
> -        Enumeration e = allTests();
> -        while (e.hasMoreElements()) {
> -            BaseTest test = (BaseTest) e.nextElement();
> -            test.setFailureProperty(propertyName);
> -        }
> +        this.failureProperty = propertyName;
>      }
>  
>      /**
> @@ -281,11 +269,7 @@
>       * @since Ant 1.2
>       */
>      public void setFork(boolean value) {
> -        Enumeration e = allTests();
> -        while (e.hasMoreElements()) {
> -            BaseTest test = (BaseTest) e.nextElement();
> -            test.setFork(value);
> -        }
> +        this.fork = value;
>      }
>  
>      /**
> @@ -722,6 +706,22 @@
>       * @since Ant 1.2
>       */
>      public void execute() throws BuildException {
> +        // Apply the basetest attributes
> +        Enumeration e = allTests();
> +        while (e.hasMoreElements()) {
> +            BaseTest test = (BaseTest) e.nextElement();
> +            test.setFiltertrace(filterTrace);
> +            test.setHaltonerror(haltOnError);
> +            if (errorProperty != null) {
> +                test.setErrorProperty(errorProperty);
> +            }
> +            test.setHaltonfailure(haltOnFail);
> +            if (failureProperty != null) {
> +                test.setFailureProperty(failureProperty);
> +            }
> +            test.setFork(fork);
> +        }
> +
>          ClassLoader myLoader = JUnitTask.class.getClassLoader();
>          ClassLoader mirrorLoader;
>          if (splitJunit) {
> 
> 
> 

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