diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
index 2d001a447..82bbf7f35 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java
@@ -23,7 +23,7 @@
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
@@ -54,12 +54,14 @@
package org.apache.tools.ant.taskdefs.optional.junit;
+import java.io.File;
import java.util.Vector;
/**
* Baseclass for BatchTest and JUnitTest.
*
- * @author Stefan Bodewig
+ * @author Stefan Bodewig
+ * @author Stephane Bailliez
*/
public abstract class BaseTest {
protected boolean haltOnError = false;
@@ -68,6 +70,8 @@ public abstract class BaseTest {
protected String ifProperty = null;
protected String unlessProperty = null;
protected Vector formatters = new Vector();
+ /** destination directory */
+ protected File destDir = null;
public void setFork(boolean value) {
fork = value;
@@ -104,4 +108,23 @@ public abstract class BaseTest {
public void addFormatter(FormatterElement elem) {
formatters.addElement(elem);
}
+
+ /**
+ * Sets the destination directory.
+ */
+ public void setTodir(File destDir) {
+ this.destDir = destDir;
+ }
+
+ /**
+ * @return the destination directory as an absolute path if it exists
+ * otherwise return null
+ */
+ public String getTodir(){
+ if (destDir != null){
+ return destDir.getAbsolutePath();
+ }
+ return null;
+ }
+
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
index 33da6df2f..1f71c6a90 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
@@ -23,7 +23,7 @@
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
@@ -61,12 +61,14 @@ import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Reference;
import java.util.*;
+import java.io.File;
/**
* Create JUnitTests from a list of files.
*
* @author Jeff Martin
- * @author Stefan Bodewig
+ * @author Stefan Bodewig
+ * @author Stephane Bailliez
*/
public final class BatchTest extends BaseTest {
private Project project;
@@ -87,8 +89,9 @@ public final class BatchTest extends BaseTest {
public class FileList implements Enumeration{
private String files[]=null;
+
private int i=0;
-
+
private FileList(){
Vector v = new Vector();
for (int j=0; jStefan Bodewig
+ * @author Stephane Bailliez
*/
public class JUnitTask extends Task {
@@ -204,8 +205,12 @@ public class JUnitTask extends Task {
continue;
}
+ if (test.getTodir() == null){
+ test.setTodir(project.resolveFile("."));
+ }
+
if (test.getOutfile() == null) {
- test.setOutfile(project.resolveFile("TEST-" + test.getName()));
+ test.setOutfile( "TEST-" + test.getName() );
}
int exitValue = JUnitTestRunner.ERRORS;
@@ -246,22 +251,12 @@ public class JUnitTask extends Task {
for (int i=0; iStefan Bodewig
+ * @author Stefan Bodewig,
+ * @author Stephane Bailliez
*/
public class JUnitTest extends BaseTest {
+
+ /** the name of the test case */
private String name = null;
- private File outfile = null;
-
+
+ /** the name of the result file */
+ private String outfile = null;
+
private long runs, failures, errors;
private long runTime;
@@ -89,7 +94,7 @@ public class JUnitTest extends BaseTest {
name = value;
}
- public void setOutfile(File value) {
+ public void setOutfile(String value) {
outfile = value;
}
@@ -97,11 +102,11 @@ public class JUnitTest extends BaseTest {
return name;
}
+ /**
+ * @return the name of the output file.
+ */
public String getOutfile() {
- if (outfile != null) {
- return outfile.getAbsolutePath();
- }
- return null;
+ return outfile;
}
public void setCounts(long runs, long failures, long errors) {