cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2005-07-16 Thread jkf
jkf 2005/07/16 05:29:31

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Style in updates
  
  Revision  ChangesPath
  1.120 +2 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- JUnitTask.java16 Jul 2005 12:23:48 -  1.119
  +++ JUnitTask.java16 Jul 2005 12:29:31 -  1.120
  @@ -1267,7 +1267,7 @@
*/
   private void logVmExit(FormatterElement[] feArray, JUnitTest test,
  String message) {
  -createClassLoader();  
  +createClassLoader();
   test.setCounts(1, 0, 1);
   test.setProperties(getProject().getProperties());
   for (int i = 0; i < feArray.length; i++) {
  @@ -1354,8 +1354,7 @@
*/
   private void deleteClassLoader()
   {
  -if (classLoader != null)
  -{
  +if (classLoader != null) {
   classLoader.cleanup();
   classLoader = null;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2005-07-16 Thread jkf
jkf 2005/07/16 05:23:48

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  PR: 35750
  
  Make sure the classLoader is always cleaned up before getting a  new one.
  
  Revision  ChangesPath
  1.119 +16 -8 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- JUnitTask.java8 Jul 2005 13:46:38 -   1.118
  +++ JUnitTask.java16 Jul 2005 12:23:48 -  1.119
  @@ -671,10 +671,7 @@
   }
   }
   } finally {
  -if (classLoader != null && reloading) {
  -classLoader.cleanup();
  -}
  -classLoader = null;
  +deleteClassLoader();
   }
   }
   
  @@ -1112,9 +1109,6 @@
   }
   if (classLoader != null) {
   classLoader.resetThreadContextLoader();
  -if (!reloading) {
  -classLoader.cleanup();
  -}
   }
   }
   }
  @@ -1273,7 +1267,7 @@
