Author: peterreilly Date: Thu Oct 12 14:41:08 2006 New Revision: 463447 URL: http://svn.apache.org/viewvc?view=rev&rev=463447 Log: opps: restore correct behavour for setting basetest attributes
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java 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=463447&r1=463446&r2=463447 ============================================================================== --- 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 12 14:41:08 2006 @@ -493,6 +493,27 @@ } /** + * Preset the attributes of the test + * before configuration in the build + * script. + * This allows attributes in the <junit> task + * be be defaults for the tests, but allows + * individual tests to override the defaults. + */ + private void preConfigure(BaseTest test) { + test.setFiltertrace(filterTrace); + test.setHaltonerror(haltOnError); + if (errorProperty != null) { + test.setErrorProperty(errorProperty); + } + test.setHaltonfailure(haltOnFail); + if (failureProperty != null) { + test.setFailureProperty(failureProperty); + } + test.setFork(fork); + } + + /** * Add a new single testcase. * @param test a new single testcase * @see JUnitTest @@ -501,6 +522,7 @@ */ public void addTest(JUnitTest test) { tests.addElement(test); + preConfigure(test); } /** @@ -514,6 +536,7 @@ public BatchTest createBatchTest() { BatchTest test = new BatchTest(getProject()); batchTests.addElement(test); + preConfigure(test); return test; } @@ -722,22 +745,6 @@ * @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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]