ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mariano Benitez <mari...@fuegolabs.com>
Subject Re: patch for JUnitTask extension
Date Fri, 20 Feb 2004 13:53:45 GMT
--- src/main/org/apache/tools/ant/types/CommandlineJava.java    2004-02-11 15:27:15.000000000
-0300
+++ /opt/java/ant/apache-ant-1.6.0/src/main/org/apache/tools/ant/types/CommandlineJava.java
    2004-02-11 15:08:41.000000000 -0300
@@ -432,7 +432,7 @@
      * Get the VM command parameters, including memory settings
      * @return
      */
-    private Commandline getActualVMCommand() {
+    protected Commandline getActualVMCommand() {
         Commandline actualVMCommand = (Commandline) vmCommand.clone();
         if (maxMemory != null) {
             if (vmVersion.startsWith("1.1")) {
@@ -567,7 +567,7 @@
      *
      * @since Ant 1.6
      */
-    private boolean haveClasspath() {
+    protected boolean haveClasspath() {
         Path fullClasspath = classpath != null
             ? classpath.concatSystemClasspath("ignore") : null;
         return fullClasspath != null
@@ -584,7 +584,7 @@
      *
      * @since Ant 1.6
      */
-    private boolean haveBootclasspath(boolean log) {
+    protected boolean haveBootclasspath(boolean log) {
         if (bootclasspath != null
             && bootclasspath.toString().trim().length() > 0) {

--- src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java        2004-02-11
15:27:15.000000000 -0300
+++ /opt/java/ant/apache-ant-1.6.0/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
2004-02-11 14:43:03.000000000 -0300
@@ -123,7 +123,7 @@
  */
 public class JUnitTask extends Task {
 
-    private CommandlineJava commandline = new CommandlineJava();
+    private CommandlineJava commandline;
     private Vector tests = new Vector();
     private Vector batchTests = new Vector();
     private Vector formatters = new Vector();
@@ -338,7 +338,7 @@
      * @since Ant 1.2
      */
     public void setMaxmemory(String max) {
-        commandline.setMaxmemory(max);
+        getCommandline().setMaxmemory(max);
     }

     /**
@@ -352,7 +352,7 @@
      * @since Ant 1.2
      */
     public void setJvm(String value) {
-        commandline.setVm(value);
+        getCommandline().setVm(value);
     }

     /**
@@ -365,7 +365,7 @@
      * @since Ant 1.2
      */
     public Commandline.Argument createJvmarg() {
-        return commandline.createVmArgument();
+        return getCommandline().createVmArgument();
     }

     /**
@@ -390,7 +390,7 @@
      */
     public void addSysproperty(Environment.Variable sysp) {

-        commandline.addSysproperty(sysp);
+        getCommandline().addSysproperty(sysp);
     }

     /**
@@ -405,7 +405,7 @@
         // see bugzilla report 21684
         String testString = sysp.getContent();
         getProject().log("sysproperty added : " + testString, Project.MSG_DEBUG);
-        commandline.addSysproperty(sysp);
+        getCommandline().addSysproperty(sysp);
     }

     /**
@@ -419,7 +419,7 @@
      * @since Ant 1.6
      */
     public void addSyspropertyset(PropertySet sysp) {
-        commandline.addSyspropertyset(sysp);
+        getCommandline().addSyspropertyset(sysp);
     }

     /**
@@ -429,7 +429,7 @@
      * @since Ant 1.2
      */
     public Path createClasspath() {
-        return commandline.createClasspath(getProject()).createPath();
+        return getCommandline().createClasspath(getProject()).createPath();
     }

     /**
@@ -438,7 +438,7 @@
      * @since Ant 1.6
      */
     public Path createBootclasspath() {
-        return commandline.createBootclasspath(getProject()).createPath();
+        return getCommandline().createBootclasspath(getProject()).createPath();
     }

     /**
@@ -532,10 +532,10 @@
      * @param asserts assertion set
      */
     public void addAssertions(Assertions asserts) {
-        if (commandline.getAssertions() != null) {
+        if (getCommandline().getAssertions() != null) {
             throw new BuildException("Only one assertion declaration is allowed");
         }
-        commandline.setAssertions(asserts);
+        getCommandline().setAssertions(asserts);
     }

     /**
@@ -557,7 +557,7 @@
      * @since Ant 1.2
      */
     public JUnitTask() throws Exception {
-        commandline
+        getCommandline()
             .setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner");
     }

@@ -675,7 +675,7 @@
             log("Permissions ignored when running in forked mode!", Project.MSG_WARN);
         }

-        CommandlineJava cmd = (CommandlineJava) commandline.clone();
+        CommandlineJava cmd = (CommandlineJava) getCommandline().clone();

         cmd.setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner");
         cmd.createArgument().setValue(test.getName());
@@ -903,13 +903,13 @@
                 + "the same VM.", Project.MSG_WARN);
         }

-        if (commandline.getBootclasspath() != null) {
+        if (getCommandline().getBootclasspath() != null) {
             log("bootclasspath is ignored if running in the same VM.",
                 Project.MSG_WARN);
         }

         CommandlineJava.SysProperties sysProperties =
-            commandline.getSystemProperties();
+                getCommandline().getSystemProperties();
         if (sysProperties != null) {
             sysProperties.setSystem();
         }
@@ -1141,7 +1141,7 @@
      * @since Ant 1.6
      */
     private void createClassLoader() {
-        Path userClasspath = commandline.getClasspath();
+        Path userClasspath = getCommandline().getClasspath();
         if (userClasspath != null) {
             if (reloading || classLoader == null) {
                 Path classpath = (Path) userClasspath.clone();
@@ -1163,4 +1163,12 @@
             }
         }
     }
+
+    protected CommandlineJava getCommandline()
+    {
+        if (commandline == null) {
+            commandline = new CommandlineJava();
+        }
+        return commandline;
+    }
 }


Mime
View raw message