*/
   private void logVmExit(FormatterElement[] feArray, JUnitTest test,
  String message) {
  -createClassLoader();
  +createClassLoader();  
   test.setCounts(1, 0, 1);
   test.setProperties(getProject().getProperties());
   for (int i = 0; i < feArray.length; i++) {
  @@ -1330,6 +1324,7 @@
   Path userClasspath = getCommandline().getClasspath();
   if (userClasspath != null) {
   if (reloading || classLoader == null) {
  +deleteClassLoader();
   Path classpath = (Path) userClasspath.clone();
   if (includeAntRuntime) {
   log("Implicitly adding " + antRuntimeClasses
  @@ -1352,6 +1347,19 @@
   }
   }
   }
  +
  +/**
  + * Removes a classloader if needed.
  + * @since Ant 1.7
  + */
  +private void deleteClassLoader()
  +{
  +if (classLoader != null)
  +{
  +classLoader.cleanup();
  +classLoader = null;
  +}
  +}
   
   /**
* @since Ant 1.6.2
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2005-07-08 Thread bodewig
bodewig 2005/07/08 06:46:38

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Only write a 'Running' message for a test, if we are really running just that 
one test - PR 35605
  
  Revision  ChangesPath
  1.118 +3 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- JUnitTask.java30 Mar 2005 17:06:39 -  1.117
  +++ JUnitTask.java8 Jul 2005 13:46:38 -   1.118
  @@ -792,6 +792,9 @@
   }
   
cmd.setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner");
   if (casesFile == null) {
  +if (summary) {
  +log("Running " + test.getName(), Project.MSG_INFO);
  +}
   cmd.createArgument().setValue(test.getName());
   } else {
   log("Running multiple tests in the same VM", 
Project.MSG_VERBOSE);
  @@ -821,7 +824,6 @@
   }
   
   if (summary) {
  -log("Running " + test.getName(), Project.MSG_INFO);
   String prefix = "";
   if ("withoutanderr".equalsIgnoreCase(summaryValue)) {
   prefix = "OutErr";
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2005-03-30 Thread jglick
jglick  2005/03/30 09:06:40

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Fixed missing braces.
  
  Revision  ChangesPath
  1.117 +5 -4  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- JUnitTask.java29 Mar 2005 19:19:04 -  1.116
  +++ JUnitTask.java30 Mar 2005 17:06:39 -  1.117
  @@ -1505,7 +1505,7 @@
   /**
* Logs information about failed tests, potentially stops
* processing (by throwing a BuildException) if a failure/error
  - * occured or sets a property.
  + * occurred or sets a property.
*
* @since Ant 1.6.2
*/
  @@ -1520,7 +1520,7 @@
   /**
* Logs information about failed tests, potentially stops
* processing (by throwing a BuildException) if a failure/error
  - * occured or sets a property.
  + * occurred or sets a property.
*
* @since Ant 1.7
*/
  @@ -1571,10 +1571,11 @@
   }
   
   protected void processLine(String line, int level) {
  -if (line.startsWith(TESTLISTENER_PREFIX))
  +if (line.startsWith(TESTLISTENER_PREFIX)) {
   task.log(line, Project.MSG_VERBOSE);
  -else
  +} else {
   super.processLine(line, level);
  +}
   }
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java JUnitTestRunner.java

2005-03-24 Thread bodewig
bodewig 2005/03/24 00:36:40

  Modified:.Tag: ANT_16_BRANCH WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java JUnitTestRunner.java
  Log:
  merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.207 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.206
  retrieving revision 1.503.2.207
  diff -u -r1.503.2.206 -r1.503.2.207
  --- WHATSNEW  21 Mar 2005 18:10:22 -  1.503.2.206
  +++ WHATSNEW  24 Mar 2005 08:36:40 -  1.503.2.207
  @@ -281,6 +281,9 @@
   *  failed to process file-hierarchies of more than one level if
 scanincludeddirectories was true.  Bugzilla Report 24866.
   
  +* forkmode="perBatch" or "once" would ignore extension attributes that
  +  had been specified for s.  Bugzilla Report 32973.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===
   
  
  
  
  No   revision
  No   revision
  1.83.2.19 +5 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.18
  retrieving revision 1.83.2.19
  diff -u -r1.83.2.18 -r1.83.2.19
  --- JUnitTask.java9 Mar 2005 18:56:29 -   1.83.2.18
  +++ JUnitTask.java24 Mar 2005 08:36:40 -  1.83.2.19
  @@ -1159,7 +1159,11 @@
*/
   protected File getOutput(FormatterElement fe, JUnitTest test) {
   if (fe.getUseFile()) {
  -String filename = test.getOutfile() + fe.getExtension();
  +String base = test.getOutfile();
  +if (base == null) {
  +base = JUnitTestRunner.IGNORED_FILE_NAME;
  +}
  +String filename = base + fe.getExtension();
   File destFile = new File(test.getTodir(), filename);
   String absFilename = destFile.getAbsolutePath();
   return getProject().resolveFile(absFilename);
  
  
  
  1.42.2.9  +16 -0 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  
  Index: JUnitTestRunner.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java,v
  retrieving revision 1.42.2.8
  retrieving revision 1.42.2.9
  diff -u -r1.42.2.8 -r1.42.2.9
  --- JUnitTestRunner.java  17 Mar 2005 08:13:56 -  1.42.2.8
  +++ JUnitTestRunner.java  24 Mar 2005 08:36:40 -  1.42.2.9
  @@ -79,6 +79,15 @@
   public static final int ERRORS = 2;
   
   /**
  + * Used in formatter arguments as a placeholder for the basename
  + * of the output file (which gets replaced by a test specific
  + * output file name later).
  + *
  + * @since Ant 1.6.3
  + */
  +public static final String IGNORED_FILE_NAME = "IGNORETHIS";
  +
  +/**
* Holds the registered formatters.
*/
   private Vector formatters = new Vector();
  @@ -594,6 +603,13 @@
   fe.setUseFile(true);
   if (!multipleTests) {
   fe.setOutfile(new File(line.substring(pos + 1)));
  +} else {
  +int fName = line.indexOf(IGNORED_FILE_NAME);
  +if (fName > -1) {
  +fe.setExtension(line
  +.substring(fName
  +   + 
IGNORED_FILE_NAME.length()));
  +}
   }
   }
   fromCmdLine.addElement(fe);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java JUnitTestRunner.java

2005-03-24 Thread bodewig
bodewig 2005/03/24 00:35:49

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java JUnitTestRunner.java
  Log:
  Don't ignore the extension attribute for formatters when forking
  multiple JUnit tests in a single VM.
  
  PR: 32973
  
  Revision  ChangesPath
  1.792 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.791
  retrieving revision 1.792
  diff -u -r1.791 -r1.792
  --- WHATSNEW  23 Mar 2005 15:06:48 -  1.791
  +++ WHATSNEW  24 Mar 2005 08:35:49 -  1.792
  @@ -450,6 +450,9 @@
   *  failed to process file-hierarchies of more than one level if
 scanincludeddirectories was true.  Bugzilla Report 24866.
   
  +* forkmode="perBatch" or "once" would ignore extension attributes that
  +  had been specified for s.  Bugzilla Report 32973.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===
   
  
  
  
  1.115 +5 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- JUnitTask.java9 Mar 2005 00:20:42 -   1.114
  +++ JUnitTask.java24 Mar 2005 08:35:49 -  1.115
  @@ -1183,7 +1183,11 @@
*/
   protected File getOutput(FormatterElement fe, JUnitTest test) {
   if (fe.getUseFile()) {
  -String filename = test.getOutfile() + fe.getExtension();
  +String base = test.getOutfile();
  +if (base == null) {
  +base = JUnitTestRunner.IGNORED_FILE_NAME;
  +}
  +String filename = base + fe.getExtension();
   File destFile = new File(test.getTodir(), filename);
   String absFilename = destFile.getAbsolutePath();
   return getProject().resolveFile(absFilename);
  
  
  
  1.56  +16 -0 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  
  Index: JUnitTestRunner.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- JUnitTestRunner.java  17 Mar 2005 08:10:49 -  1.55
  +++ JUnitTestRunner.java  24 Mar 2005 08:35:49 -  1.56
  @@ -80,6 +80,15 @@
   public static final int ERRORS = 2;
   
   /**
  + * Used in formatter arguments as a placeholder for the basename
  + * of the output file (which gets replaced by a test specific
  + * output file name later).
  + *
  + * @since Ant 1.6.3
  + */
  +public static final String IGNORED_FILE_NAME = "IGNORETHIS";
  +
  +/**
* Holds the registered formatters.
*/
   private Vector formatters = new Vector();
  @@ -599,6 +608,13 @@
   fe.setUseFile(true);
   if (!multipleTests) {
   fe.setOutfile(new File(line.substring(pos + 1)));
  +} else {
  +int fName = line.indexOf(IGNORED_FILE_NAME);
  +if (fName > -1) {
  +fe.setExtension(line
  +.substring(fName
  +   + 
IGNORED_FILE_NAME.length()));
  +}
   }
   }
   fromCmdLine.addElement(fe);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-12-07 Thread peterreilly
peterreilly2004/12/07 02:30:35

  Modified:.Tag: ANT_16_BRANCH WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  sync
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.146 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.145
  retrieving revision 1.503.2.146
  diff -u -r1.503.2.145 -r1.503.2.146
  --- WHATSNEW  1 Dec 2004 14:04:36 -   1.503.2.145
  +++ WHATSNEW  7 Dec 2004 10:30:35 -   1.503.2.146
  @@ -72,6 +72,9 @@
   * Target location is not set for default target.
 Bugzilla report 32267.
   
  +* Incorrect classloader parent in junittask when using with ant-junit.jar 
and junit.jar
  +  not in the project classloader. Bugzilla report 28474.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===
   
  
  
  
  No   revision
  No   revision
  1.83.2.16 +5 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.15
  retrieving revision 1.83.2.16
  diff -u -r1.83.2.15 -r1.83.2.16
  --- JUnitTask.java6 Oct 2004 15:48:29 -   1.83.2.15
  +++ JUnitTask.java7 Dec 2004 10:30:35 -   1.83.2.16
  @@ -1272,6 +1272,10 @@
   classpath.append(antRuntimeClasses);
   }
   classLoader = getProject().createClassLoader(classpath);
  +if (getClass().getClassLoader() != null
  +&& getClass().getClassLoader() != 
Project.class.getClassLoader()) {
  +classLoader.setParent(getClass().getClassLoader());
  +}
   classLoader.setParentFirst(false);
   classLoader.addJavaLibraries();
   log("Using CLASSPATH " + classLoader.getClasspath(), 
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-12-07 Thread peterreilly
peterreilly2004/12/07 02:29:32

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  If junittask is loaded by a different classloader than the
  project classloader, set the junittask classloader as the
  parent of the classloader used to load the tests, otherwise
  the tests will not see the classes in ant-junit.jar and the
  classes loaded with the tests will use a different junit.jar
  than the junit used by junittask and will be not be compatible.
  PR: 28474
  
  Revision  ChangesPath
  1.692 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.691
  retrieving revision 1.692
  diff -u -r1.691 -r1.692
  --- WHATSNEW  1 Dec 2004 13:45:48 -   1.691
  +++ WHATSNEW  7 Dec 2004 10:29:32 -   1.692
  @@ -171,6 +171,9 @@
   * Target location is not set for default target.
 Bugzilla report 32267.
   
  +* Incorrect classloader parent in junittask when using with ant-junit.jar 
and junit.jar
  +  not in the project classloader. Bugzilla report 28474.
  +
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===
   
  
  
  
  1.112 +5 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- JUnitTask.java22 Nov 2004 09:23:34 -  1.111
  +++ JUnitTask.java7 Dec 2004 10:29:32 -   1.112
  @@ -1321,6 +1321,10 @@
   classpath.append(antRuntimeClasses);
   }
   classLoader = getProject().createClassLoader(classpath);
  +if (getClass().getClassLoader() != null
  +&& getClass().getClassLoader() != 
Project.class.getClassLoader()) {
  +classLoader.setParent(getClass().getClassLoader());
  +}
   classLoader.setParentFirst(false);
   classLoader.addJavaLibraries();
   log("Using CLASSPATH " + classLoader.getClasspath(),
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java JUnitTestRunner.java ForkedVMWatcher.java

2004-10-13 Thread bodewig
bodewig 2004/10/13 03:23:30

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java JUnitTestRunner.java
  Removed: src/main/org/apache/tools/ant/taskdefs/optional/junit
ForkedVMWatcher.java
  Log:
  The code that tries to detect a crashing forked VM in  breaks
  down when the VM runs multiple tests.
  
  The old code used a TestFormatter and detected a crash if the expected
  output had not been written.  If multiple tests get run in one VM, the
  TestRunner ignores the filename that has been passed in - and the task
  doesn't find any output.
  
  Even if it didn't ignore the file name, a single non-crashing test
  would have made the task think, the VM finished in a healthy way.
  
  Make the crash-detection more explcit and let the TestRunner cooperate
  more than before.
  
  This bug has been presented by Gump in cooperation with the Hivemind
  build.
  
  Revision  ChangesPath
  1.109 +2 -4  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- JUnitTask.java7 Oct 2004 16:15:36 -   1.108
  +++ JUnitTask.java13 Oct 2004 10:23:30 -  1.109
  @@ -847,9 +847,7 @@
   }
   
   File vmWatcher = createTempPropertiesFile("junitvmwatcher");
  -formatterArg.append("formatter=");
  -formatterArg.append(ForkedVMWatcher.class.getName());
  -formatterArg.append(",");
  +formatterArg.append("nocrashfile=");
   formatterArg.append(vmWatcher);
   cmd.createArgument().setValue(formatterArg.toString());
   
  
  
  
  1.52  +23 -0 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  
  Index: JUnitTestRunner.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- JUnitTestRunner.java  6 Oct 2004 15:01:55 -   1.51
  +++ JUnitTestRunner.java  13 Oct 2004 10:23:30 -  1.52
  @@ -21,6 +21,7 @@
   import java.io.ByteArrayOutputStream;
   import java.io.File;
   import java.io.FileInputStream;
  +import java.io.FileOutputStream;
   import java.io.IOException;
   import java.io.PrintStream;
   import java.io.PrintWriter;
  @@ -475,6 +476,7 @@
   boolean stackfilter = true;
   Properties props = new Properties();
   boolean showOut = false;
  +String noCrashFile = null;
   
   if (args.length == 0) {
   System.err.println("required argument TestClassName missing");
  @@ -493,6 +495,8 @@
   haltFail = Project.toBoolean(args[i].substring(14));
   } else if (args[i].startsWith("filtertrace=")) {
   stackfilter = Project.toBoolean(args[i].substring(12));
  +} else if (args[i].startsWith("nocrashfile=")) {
  +noCrashFile = args[i].substring(12);
   } else if (args[i].startsWith("formatter=")) {
   try {
   createAndStoreFormatter(args[i].substring(10));
  @@ -540,6 +544,7 @@
   if (errorOccured || failureOccured ) {
   if ((errorOccured && haltError) 
   || (failureOccured && haltFail)) {
  +registerNonCrash(noCrashFile);
   System.exit(code);
   } else {
   if (code > returnCode) {
  @@ -558,6 +563,7 @@
   stackfilter, haltFail, showOut, props);
   }
   
  +registerNonCrash(noCrashFile);
   System.exit(returnCode);
   }
   
  @@ -655,4 +661,21 @@
   runner.run();
   return runner.getRetCode();
}
  +
  +/**
  + * @since Ant 1.7
  + */
  +private static void registerNonCrash(String noCrashFile) 
  +throws IOException {
  +if (noCrashFile != null) {
  +FileOutputStream out = null;
  +try {
  +out = new FileOutputStream(noCrashFile);
  +out.write(0);
  +out.flush();
  +} finally {
  +out.close();
  +}
  +}
  +}
   } // JUnitTestRunner
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-07 Thread Steve Loughran
I patched this this morning, I think.
On 7 Oct 2004 16:15:36 -, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> mbenson 2004/10/07 09:15:36
>
>   Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
> JUnitTask.java
>   Log:
>   Make Gump happy
>
>   Revision  ChangesPath
>   1.108 +7 -3 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
>
>   Index: JUnitTask.java
>   ===
>   RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
>   retrieving revision 1.107
>   retrieving revision 1.108
>   diff -u -r1.107 -r1.108
>   --- JUnitTask.java6 Oct 2004 15:48:15 -   1.107
>   +++ JUnitTask.java7 Oct 2004 16:15:36 -   1.108
>   @@ -778,8 +778,12 @@
>Project.MSG_WARN);
>}
>
>   -CommandlineJava cmd = (CommandlineJava) 
getCommandline().clone();
>   -
>   +CommandlineJava cmd = null;
>   +try {
>   +cmd = (CommandlineJava)(getCommandline().clone());
>   +} catch (CloneNotSupportedException e) {
>   +throw new BuildException("This shouldn't happen", e, 
getLocation());
>   +}
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-07 Thread mbenson
mbenson 2004/10/07 09:15:36

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Make Gump happy
  
  Revision  ChangesPath
  1.108 +7 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- JUnitTask.java6 Oct 2004 15:48:15 -   1.107
  +++ JUnitTask.java7 Oct 2004 16:15:36 -   1.108
  @@ -778,8 +778,12 @@
   Project.MSG_WARN);
   }
   
  -CommandlineJava cmd = (CommandlineJava) getCommandline().clone();
  -
  +CommandlineJava cmd = null;
  +try {
  +cmd = (CommandlineJava)(getCommandline().clone());
  +} catch (CloneNotSupportedException e) {
  +throw new BuildException("This shouldn't happen", e, 
getLocation());
  +}
   
