git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276899 13f79535-47bb-0310-9956-ffa450edef68master
@@ -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> |
@@ -0,0 +1,68 @@ | |||
/* | |||
* 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"); | |||
} | |||
} | |||
@@ -0,0 +1,35 @@ | |||
/* | |||
* 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$ | |||
*/ | |||
public class NoVmCrash extends TestCase { | |||
public NoVmCrash(String name) { | |||
super(name); | |||
} | |||
public void testNoCrash() { | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
/* | |||
* 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$ | |||
*/ | |||
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 | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
/* | |||
* 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$ | |||
*/ | |||
public class VmCrash extends TestCase { | |||
public VmCrash(String name) { | |||
super(name); | |||
} | |||
public void testCrash() { | |||
System.exit(0); | |||
} | |||
} |