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  Changes    Path
  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 -0000      1.6
  +++ Assertions.java   27 Sep 2003 03:20:13 -0000      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 <java> task and derivatives.
  + * The assertion datatype. This type describes
  + * assertion settings for the <java> 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 -0000      1.77
  +++ Java.java 27 Sep 2003 03:20:13 -0000      1.77.2.1
  @@ -156,6 +156,10 @@
               throw new BuildException("You have used an attribute which is "
               + "not compatible with spawn");
           }
  +        if (cmdl.getAssertions() != null && !fork) {
  +            log("Assertion statements are currently ignored in non-forked 
mode");
  +        }
  +
           if (fork) {
               if (perm != null) {
                   log("Permissions can not be set this way in forked mode.", 
Project.MSG_WARN);
  @@ -591,7 +595,10 @@
        * @since Ant 1.6
        * @param asserts assertion set
        */
  -    public void setAssertions(Assertions asserts) {
  +    public void addAssertions(Assertions asserts) {
  +        if(cmdl.getAssertions() != null) {
  +            throw new BuildException("Only one assertion declaration is 
allowed");
  +        }
           cmdl.setAssertions(asserts);
       }
   
  
  
  
  No                   revision
  No                   revision
  1.83.2.1  +5 -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
  retrieving revision 1.83.2.1
  diff -u -r1.83 -r1.83.2.1
  --- JUnitTask.java    19 Sep 2003 09:18:16 -0000      1.83
  +++ JUnitTask.java    27 Sep 2003 03:20:13 -0000      1.83.2.1
  @@ -568,7 +568,10 @@
        * @since Ant 1.6
        * @param asserts assertion set
        */
  -    public void setAssertions(Assertions asserts) {
  +    public void addAssertions(Assertions asserts) {
  +        if (commandline.getAssertions() != null) {
  +            throw new BuildException("Only one assertion declaration is 
allowed");
  +        }
           commandline.setAssertions(asserts);
       }
   
  
  
  

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

Reply via email to