cmd.setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner");
   if (casesFile == null) {
   cmd.createArgument().setValue(test.getName());
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-06 Thread bodewig
bodewig 2004/10/06 08:48:29

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.83.2.15 +2 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.14
  retrieving revision 1.83.2.15
  diff -u -r1.83.2.14 -r1.83.2.15
  --- JUnitTask.java6 Oct 2004 15:40:56 -   1.83.2.14
  +++ JUnitTask.java6 Oct 2004 15:48:29 -   1.83.2.15
  @@ -655,6 +655,7 @@
   if (classLoader != null && reloading) {
   classLoader.cleanup();
   }
  +classLoader = null;
   }
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-06 Thread bodewig
bodewig 2004/10/06 08:48:15

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  people might reuse this task instance
  
  Revision  ChangesPath
  1.107 +2 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- JUnitTask.java6 Oct 2004 15:39:31 -   1.106
  +++ JUnitTask.java6 Oct 2004 15:48:15 -   1.107
  @@ -668,6 +668,7 @@
   if (classLoader != null && reloading) {
   classLoader.cleanup();
   }
  +classLoader = null;
   }
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-06 Thread bodewig
bodewig 2004/10/06 08:40:57

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  Merge fix for 27420
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.83.2.14 +18 -9 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.13
  retrieving revision 1.83.2.14
  diff -u -r1.83.2.13 -r1.83.2.14
  --- JUnitTask.java27 Jul 2004 14:25:11 -  1.83.2.13
  +++ JUnitTask.java6 Oct 2004 15:40:56 -   1.83.2.14
  @@ -641,14 +641,20 @@
   testLists.addAll(executeOrQueue(tests.elements(), forkPerTest));
   }
   
  -Iterator iter = testLists.iterator();
  -while (iter.hasNext()) {
  -List l = (List) iter.next();
  -if (l.size() == 1) {
  -execute((JUnitTest) l.get(0));
  -} else {
  -execute(l);
  -}
  +try {
  +Iterator iter = testLists.iterator();
  +while (iter.hasNext()) {
  +List l = (List) iter.next();
  +if (l.size() == 1) {
  +execute((JUnitTest) l.get(0));
  +} else {
  +execute(l);
  +}
  +}
  +} finally {
  +if (classLoader != null && reloading) {
  +classLoader.cleanup();
  +}
   }
   }
   
  @@ -1066,6 +1072,9 @@
   }
   if (classLoader != null) {
   classLoader.resetThreadContextLoader();
  +if (!reloading) {
  +classLoader.cleanup();
  +}
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-06 Thread bodewig
bodewig 2004/10/06 08:39:31

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  white space changes only
  
  Revision  ChangesPath
  1.106 +10 -10
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- JUnitTask.java6 Oct 2004 15:38:04 -   1.105
  +++ JUnitTask.java6 Oct 2004 15:39:31 -   1.106
  @@ -655,15 +655,15 @@
   }
   
   try {
  -Iterator iter = testLists.iterator();
  -while (iter.hasNext()) {
  -List l = (List) iter.next();
  -if (l.size() == 1) {
  -execute((JUnitTest) l.get(0));
  -} else {
  -execute(l);
  -}
  -}
  +Iterator iter = testLists.iterator();
  +while (iter.hasNext()) {
  +List l = (List) iter.next();
  +if (l.size() == 1) {
  +execute((JUnitTest) l.get(0));
  +} else {
  +execute(l);
  +}
  +}
   } finally {
   if (classLoader != null && reloading) {
   classLoader.cleanup();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-10-06 Thread bodewig
bodewig 2004/10/06 08:38:04

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  plug memory leak in non-forked 
  
  PR: 27420
  
  Revision  ChangesPath
  1.105 +10 -1 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- JUnitTask.java6 Oct 2004 15:01:55 -   1.104
  +++ JUnitTask.java6 Oct 2004 15:38:04 -   1.105
  @@ -654,6 +654,7 @@
   testLists.addAll(executeOrQueue(tests.elements(), forkPerTest));
   }
   
  +try {
   Iterator iter = testLists.iterator();
   while (iter.hasNext()) {
   List l = (List) iter.next();
  @@ -663,6 +664,11 @@
   execute(l);
   }
   }
  +} finally {
  +if (classLoader != null && reloading) {
  +classLoader.cleanup();
  +}
  +}
   }
   
   /**
  @@ -1091,6 +1097,9 @@
   }
   if (classLoader != null) {
   classLoader.resetThreadContextLoader();
  +if (!reloading) {
  +classLoader.cleanup();
  +}
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-09-30 Thread bodewig
bodewig 2004/09/30 05:41:12

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Oops, better compile before commit
  
  Revision  ChangesPath
  1.103 +4 -4  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- JUnitTask.java30 Sep 2004 09:55:03 -  1.102
  +++ JUnitTask.java30 Sep 2004 12:41:12 -  1.103
  @@ -1476,9 +1476,9 @@
*/
   protected void actOnTestResult(int exitValue, boolean wasKilled,
  JUnitTest test, String name) {
  -TestResult t = new TestResult();
  -t.exitValue = exitValue;
  -t.wasKilled = wasKilled;
  +TestResultHolder t = new TestResultHolder();
  +t.exitCode = exitValue;
  +t.timedOut = wasKilled;
   actOnTestResult(t, test, name);
   }
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-09-30 Thread bodewig
bodewig 2004/09/30 02:55:03

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Improved BWC, not that good, though
  
  Revision  ChangesPath
  1.102 +18 -3 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- JUnitTask.java30 Sep 2004 09:42:16 -  1.101
  +++ JUnitTask.java30 Sep 2004 09:55:03 -  1.102
  @@ -1474,7 +1474,22 @@
*
* @since Ant 1.6.2
*/
  -protected void actOnTestResult(TestResultHolder result,JUnitTest test, 
  +protected void actOnTestResult(int exitValue, boolean wasKilled,
  +   JUnitTest test, String name) {
  +TestResult t = new TestResult();
  +t.exitValue = exitValue;
  +t.wasKilled = wasKilled;
  +actOnTestResult(t, test, name);
  +}
  +
  +/**
  + * Logs information about failed tests, potentially stops
  + * processing (by throwing a BuildException) if a failure/error
  + * occured or sets a property.
  + *
  + * @since Ant 1.7
  + */
  +protected void actOnTestResult(TestResultHolder result, JUnitTest test, 
  String name) {
   // if there is an error/failure and that it should halt, stop
   // everything otherwise just log a statement
  @@ -1503,7 +1518,7 @@
   }
   }
   
  -private class TestResultHolder {
  +protected class TestResultHolder {
   public int exitCode = JUnitTestRunner.ERRORS;
   public boolean timedOut = false;
   public boolean crashed = false;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-07-27 Thread bodewig
bodewig 2004/07/27 07:25:11

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.83.2.13 +3 -4  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.12
  retrieving revision 1.83.2.13
  diff -u -r1.83.2.12 -r1.83.2.13
  --- JUnitTask.java27 Apr 2004 07:45:47 -  1.83.2.12
  +++ JUnitTask.java27 Jul 2004 14:25:11 -  1.83.2.13
  @@ -1262,11 +1262,10 @@
   classpath.append(antRuntimeClasses);
   }
   classLoader = getProject().createClassLoader(classpath);
  -log("Using CLASSPATH " + classLoader.getClasspath(),
  -Project.MSG_VERBOSE);
   classLoader.setParentFirst(false);
   classLoader.addJavaLibraries();
  -log("Using CLASSPATH " + classLoader.getClasspath(), 
Project.MSG_VERBOSE);
  +log("Using CLASSPATH " + classLoader.getClasspath(), 
  +Project.MSG_VERBOSE);
   // make sure the test will be accepted as a TestCase
   classLoader.addSystemPackageRoot("junit");
   // will cause trouble in JDK 1.1 if omitted
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-07-27 Thread bodewig
bodewig 2004/07/27 07:04:09

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  logging the classpath once is enough
  
  Revision  ChangesPath
  1.100 +3 -4  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.99
  retrieving revision 1.100
  diff -u -r1.99 -r1.100
  --- JUnitTask.java27 Apr 2004 07:44:47 -  1.99
  +++ JUnitTask.java27 Jul 2004 14:04:09 -  1.100
  @@ -1275,11 +1275,10 @@
   classpath.append(antRuntimeClasses);
   }
   classLoader = getProject().createClassLoader(classpath);
  -log("Using CLASSPATH " + classLoader.getClasspath(),
  -Project.MSG_VERBOSE);
   classLoader.setParentFirst(false);
   classLoader.addJavaLibraries();
  -log("Using CLASSPATH " + classLoader.getClasspath(), 
Project.MSG_VERBOSE);
  +log("Using CLASSPATH " + classLoader.getClasspath(), 
  +Project.MSG_VERBOSE);
   // make sure the test will be accepted as a TestCase
   classLoader.addSystemPackageRoot("junit");
   // will cause trouble in JDK 1.1 if omitted
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-04-27 Thread bodewig
bodewig 2004/04/27 00:45:48

  Modified:.Tag: ANT_16_BRANCH WHATSNEW build.xml
   docs/manual/OptionalTasks Tag: ANT_16_BRANCH junit.html
   src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  merge
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.503.2.88 +5 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.87
  retrieving revision 1.503.2.88
  diff -u -r1.503.2.87 -r1.503.2.88
  --- WHATSNEW  26 Apr 2004 19:20:24 -  1.503.2.87
  +++ WHATSNEW  27 Apr 2004 07:45:47 -  1.503.2.88
  @@ -114,6 +114,11 @@
   
   * New "pattern" attribute for  selector.
   
  +*  has a new forkmode attribute that controls the number of
  +  Java VMs that get created when forking tests.  This allows you to
  +  run all tests in a single forked JVM reducing the overhead of VM
  +  creation a lot.  Bugzilla Report 24697.
  +
   Changes from Ant 1.6.0 to Ant 1.6.1
   ===
   
  
  
  
  1.392.2.25 +2 -2  ant/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.392.2.24
  retrieving revision 1.392.2.25
  diff -u -r1.392.2.24 -r1.392.2.25
  --- build.xml 16 Apr 2004 07:05:32 -  1.392.2.24
  +++ build.xml 27 Apr 2004 07:45:47 -  1.392.2.25
  @@ -53,7 +53,7 @@
 
 
 
  -  
  +  
 
   
 
 
  
  
  
  No   revision
  No   revision
  1.30.2.5  +18 -0 ant/docs/manual/OptionalTasks/junit.html
  
  Index: junit.html
  ===
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/junit.html,v
  retrieving revision 1.30.2.4
  retrieving revision 1.30.2.5
  diff -u -r1.30.2.4 -r1.30.2.5
  --- junit.html20 Apr 2004 07:29:36 -  1.30.2.4
  +++ junit.html27 Apr 2004 07:45:47 -  1.30.2.5
  @@ -69,6 +69,24 @@
   No; default is off.
 
 
  +forkmode
  +Controls how many Java Virtual Machines get
  +created if you want to fork some tests.  Possible values are
  +"perTest" (the default), "perBatch" and
  +"once".  "once" creates only a single Java VM
  +for all tests while "perTest" creates a new VM for each
  +TestCase class.  "perBatch" creates a VM for each nested
  + and one collecting all nested
  +s.  Note that only tests with the same
  +settings of filtertrace, haltonerror,
  +haltonfailure, errorproperty and
  +failureproperty can share a VM, so even if you set
  +forkmode to "once", Ant may have to create
  +more than a single Java VM.  This attribute is ignored for tests
  +that don't get forked into a new Java VM.  since Ant 1.6.2
  +No; default is perTest.
  +  
  +  
   haltonerror
   Stop the build process if an error occurs during the 
