ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit JUnitTaskTest.java NoVmCrash.java Sleeper.java VmCrash.java
Date Thu, 30 Sep 2004 09:39:57 GMT
bodewig     2004/09/30 02:39:57

  Modified:    src/etc/testcases/taskdefs/optional junit.xml
  Added:       src/testcases/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTaskTest.java NoVmCrash.java Sleeper.java
                        VmCrash.java
  Log:
  Throw in some unit tests for <junit> - one of them will fail related to bug 30333
  
  Revision  Changes    Path
  1.3       +27 -0     ant/src/etc/testcases/taskdefs/optional/junit.xml
  
  Index: junit.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/optional/junit.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- junit.xml	18 Apr 2002 09:49:54 -0000	1.2
  +++ junit.xml	30 Sep 2004 09:39:57 -0000	1.3
  @@ -42,4 +42,31 @@
     <target name="outputTests" 
             depends="testForkedOutput,testNonForkedOutput,testForkedThreadedOutput,testNonForkedThreadedOutput"
/>
   
  +  <target name="crash">
  +    <junit fork="true" errorproperty="crashed">
  +      <test name="org.apache.tools.ant.taskdefs.optional.junit.VmCrash"/>
  +      <classpath refid="test" />
  +    </junit>
  +  </target>
  +
  +  <target name="nocrash">
  +    <junit fork="true" errorproperty="crashed">
  +      <test name="org.apache.tools.ant.taskdefs.optional.junit.NoVmCrash"/>
  +      <classpath refid="test" />
  +    </junit>
  +  </target>
  +
  +  <target name="timeout">
  +    <junit fork="true" errorproperty="timeout" timeout="1000">
  +      <test name="org.apache.tools.ant.taskdefs.optional.junit.Sleeper"/>
  +      <classpath refid="test" />
  +    </junit>
  +  </target>
  +
  +  <target name="notimeout">
  +    <junit fork="true" errorproperty="timeout" timeout="15000">
  +      <test name="org.apache.tools.ant.taskdefs.optional.junit.Sleeper"/>
  +      <classpath refid="test" />
  +    </junit>
  +  </target>
   </project>
  
  
  
  1.1                  ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java
  
  Index: JUnitTaskTest.java
  ===================================================================
  /*
   * Copyright  2002,2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  package org.apache.tools.ant.taskdefs.optional.junit;
  
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.BuildFileTest;
  import java.lang.reflect.InvocationTargetException;
  
  public class JUnitTaskTest extends BuildFileTest {
  
      /**
       * Constructor for the JUnitTaskTest object
       *
       * @param name we dont know
       */
      public JUnitTaskTest(String name) {
          super(name);
      }
  
  
      /**
       * The JUnit setup method
       */
      public void setUp() {
          configureProject("src/etc/testcases/taskdefs/optional/junit.xml");
      }
  
  
      /**
       * The teardown method for JUnit
       */
      public void tearDown() {
          //executeTarget("cleanup");
      }
  
      public void testCrash() {
         expectPropertySet("crash", "crashed");
      }
  
      public void testNoCrash() {
         expectPropertyUnset("nocrash", "crashed");
      }
  
      public void testTimeout() {
         expectPropertySet("timeout", "timeout");
      }
  
      public void testNoTimeout() {
         expectPropertyUnset("notimeout", "timeout");
      }
  
  }
  
  
  
  
  1.1                  ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/NoVmCrash.java
  
  Index: NoVmCrash.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  package org.apache.tools.ant.taskdefs.optional.junit;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestResult;
  
  /**
   * @version $Revision: 1.1 $
   */
  public class NoVmCrash extends TestCase {
  
      public NoVmCrash(String name) {
          super(name);
      }
  
      public void testNoCrash() {
      }
  
  }
  
  
  
  1.1                  ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/Sleeper.java
  
  Index: Sleeper.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  package org.apache.tools.ant.taskdefs.optional.junit;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestResult;
  
  /**
   * @version $Revision: 1.1 $
   */
  public class Sleeper extends TestCase {
  
      public Sleeper(String name) {
          super(name);
      }
  
      public void testSleep() {
          try {
              Thread.currentThread().sleep(5 * 1000);
          } catch (InterruptedException e) {
          } // end of try-catch
      }
  
  }
  
  
  
  1.1                  ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
  
  Index: VmCrash.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  package org.apache.tools.ant.taskdefs.optional.junit;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestResult;
  
  /**
   * @version $Revision: 1.1 $
   */
  public class VmCrash extends TestCase {
  
      public VmCrash(String name) {
          super(name);
      }
  
      public void testCrash() {
          System.exit(0);
      }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message