test
  run.
  
  
  
  No   revision
  No   revision
  1.83.2.12 +10 -10
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.11
  retrieving revision 1.83.2.12
  diff -u -r1.83.2.11 -r1.83.2.12
  --- JUnitTask.java20 Apr 2004 06:53:29 -  1.83.2.11
  +++ JUnitTask.java27 Apr 2004 07:45:47 -  1.83.2.12
  @@ -147,7 +147,7 @@
   private File tmpDir;
   private AntClassLoader classLoader = null;
   private Permissions perm = null;
  -private ForkStyle forkStyle = new ForkStyle("perTest");
  +private ForkMode forkMode = new ForkMode("perTest");
   
   private static final int STRING_BUFFER_SIZE = 128;
   
  @@ -295,8 +295,8 @@
*
* @since Ant 1.6.2
*/
  -public void setForkStyle(ForkStyle style) {
  -this.forkStyle = style;
  +public void setForkMode(ForkMode mode) {
  +this.forkMode = mode;
   }
   
   /**
  @@ -628,11 +628,11 @@
   public void execute() throws BuildException {
   List testLists = new ArrayList();
   
  -boolean forkPerTest = 
forkStyle.getValue().equals(ForkStyle.PER_TEST);
  -if (forkPerTest || forkStyle.getValue().equals(ForkStyle.ONCE)) {
  +boolean forkPerTest = forkMode.getValue().equals(ForkMode.PER_TEST);
  +if (forkPerTest || forkMode.getValue().equals(ForkMode.ONCE)) {
   testLists.addAll(executeOrQueue(getIndividualTests(),
   forkPerTest));
  -} else { /* forkStyle.getValue().equals(Fork

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-04-27 Thread bodewig
bodewig 2004/04/27 00:44:48

  Modified:.WHATSNEW build.xml
   docs/manual/OptionalTasks junit.html
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  forkstyle -> forkmode
  
  Revision  ChangesPath
  1.602 +5 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.601
  retrieving revision 1.602
  diff -u -r1.601 -r1.602
  --- WHATSNEW  26 Apr 2004 19:23:53 -  1.601
  +++ WHATSNEW  27 Apr 2004 07:44:46 -  1.602
  @@ -161,6 +161,11 @@
   
   * New "pattern" attribute for  selector.
   
  +*  has a new forkmode attribute that controls the number of
  +  Java VMs that get created when forking tests.  This allows you to
  +  run all tests in a single forked JVM reducing the overhead of VM
  +  creation a lot.  Bugzilla Report 24697.
  +
   Changes from Ant 1.6.0 to Ant 1.6.1
   =
   
  
  
  
  1.418 +2 -2  ant/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/ant/build.xml,v
  retrieving revision 1.417
  retrieving revision 1.418
  diff -u -r1.417 -r1.418
  --- build.xml 23 Apr 2004 10:03:49 -  1.417
  +++ build.xml 27 Apr 2004 07:44:46 -  1.418
  @@ -53,7 +53,7 @@
 
 
 
  -  
  +  
 
   
 
 
  
  
  
  1.35  +18 -0 ant/docs/manual/OptionalTasks/junit.html
  
  Index: junit.html
  ===
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/junit.html,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- junit.html20 Apr 2004 07:27:21 -  1.34
  +++ junit.html27 Apr 2004 07:44:47 -  1.35
  @@ -68,6 +68,24 @@
   No; default is off.
 
 
  +forkmode
  +Controls how many Java Virtual Machines get
  +created if you want to fork some tests.  Possible values are
  +"perTest" (the default), "perBatch" and
  +"once".  "once" creates only a single Java VM
  +for all tests while "perTest" creates a new VM for each
  +TestCase class.  "perBatch" creates a VM for each nested
  + and one collecting all nested
  +s.  Note that only tests with the same
  +settings of filtertrace, haltonerror,
  +haltonfailure, errorproperty and
  +failureproperty can share a VM, so even if you set
  +forkmode to "once", Ant may have to create
  +more than a single Java VM.  This attribute is ignored for tests
  +that don't get forked into a new Java VM.
  +No; default is perTest.
  +  
  +  
   haltonerror
   Stop the build process if an error occurs during the 
test
  run.
  
  
  
  1.99  +10 -10
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- JUnitTask.java20 Apr 2004 06:52:48 -  1.98
  +++ JUnitTask.java27 Apr 2004 07:44:47 -  1.99
  @@ -147,7 +147,7 @@
   private File tmpDir;
   private AntClassLoader classLoader = null;
   private Permissions perm = null;
  -private ForkStyle forkStyle = new ForkStyle("perTest");
  +private ForkMode forkMode = new ForkMode("perTest");
   
   private static final int STRING_BUFFER_SIZE = 128;
   
  @@ -295,8 +295,8 @@
*
* @since Ant 1.6.2
*/
  -public void setForkStyle(ForkStyle style) {
  -this.forkStyle = style;
  +public void setForkMode(ForkMode mode) {
  +this.forkMode = mode;
   }
   
   /**
  @@ -641,11 +641,11 @@
   public void execute() throws BuildException {
   List testLists = new ArrayList();
   
  -boolean forkPerTest = 
forkStyle.getValue().equals(ForkStyle.PER_TEST);
  -if (forkPerTest || forkStyle.getValue().equals(ForkStyle.ONCE)) {
  +boolean forkPerTest = forkMode.getValue().equals(ForkMode.PER_TEST);
  +if (forkPerTest || forkMode.getValue().equals(ForkMode.ONCE)) {
   testLists.addAll(executeOrQueue(getIndividualTests(),
   forkPerTest));
  -} else { /* forkStyle.getValue().equals(ForkStyle.PER_BATCH) */
  +} else { /* forkMode.getValue().equals(ForkMode.PER_BATCH) */
   final int count = batchTests.size();
   for (int i = 0; i < count; i++) {
   BatchTest batchtest = (BatchTest) batchTests.elementAt(i);
  @@ -1379,7 +1379,7 @@
* These are the different forking options
* 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-04-20 Thread bodewig
bodewig 2004/04/19 23:52:48

  Modified:src/main/org/apache/tools/ant/taskdefs Java.java
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Minor formatting changes
  
  Revision  ChangesPath
  1.91  +1 -1  ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- Java.java 29 Mar 2004 17:02:13 -  1.90
  +++ Java.java 20 Apr 2004 06:52:48 -  1.91
  @@ -578,7 +578,7 @@
*/
   public void setTimeout(Long value) {
   timeout = value;
  -incompatibleWithSpawn |= timeout!=null;
  +incompatibleWithSpawn |= timeout != null;
   }
   
   /**
  
  
  
  1.98  +6 -6  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- JUnitTask.java19 Apr 2004 14:25:43 -  1.97
  +++ JUnitTask.java20 Apr 2004 06:52:48 -  1.98
  @@ -608,10 +608,10 @@
* @since Ant 1.6
*/
   public void setTempdir(File tmpDir) {
  -if(tmpDir!=null) {
  -if(!tmpDir.exists() || !tmpDir.isDirectory()) {
  +if (tmpDir!=null) {
  +if (!tmpDir.exists() || !tmpDir.isDirectory()) {
   throw new BuildException(tmpDir.toString()
  -+" is not a valid temp directory");
  + +" is not a valid temp directory");
   }
   }
   this.tmpDir = tmpDir;
  @@ -1094,7 +1094,7 @@
   if (timeout == null) {
   return null;
   }
  -return new ExecuteWatchdog((long)timeout.intValue());
  +return new ExecuteWatchdog((long) timeout.intValue());
   }
   
   /**
  @@ -1331,7 +1331,7 @@
* configure from a test; sets member variables to attributes of the 
test
* @param test
*/
  -public ForkedTestConfiguration(JUnitTest test) {
  +ForkedTestConfiguration(JUnitTest test) {
   this(test.getFiltertrace(),
   test.getHaltonerror(),
   test.getHaltonfailure(),
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-04-19 Thread stevel
stevel  2004/04/19 07:25:43

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Javadocs and some refactoring. tmpDir is now validated and used consistently 
where properties files are created.
  
  Revision  ChangesPath
  1.97  +76 -19
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- JUnitTask.java16 Apr 2004 07:06:36 -  1.96
  +++ JUnitTask.java19 Apr 2004 14:25:43 -  1.97
  @@ -277,7 +277,7 @@
   }
   
   /**
  - * Set the bahvior when [EMAIL PROTECTED] #setFork fork} fork has been 
enabled.
  + * Set the behavior when [EMAIL PROTECTED] #setFork fork} fork has been 
enabled.
*
* Possible values are "once", "perTest" and "perBatch".  If
* set to "once", only a single Java VM will be forked for all
  @@ -608,6 +608,12 @@
* @since Ant 1.6
*/
   public void setTempdir(File tmpDir) {
  +if(tmpDir!=null) {
  +if(!tmpDir.exists() || !tmpDir.isDirectory()) {
  +throw new BuildException(tmpDir.toString()
  ++" is not a valid temp directory");
  +}
  +}
   this.tmpDir = tmpDir;
   }
   
  @@ -699,11 +705,7 @@
   JUnitTest test = null;
   // Create a temporary file to pass the test cases to run to 
   // the runner (one test case per line)
  -File casesFile = 
  -FileUtils.newFileUtils().createTempFile("junittestcases", 
  -".properties",
  -
getProject().getBaseDir());
  -casesFile.deleteOnExit();
  +File casesFile = createTempPropertiesFile("junittestcases");
   PrintWriter writer = null;
   try {
   writer = 
  @@ -834,12 +836,8 @@
   }
   }
   
  -// Create a temporary file to pass the Ant properties to the
  -// forked test
  -File propsFile =
  -FileUtils.newFileUtils().createTempFile("junit", ".properties",
  -tmpDir != null ? tmpDir : getProject().getBaseDir());
  -propsFile.deleteOnExit();
  +
  +File propsFile = createTempPropertiesFile("junit");
   cmd.createArgument().setValue("propsfile="
 + propsFile.getAbsolutePath());
   Hashtable p = getProject().getProperties();
  @@ -898,6 +896,22 @@
   return retVal;
   }
   
  +/**
  + * Create a temporary file to pass the properties to a new process.
  + * Will auto-delete on (graceful) exit.
  + * The file will be in the project basedir unless tmpDir declares
  + * something else.
  + * @param prefix
  + * @return
  + */
  +private File createTempPropertiesFile(String prefix) {
  +File propsFile =
  +FileUtils.newFileUtils().createTempFile(prefix, ".properties",
  +tmpDir != null ? tmpDir : getProject().getBaseDir());
  +propsFile.deleteOnExit();
  +return propsFile;
  +}
  +
   
   /**
* Pass output sent to System.out to the TestRunner so it can
  @@ -1080,7 +1094,7 @@
   if (timeout == null) {
   return null;
   }
  -return new ExecuteWatchdog(timeout.intValue());
  +return new ExecuteWatchdog((long)timeout.intValue());
   }
   
   /**
  @@ -1229,6 +1243,10 @@
   OutputStream out) {
   formatter.setOutput(out);
   formatter.startTestSuite(test);
  +
  +//the trick to integrating test output to the formatter, is to
  +//create a special test class that asserts a timout occurred,
  +//and tell the formatter that it raised.  
   Test t = new Test() {
   public int countTestCases() { return 1; }
   public void run(TestResult r) {
  @@ -1281,6 +1299,7 @@
   }
   
   /**
  + * Forked test support
* @since Ant 1.6.2
*/
   private final class ForkedTestConfiguration {
  @@ -1289,6 +1308,15 @@
   private boolean haltOnFailure;
   private String errorProperty;
   private String failureProperty;
  +
  +/**
  + * constructor for forked test configuration
  + * @param filterTrace
  + * @param haltOnError
  + * @param haltOnFailure
  + * @param errorProperty
  + * @param failureProperty
  + */
   ForkedTestConfiguration(boolean filterTrace, boolean haltOnError,
   boolea

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2004-04-16 Thread bodewig
bodewig 2004/04/16 00:06:36

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Merged the subclass-friendly  version into 1.6 branch
  
  Revision  ChangesPath
  1.96  +2 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- JUnitTask.java15 Apr 2004 13:53:47 -  1.95
  +++ JUnitTask.java16 Apr 2004 07:06:36 -  1.96
  @@ -1271,7 +1271,7 @@
   }
   
   /**
  - * @since Ant 1.7
  + * @since Ant 1.6.2
*/
   protected CommandlineJava getCommandline() {
   if (commandline == null) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-10-22 Thread bodewig
bodewig 2003/10/22 07:39:43

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  Merge from HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.83.2.5  +3 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.4
  retrieving revision 1.83.2.5
  diff -u -r1.83.2.4 -r1.83.2.5
  --- JUnitTask.java20 Oct 2003 10:48:47 -  1.83.2.4
  +++ JUnitTask.java22 Oct 2003 14:39:43 -  1.83.2.5
  @@ -1129,6 +1129,8 @@
   
   private void logTimeout(FormatterElement[] feArray, JUnitTest test) {
   createClassLoader();
  +test.setCounts(1, 0, 1);
  +test.setProperties(getProject().getProperties());
   for (int i = 0; i < feArray.length; i++) {
   FormatterElement fe = feArray[i];
   File outFile = getOutput(fe, test);
  @@ -1158,7 +1160,6 @@
   OutputStream out) {
   formatter.setOutput(out);
   formatter.startTestSuite(test);
  -test.setCounts(1, 0, 1);
   Test t = new Test() {
   public int countTestCases() { return 1; }
   public void run(TestResult r) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-10-22 Thread bodewig
bodewig 2003/10/22 07:38:51

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Make properties available in timed-out tests, PR 23935
  
  Revision  ChangesPath
  1.88  +3 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- JUnitTask.java20 Oct 2003 10:48:04 -  1.87
  +++ JUnitTask.java22 Oct 2003 14:38:50 -  1.88
  @@ -1129,6 +1129,8 @@
   
   private void logTimeout(FormatterElement[] feArray, JUnitTest test) {
   createClassLoader();
  +test.setCounts(1, 0, 1);
  +test.setProperties(getProject().getProperties());
   for (int i = 0; i < feArray.length; i++) {
   FormatterElement fe = feArray[i];
   File outFile = getOutput(fe, test);
  @@ -1158,7 +1160,6 @@
   OutputStream out) {
   formatter.setOutput(out);
   formatter.startTestSuite(test);
  -test.setCounts(1, 0, 1);
   Test t = new Test() {
   public int countTestCases() { return 1; }
   public void run(TestResult r) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-10-20 Thread bodewig
bodewig 2003/10/20 03:48:48

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  Merge from HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.83.2.4  +2 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.3
  retrieving revision 1.83.2.4
  diff -u -r1.83.2.3 -r1.83.2.4
  --- JUnitTask.java14 Oct 2003 13:20:12 -  1.83.2.3
  +++ JUnitTask.java20 Oct 2003 10:48:47 -  1.83.2.4
  @@ -618,6 +618,7 @@
   public void init() {
   antRuntimeClasses = new Path(getProject());
   addClasspathEntry("/junit/framework/TestCase.class");
  +addClasspathEntry("/org/apache/tools/ant/launch/AntMain.class");
   addClasspathEntry("/org/apache/tools/ant/Task.class");
   
addClasspathEntry("/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class");
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-10-20 Thread bodewig
bodewig 2003/10/20 03:48:04

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Pull ant-launcher.jar into the classpath as well
  
  Revision  ChangesPath
  1.87  +2 -1  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- JUnitTask.java14 Oct 2003 13:19:53 -  1.86
  +++ JUnitTask.java20 Oct 2003 10:48:04 -  1.87
  @@ -618,6 +618,7 @@
   public void init() {
   antRuntimeClasses = new Path(getProject());
   addClasspathEntry("/junit/framework/TestCase.class");
  +addClasspathEntry("/org/apache/tools/ant/launch/AntMain.class");
   addClasspathEntry("/org/apache/tools/ant/Task.class");
   
addClasspathEntry("/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class");
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-10-10 Thread bodewig
bodewig 2003/10/10 06:39:13

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Log:
  Merge from HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.83.2.2  +3 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.83.2.1
  retrieving revision 1.83.2.2
  diff -u -r1.83.2.1 -r1.83.2.2
  --- JUnitTask.java27 Sep 2003 03:20:13 -  1.83.2.1
  +++ JUnitTask.java10 Oct 2003 13:39:13 -  1.83.2.2
  @@ -1156,9 +1156,9 @@
   OutputStream out) {
   formatter.setOutput(out);
   formatter.startTestSuite(test);
  -test.setCounts(0, 0, 1);
  +test.setCounts(1, 0, 1);
   Test t = new Test() {
  -public int countTestCases() { return 0; }
  +public int countTestCases() { return 1; }
   public void run(TestResult r) {
   throw new AssertionFailedError("Timeout occurred");
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-10-10 Thread bodewig
bodewig 2003/10/10 06:38:25

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  A timed out test is stil a test, PR 23645
  
  Revision  ChangesPath
  1.85  +3 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- JUnitTask.java23 Sep 2003 06:31:46 -  1.84
  +++ JUnitTask.java10 Oct 2003 13:38:25 -  1.85
  @@ -1156,9 +1156,9 @@
   OutputStream out) {
   formatter.setOutput(out);
   formatter.startTestSuite(test);
  -test.setCounts(0, 0, 1);
  +test.setCounts(1, 0, 1);
   Test t = new Test() {
  -public int countTestCases() { return 0; }
  +public int countTestCases() { return 1; }
   public void run(TestResult r) {
   throw new AssertionFailedError("Timeout occurred");
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-27 Thread stevel
stevel  2003/09/26 20:20:13

  Modified:src/main/org/apache/tools/ant/types Tag: ANT_16_BRANCH
Assertions.java
   src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Java.java
   src/main/org/apache/tools/ant/taskdefs/optional/junit Tag:
ANT_16_BRANCH JUnitTask.java
  Added:   src/etc/testcases/types Tag: ANT_16_BRANCH assertions.xml
   src/testcases/org/apache/tools/ant/types Tag: ANT_16_BRANCH
AssertionsTest.java
   src/etc/testcases/types/assertions Tag: ANT_16_BRANCH
AssertionTest.java
  Log:
  port of assertion from 1.7a to 1.6 branch
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.6.2.1   +8 -3  ant/src/main/org/apache/tools/ant/types/Assertions.java
  
  Index: Assertions.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Assertions.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- Assertions.java   21 Sep 2003 20:20:02 -  1.6
  +++ Assertions.java   27 Sep 2003 03:20:13 -  1.6.2.1
  @@ -55,14 +55,15 @@
   package org.apache.tools.ant.types;
   
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.Project;
   
   import java.util.List;
   import java.util.ArrayList;
   import java.util.Iterator;
   
   /**
  - * implement the assertion datatype. This type describes
  - * assertion settings for the  task and derivatives.
  + * The assertion datatype. This type describes
  + * assertion settings for the  task and others.
* One can set the system assertions, and enable/disable those in
* packages & classes.
* Assertions can only be enabled or disabled when forking Java.
  @@ -127,7 +128,7 @@
* disable assertions
* @param assertion
*/
  -public void addDisable(EnabledAssertion assertion) {
  +public void addDisable(DisabledAssertion assertion) {
   checkChildrenAllowed();
   assertionList.add(assertion);
   }
  @@ -196,11 +197,14 @@
* @param commandList
*/
   public void applyAssertions(List commandList) {
  +getProject().log("Applying assertions",Project.MSG_DEBUG);
   Assertions clause = getFinalReference();
   //do the system assertions
   if (Boolean.TRUE.equals(clause.enableSystemAssertions)) {
  +getProject().log("Enabling system assertions", 
Project.MSG_DEBUG);
   commandList.add("-enablesystemassertions");
   } else if (Boolean.FALSE.equals(clause.enableSystemAssertions)) {
  +getProject().log("disabling system assertions", 
Project.MSG_DEBUG);
   commandList.add("-disablesystemassertions");
   }
   
  @@ -209,6 +213,7 @@
   while (it.hasNext()) {
   BaseAssertion assertion = (BaseAssertion) it.next();
   String arg = assertion.toCommand();
  +getProject().log("adding assertion "+arg, Project.MSG_DEBUG);
   commandList.add(arg);
   }
   }
  
  
  
  No   revision
  No   revision
  1.1.2.1   +0 -0  ant/src/etc/testcases/types/assertions.xml
  
  Index: assertions.xml
  ===
  RCS file: /home/cvs/ant/src/etc/testcases/types/assertions.xml,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  
  No   revision
  No   revision
  1.1.2.1   +0 -0  
ant/src/testcases/org/apache/tools/ant/types/AssertionsTest.java
  
  Index: AssertionsTest.java
  ===
  RCS file: 
/home/cvs/ant/src/testcases/org/apache/tools/ant/types/AssertionsTest.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  
  No   revision
  No   revision
  1.1.2.1   +0 -0  ant/src/etc/testcases/types/assertions/AssertionTest.java
  
  Index: AssertionTest.java
  ===
  RCS file: 
/home/cvs/ant/src/etc/testcases/types/assertions/AssertionTest.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  
  No   revision
  No   revision
  1.77.2.1  +8 -1  ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.77
  retrieving revision 1.77.2.1
  diff -u -r1.77 -r1.77.2.1
  --- Java.java 21 Sep 2003 20:20:03 -  1.77
  +++ Java.java 27 Sep 2003 03:

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-23 Thread stevel
stevel  2003/09/22 23:31:46

  Modified:src/main/org/apache/tools/ant/types Assertions.java
defaults.properties
   src/main/org/apache/tools/ant/taskdefs/optional/jsp
Jasper41Mangler.java
   src/main/org/apache/tools/ant/taskdefs Java.java
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Added:   src/etc/testcases/types assertions.xml
   src/testcases/org/apache/tools/ant/types AssertionsTest.java
   src/etc/testcases/types/assertions AssertionTest.java
  Log:
  With these changes assertions now work, at least as far as the java tests are 
concerned...not tested junit
  
  Revision  ChangesPath
  1.7   +8 -3  ant/src/main/org/apache/tools/ant/types/Assertions.java
  
  Index: Assertions.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Assertions.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Assertions.java   21 Sep 2003 20:20:02 -  1.6
  +++ Assertions.java   23 Sep 2003 06:31:46 -  1.7
  @@ -55,14 +55,15 @@
   package org.apache.tools.ant.types;
   
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.Project;
   
   import java.util.List;
   import java.util.ArrayList;
   import java.util.Iterator;
   
   /**
  - * implement the assertion datatype. This type describes
  - * assertion settings for the  task and derivatives.
  + * The assertion datatype. This type describes
  + * assertion settings for the  task and others.
* One can set the system assertions, and enable/disable those in
* packages & classes.
* Assertions can only be enabled or disabled when forking Java.
  @@ -127,7 +128,7 @@
* disable assertions
* @param assertion
*/
  -public void addDisable(EnabledAssertion assertion) {
  +public void addDisable(DisabledAssertion assertion) {
   checkChildrenAllowed();
   assertionList.add(assertion);
   }
  @@ -196,11 +197,14 @@
* @param commandList
*/
   public void applyAssertions(List commandList) {
  +getProject().log("Applying assertions",Project.MSG_DEBUG);
   Assertions clause = getFinalReference();
   //do the system assertions
   if (Boolean.TRUE.equals(clause.enableSystemAssertions)) {
  +getProject().log("Enabling system assertions", 
Project.MSG_DEBUG);
   commandList.add("-enablesystemassertions");
   } else if (Boolean.FALSE.equals(clause.enableSystemAssertions)) {
  +getProject().log("disabling system assertions", 
Project.MSG_DEBUG);
   commandList.add("-disablesystemassertions");
   }
   
  @@ -209,6 +213,7 @@
   while (it.hasNext()) {
   BaseAssertion assertion = (BaseAssertion) it.next();
   String arg = assertion.toCommand();
  +getProject().log("adding assertion "+arg, Project.MSG_DEBUG);
   commandList.add(arg);
   }
   }
  
  
  
  1.20  +1 -1  
ant/src/main/org/apache/tools/ant/types/defaults.properties
  
  Index: defaults.properties
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/types/defaults.properties,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- defaults.properties   21 Sep 2003 22:30:44 -  1.19
  +++ defaults.properties   23 Sep 2003 06:31:46 -  1.20
  @@ -19,4 +19,4 @@
   zipfileset=org.apache.tools.ant.types.ZipFileSet
   scriptfilter=org.apache.tools.ant.types.optional.ScriptFilter
   propertyset=org.apache.tools.ant.types.PropertySet
  -assertion=org.apache.tools.ant.types.Assertion
  \ No newline at end of file
  +assertions=org.apache.tools.ant.types.Assertions
  
  
  
  1.1  ant/src/etc/testcases/types/assertions.xml
  
  Index: assertions.xml
  ===
  
  
  
  





  



  
  



  

  


  

  

  




  

  

  

  


  

  
  
  


  

  
  

  
  
  


  

  
  
  
  

  
  
  


  

  
  
  

  
  




  
  
  
  
  

  




  

  

  
  
  


  

  


  
  




  
  
  
  
  

   

Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-19 Thread Stefan Bodewig
On Fri, 19 Sep 2003, Antoine Lévy-Lambert <[EMAIL PROTECTED]>
wrote:

> I am a bit surprised that you solve this issue
> (classpath/includeantruntime) this way.

Please read the bugzilla report.

 will not pass any
additional classpath at al.  This means the user's CLASSPATH is the
only thing passed to the forked VM.  This is so that classes from
ANT_HOME/lib like the specific Xerces version Ant uses do not taint
the classpath - users may want to test with a different XML parser,
DOM version, whatever.

 is there to "help" the
user.  Ant uses a testrunner of its own, therefore some classes of Ant
itself must be available to the forked VM, namely JUnit itself, the
optional.junit package more or less completely and classes from Ant's
core the junit package depends on.

The code up until now located the necessary resources and passed them
in via java -classpath .  But if you do that, CLASSPATH will be
ignored by the forked VM.  I simply added the CLASSPATH to the command
line explicitly.

> The ant runtime is not in the CLASSPATH environment variable in
> ant1.6,

but in one of the jars added by the task.

> but in the system property java.class.path.

Like Xerces and everything else from ANT_HOME/lib that we explicitly
do not want to pass to the forked VM - that's why I've used the
environment variable directly.

Stefan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-19 Thread Antoine Lévy-Lambert
Stefan,

I am a bit surprised that you solve this issue (classpath/includeantruntime)
this way.
The ant runtime is not in the CLASSPATH environment variable in ant1.6, but
in the system property java.class.path.
Or did I understand something wrongly ?
Antoine

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 19. September 2003 11:18
An: [EMAIL PROTECTED]
Betreff: cvs commit:
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java


bodewig 2003/09/19 02:18:16

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
   replaced the CLASSPATH
  instead of adding to it.

  PR: 14971

  Revision  ChangesPath
  1.503 +3 -0  ant/WHATSNEW

  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.502
  retrieving revision 1.503
  diff -u -r1.502 -r1.503
  --- WHATSNEW  18 Sep 2003 15:47:47 -  1.502
  +++ WHATSNEW  19 Sep 2003 09:18:16 -  1.503
  @@ -242,6 +242,9 @@
   * The socket condition will now close the socket created to test.
 Bugzilla Report 23040.

  +*  replaced the CLASSPATH
instead
  +  of adding to it.  Bugzilla Report 14971.
  +
   Other changes:
   --
   * All tasks can be used outside of s.  Note that some tasks



  1.83  +12 -1
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

  Index: JUnitTask.java
  ===
  RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTas
k.java,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- JUnitTask.java17 Sep 2003 08:30:30 -  1.82
  +++ JUnitTask.java19 Sep 2003 09:18:16 -  1.83
  @@ -717,6 +717,17 @@
   cmd.createArgument().setValue("haltOnFailure="
 + test.getHaltonfailure());
   if (includeAntRuntime) {
  +Vector v = Execute.getProcEnvironment();
  +Enumeration e = v.elements();
  +while (e.hasMoreElements()) {
  +String s = (String) e.nextElement();
  +if (s.startsWith("CLASSPATH=")) {
  +cmd.createClasspath(getProject()).createPath()
  +.append(new Path(getProject(),
  + s.substring(10 //
"CLASSPATH=".length()
  + )));
  +}
  +}
   log("Implicitly adding " + antRuntimeClasses + " to
CLASSPATH",
   Project.MSG_VERBOSE);
   cmd.createClasspath(getProject()).createPath()




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-19 Thread bodewig
bodewig 2003/09/19 02:18:16

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
   replaced the CLASSPATH
  instead of adding to it.
  
  PR: 14971
  
  Revision  ChangesPath
  1.503 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.502
  retrieving revision 1.503
  diff -u -r1.502 -r1.503
  --- WHATSNEW  18 Sep 2003 15:47:47 -  1.502
  +++ WHATSNEW  19 Sep 2003 09:18:16 -  1.503
  @@ -242,6 +242,9 @@
   * The socket condition will now close the socket created to test.
 Bugzilla Report 23040.
   
  +*  replaced the CLASSPATH instead
  +  of adding to it.  Bugzilla Report 14971.
  +
   Other changes:
   --
   * All tasks can be used outside of s.  Note that some tasks
  
  
  
  1.83  +12 -1 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- JUnitTask.java17 Sep 2003 08:30:30 -  1.82
  +++ JUnitTask.java19 Sep 2003 09:18:16 -  1.83
  @@ -717,6 +717,17 @@
   cmd.createArgument().setValue("haltOnFailure="
 + test.getHaltonfailure());
   if (includeAntRuntime) {
  +Vector v = Execute.getProcEnvironment();
  +Enumeration e = v.elements();
  +while (e.hasMoreElements()) {
  +String s = (String) e.nextElement();
  +if (s.startsWith("CLASSPATH=")) {
  +cmd.createClasspath(getProject()).createPath()
  +.append(new Path(getProject(), 
  + s.substring(10 // 
"CLASSPATH=".length()
  + )));
  +}
  +}
   log("Implicitly adding " + antRuntimeClasses + " to CLASSPATH",
   Project.MSG_VERBOSE);
   cmd.createClasspath(getProject()).createPath()
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-17 Thread bodewig
bodewig 2003/09/17 01:30:30

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  A test that has timed out must be considered an error, PR 23150
  
  Revision  ChangesPath
  1.82  +5 -3  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- JUnitTask.java17 Sep 2003 08:22:50 -  1.81
  +++ JUnitTask.java17 Sep 2003 08:30:30 -  1.82
  @@ -668,8 +668,10 @@
   
   // if there is an error/failure and that it should halt, stop
   // everything otherwise just log a statement
  -boolean errorOccurredHere = exitValue == JUnitTestRunner.ERRORS;
  -boolean failureOccurredHere = exitValue != JUnitTestRunner.SUCCESS;
  +boolean errorOccurredHere = 
  +exitValue == JUnitTestRunner.ERRORS || wasKilled;
  +boolean failureOccurredHere = 
  +exitValue != JUnitTestRunner.SUCCESS || wasKilled;
   if (errorOccurredHere || failureOccurredHere) {
   if ((errorOccurredHere && test.getHaltonerror())
   || (failureOccurredHere && test.getHaltonfailure())) {
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-17 Thread bodewig
bodewig 2003/09/17 01:22:50

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Drop JDK 1.1 compatibility in favor of improved error handling, submitted by 
Martijn Kruithof
  
  Revision  ChangesPath
  1.81  +2 -2  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- JUnitTask.java17 Sep 2003 08:20:54 -  1.80
  +++ JUnitTask.java17 Sep 2003 08:22:50 -  1.81
  @@ -763,7 +763,7 @@
   }
   try {
   FileOutputStream outstream = new FileOutputStream(propsFile);
  -props.save(outstream, "Ant JUnitTask generated properties file");
  +props.store(outstream, "Ant JUnitTask generated properties 
file");
   outstream.close();
   } catch (java.io.IOException e) {
   propsFile.delete();
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-17 Thread bodewig
bodewig 2003/09/17 01:20:54

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Log tests that have timed out in the summary as well.
  
  PR: 23160
  Submitted by: Martijn Kruithof 
  
  Revision  ChangesPath
  1.80  +28 -16
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- JUnitTask.java11 Sep 2003 14:04:16 -  1.79
  +++ JUnitTask.java17 Sep 2003 08:20:54 -  1.80
  @@ -1118,26 +1118,38 @@
   if (outFile != null && formatter != null) {
   try {
   OutputStream out = new FileOutputStream(outFile);
  -formatter.setOutput(out);
  -formatter.startTestSuite(test);
  -test.setCounts(0, 0, 1);
  -Test t = new Test() {
  -public int countTestCases() { return 0; }
  -public void run(TestResult r) {
  -throw new AssertionFailedError("Timeout 
occurred");
  -}
  -};
  -formatter.startTest(t);
  -formatter
  -.addError(t,
  -  new AssertionFailedError("Timeout 
occurred"));
  -
  -formatter.endTestSuite(test);
  +addTimeout(test, formatter, out);
   } catch (IOException e) {
   // ignore
   }
   }
   }
  +if (summary) {
  +SummaryJUnitResultFormatter f = new 
SummaryJUnitResultFormatter();
  +
f.setWithOutAndErr("withoutanderr".equalsIgnoreCase(summaryValue));
  +addTimeout(test, f, getDefaultOutput());
  +}
  +}
  +
  +/**
  + * Adds the actual timeout to the formatter. 
  + * Only used from the logTimeout method.
  + * @since Ant 1.6
  + */
  +private void addTimeout(JUnitTest test, JUnitResultFormatter formatter, 
  +OutputStream out) {
  +formatter.setOutput(out);
  +formatter.startTestSuite(test);
  +test.setCounts(0, 0, 1);
  +Test t = new Test() {
  +public int countTestCases() { return 0; }
  +public void run(TestResult r) {
  +throw new AssertionFailedError("Timeout occurred");
  +}
  +};
  +formatter.startTest(t);
  +formatter.addError(t, new AssertionFailedError("Timeout occurred"));
  +formatter.endTestSuite(test);
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-09-11 Thread conor
conor   2003/09/11 07:04:16

  Modified:src/main/org/apache/tools/ant Task.java
   src/main/org/apache/tools/ant/taskdefs CallTarget.java
Java.java
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Fix some incorrect comments
  
  PR:   23042
  
  Revision  ChangesPath
  1.49  +2 -2  ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -w -u -r1.48 -r1.49
  --- Task.java 13 Aug 2003 14:46:15 -  1.48
  +++ Task.java 11 Sep 2003 14:04:16 -  1.49
  @@ -344,7 +344,7 @@
   }
   
   /**
  - * Handles an error output by logging it with the INFO priority.
  + * Handles an error output by logging it with the ERR priority.
*
* @param output The error output to log. Should not be 
null.
*/
  @@ -353,7 +353,7 @@
   }
   
   /**
  - * Handles an error line by logging it with the INFO priority.
  + * Handles an error line by logging it with the ERR priority.
*
* @param output The error output to log. Should not be 
null.
*
  
  
  
  1.36  +1 -1  
ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
  
  Index: CallTarget.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -w -u -r1.35 -r1.36
  --- CallTarget.java   17 Jul 2003 10:20:15 -  1.35
  +++ CallTarget.java   11 Sep 2003 14:04:16 -  1.36
  @@ -239,7 +239,7 @@
   }
   
   /**
  - * Pass output sent to System.err to the new project.
  + * Pass output sent to System.err to the new project and flush stream.
*
* @since Ant 1.5.2
*/
  
  
  
  1.74  +5 -5  ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -w -u -r1.73 -r1.74
  --- Java.java 1 Sep 2003 12:45:07 -   1.73
  +++ Java.java 11 Sep 2003 14:04:16 -  1.74
  @@ -647,7 +647,7 @@
   }
   
   /**
  - * Pass output sent to System.err to specified output file.
  + * Handle output sent to System.err
*
* @param output string of stderr
*
  @@ -662,7 +662,7 @@
   }
   
   /**
  - * Pass output sent to System.err to specified output file.
  + * Handle output sent to System.err and flush the stream.
*
* @param output string of stderr
*
  
  
  
  1.79  +5 -5  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -w -u -r1.78 -r1.79
  --- JUnitTask.java27 Aug 2003 14:23:17 -  1.78
  +++ JUnitTask.java11 Sep 2003 14:04:16 -  1.79
  @@ -865,7 +865,7 @@
   
   /**
* Pass output sent to System.err to the TestRunner so it can
  - * collect ot for the formatters.
  + * collect it for the formatters.
*
* @param output output coming from System.err
* @since Ant 1.5
  @@ -884,7 +884,7 @@
   
   /**
* Pass output sent to System.err to the TestRunner so it can
  - * collect ot for the formatters.
  + * collect it for the formatters.
*
* @param output coming from System.err
* @since Ant 1.5.2
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-08-13 Thread Steve Loughran
Stefan Bodewig wrote:
On 13 Aug 2003, <[EMAIL PROTECTED]> wrote:

 enable assertions for  the same way as  uses them

Which is not much AFAICT.
Steve, shouldn't use addAssertions() instead?  The only problems I see
is that CommandlineJava won't accept multiple Assertions yet and that
multiple Assertions could have multiple (and ambiguos)
system-assertions settings.
Probably. Except that assertions are a recursive data structure, I believe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-08-13 Thread Stefan Bodewig
On 13 Aug 2003, Stefan Bodewig <[EMAIL PROTECTED]> wrote:

> Steve, shouldn't use addAssertions() instead?

shouldn't *we* use ...

Stefan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-08-13 Thread Stefan Bodewig
On 13 Aug 2003, <[EMAIL PROTECTED]> wrote:

>   enable assertions for  the same way as  uses them

Which is not much AFAICT.

Steve, shouldn't use addAssertions() instead?  The only problems I see
is that CommandlineJava won't accept multiple Assertions yet and that
multiple Assertions could have multiple (and ambiguos)
system-assertions settings.

Stefan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-08-13 Thread bodewig
bodewig 2003/08/13 06:28:12

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  enable assertions for  the same way as  uses them
  
  Revision  ChangesPath
  1.76  +11 -1 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- JUnitTask.java22 Jul 2003 07:56:14 -  1.75
  +++ JUnitTask.java13 Aug 2003 13:28:12 -  1.76
  @@ -70,6 +70,7 @@
   import org.apache.tools.ant.taskdefs.ExecuteWatchdog;
   import org.apache.tools.ant.taskdefs.LogOutputStream;
   import org.apache.tools.ant.taskdefs.LogStreamHandler;
  +import org.apache.tools.ant.types.Assertions;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.CommandlineJava;
   import org.apache.tools.ant.types.EnumeratedAttribute;
  @@ -558,6 +559,15 @@
*/
   public void setShowOutput(boolean showOutput) {
   this.showOutput = showOutput;
  +}
  +
  +/**
  + * Assertions to enable in this program (if fork=true)
  + * @since Ant 1.6
  + * @param asserts assertion set 
  + */
  +public void setAssertions(Assertions asserts) {
  +commandline.setAssertions(asserts);
   }
   
   /**
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-07-22 Thread antoine
antoine 2003/07/22 00:56:14

  Modified:.WHATSNEW
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Prevent adding sysproperties with a null key or a null value
  PR: 21684
  
  Revision  ChangesPath
  1.462 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.461
  retrieving revision 1.462
  diff -u -r1.461 -r1.462
  --- WHATSNEW  19 Jul 2003 14:58:48 -  1.461
  +++ WHATSNEW  22 Jul 2003 07:56:14 -  1.462
  @@ -207,6 +207,9 @@
   * Do not overwrite the value (increment) attribute of PropertyFile nested 
Entry element.
 Bugzilla Report 21505.
   
  +* Prevent sysproperties with no key or no value from being added.
  +  Bugzilla Report
  +
   
   Other changes:
   --
  
  
  
  1.75  +64 -5 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- JUnitTask.java19 Jul 2003 11:20:19 -  1.74
  +++ JUnitTask.java22 Jul 2003 07:56:14 -  1.75
  @@ -179,6 +179,8 @@
   private boolean showOutput = false;
   private File tmpDir;
   private AntClassLoader classLoader = null;
  +
  +private static final int STRING_BUFFER_SIZE = 128;
   /**
   * If true, force ant to re-classload all classes for each JUnit TestCase
   *
  @@ -325,11 +327,19 @@
* Print summary enumeration values.
*/
   public static class SummaryAttribute extends EnumeratedAttribute {
  +/**
  + * list the possible values
  + * @return  array of allowed values
  + */
   public String[] getValues() {
   return new String[] {"true", "yes", "false", "no",
"on", "off", "withOutAndErr"};
   }
   
  +/**
  + * gives the boolean equivalent of the authorized values
  + * @return boolean equivalent of the value
  + */
   public boolean asBoolean() {
   String value = getValue();
   return "true".equals(value)
  @@ -409,8 +419,26 @@
* testcases when JVM forking is not enabled.
*
* @since Ant 1.3
  + * @deprecated since ant 1.6
  + * @param sysp environment variable to add
*/
   public void addSysproperty(Environment.Variable sysp) {
  +
  +commandline.addSysproperty(sysp);
  +}
  +
  +/**
  + * Adds a system property that tests can access.
  + * This might be useful to tranfer Ant properties to the
  + * testcases when JVM forking is not enabled.
  + * @param sysp new environment variable to add
  + * @since Ant 1.6
  + */
  +public void addConfiguredSysproperty(Environment.Variable sysp) {
  +// get a build exception if there is a missing key or value
  +// see bugzilla report 21684
  +String testString = sysp.getContent();
  +getProject().log("sysproperty added : " + testString, 
Project.MSG_DEBUG);
   commandline.addSysproperty(sysp);
   }
   
  @@ -421,6 +449,7 @@
* This might be useful to tranfer Ant properties to the
* testcases when JVM forking is not enabled.
*
  + * @param sysp set of properties to be added
* @since Ant 1.6
*/
   public void addSyspropertyset(PropertySet sysp) {
  @@ -430,6 +459,7 @@
   /**
* Adds path to classpath used for tests.
*
  + * @return reference to the classpath in the embedded java command line
* @since Ant 1.2
*/
   public Path createClasspath() {
  @@ -438,6 +468,7 @@
   
   /**
* Adds a path to the bootclasspath.
  + * @return reference to the bootclasspath in the embedded java command 
line
* @since Ant 1.6
*/
   public Path createBootclasspath() {
  @@ -448,7 +479,7 @@
* Adds an environment variable; used when forking.
*
* Will be ignored if we are not forking a new VM.
  - *
  + * @param var environment variable to be added
* @since Ant 1.5
*/
   public void addEnv(Environment.Variable var) {
  @@ -460,6 +491,7 @@
*
* Will be ignored if we are not forking a new VM.
*
  + * @param newenv boolean indicating if setting a new environment is 
wished
* @since Ant 1.5
*/
   public void setNewenvironment(boolean newenv) {
  @@ -494,6 +526,7 @@
   /**
* Add a new formatter to all tests of this task.
*
  + * @param fe formatter element
* @since Ant 1.2
*/
   public 

cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-05-23 Thread bodewig
bodewig 2003/05/23 07:23:58

  Modified:src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  simplify patch a little further
  
  Revision  ChangesPath
  1.65  +3 -4  
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- JUnitTask.java23 May 2003 14:15:42 -  1.64
  +++ JUnitTask.java23 May 2003 14:23:58 -  1.65
  @@ -834,9 +834,8 @@
   try {
   log("Using System properties " + System.getProperties(),
   Project.MSG_VERBOSE);
  -Path userClasspath = commandline.getClasspath();
  -if (userClasspath != null) {
  -cl = createClassLoader();
  +cl = createClassLoader();
  +if (cl != null) {
   cl.setThreadContextLoader();
   }
   runner = new JUnitTestRunner(test, test.getHaltonerror(),
  
  
  


cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java

2003-03-31 Thread bodewig
bodewig 2003/03/31 04:27:14

  Modified:.WHATSNEW
   docs/manual/OptionalTasks junit.html
   src/main/org/apache/tools/ant/taskdefs/optional/junit
JUnitTask.java
  Log:
  Add tempdir attribute to  to control placement of temporary file.
  
  PR: 15454
  
  Revision  ChangesPath
  1.382 +3 -0  ant/WHATSNEW
  
  Index: WHATSNEW
  ===
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.381
  retrieving revision 1.382
  diff -u -r1.381 -r1.382
  --- WHATSNEW  31 Mar 2003 09:23:57 -  1.381
  +++ WHATSNEW  31 Mar 2003 12:27:13 -  1.382
  @@ -196,6 +196,9 @@
   *  now supports filtering and can check timestamps before
 overriding a file.  Bugzilla Report 18166.
   
  +*  has a new attribute tempdir that controls the placement of
  +  temporary files.  Bugzilla Report 15454.
  +
   Changes from Ant 1.5.2 to Ant 1.5.3
   ===
   
  
  
  
  1.24  +8 -1  ant/docs/manual/OptionalTasks/junit.html
  
  Index: junit.html
  ===
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/junit.html,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- junit.html6 Sep 2002 06:16:39 -   1.23
  +++ junit.html31 Mar 2003 12:27:13 -  1.24
  @@ -142,6 +142,13 @@
 formatters receive the output.
   No
 
  +  
  +tempdir
  +Where Ant should place temporary files.
  +  Since Ant 1.6.
  +No; default is the project's base
  +  directory.
  +  
   
   
   By using the errorproperty and failureproperty
  @@ -479,7 +486,7 @@
   ${reports.tests}.
   
   
  -Copyright © 2000-2002 Apache Software Foundation. All 
rights
  +Copyright © 2000-2003 Apache Software Foundation. All 
rights
   Reserved.
   
   
  
  
  
  1.59  +12 -1 
ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- JUnitTask.java7 Mar 2003 11:23:06 -   1.58
  +++ JUnitTask.java31 Mar 2003 12:27:14 -  1.59
  @@ -174,6 +174,7 @@
   private Path antRuntimeClasses = null;
   
   private boolean showOutput = false;
  +private File tmpDir;
   
   /**
* If true, smartly filter the stack frames of
  @@ -502,6 +503,15 @@
   }
   
   /**
  + * Where Ant should place temporary files.
  + *
  + * @since Ant 1.6
  + */
  +public void setTempdir(File tmpDir) {
  +this.tmpDir = tmpDir;
  +}
  +
  +/**
* Adds the jars or directories containing Ant, this task and
* JUnit to the classpath - this should make the forked JVM work
* without having to specify them directly.
  @@ -636,6 +646,7 @@
   // forked test
   File propsFile =
   FileUtils.newFileUtils().createTempFile("junit", ".properties",
  +tmpDir != null ? tmpDir :
   
getProject().getBaseDir());
   cmd.createArgument().setValue("propsfile="
 + propsFile.getAbsolutePath());