diff --git a/build.xml b/build.xml
index af6582970..077c56286 100644
--- a/build.xml
+++ b/build.xml
@@ -308,10 +308,22 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/ant.xml b/src/etc/testcases/taskdefs/ant.xml
new file mode 100644
index 000000000..ca96b4eb7
--- /dev/null
+++ b/src/etc/testcases/taskdefs/ant.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/antstructure.xml b/src/etc/testcases/taskdefs/antstructure.xml
new file mode 100644
index 000000000..61da25662
--- /dev/null
+++ b/src/etc/testcases/taskdefs/antstructure.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/available.xml b/src/etc/testcases/taskdefs/available.xml
new file mode 100644
index 000000000..453d573c5
--- /dev/null
+++ b/src/etc/testcases/taskdefs/available.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/copydir.xml b/src/etc/testcases/taskdefs/copydir.xml
new file mode 100644
index 000000000..87128f2c8
--- /dev/null
+++ b/src/etc/testcases/taskdefs/copydir.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/copyfile.xml b/src/etc/testcases/taskdefs/copyfile.xml
new file mode 100644
index 000000000..60e61492d
--- /dev/null
+++ b/src/etc/testcases/taskdefs/copyfile.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/delete.xml b/src/etc/testcases/taskdefs/delete.xml
new file mode 100644
index 000000000..06610dcf4
--- /dev/null
+++ b/src/etc/testcases/taskdefs/delete.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/deltree.xml b/src/etc/testcases/taskdefs/deltree.xml
new file mode 100644
index 000000000..4a0c32dcd
--- /dev/null
+++ b/src/etc/testcases/taskdefs/deltree.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/echo.xml b/src/etc/testcases/taskdefs/echo.xml
new file mode 100644
index 000000000..147c37fa6
--- /dev/null
+++ b/src/etc/testcases/taskdefs/echo.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+ is
+ a
+ multiline
+ message
+
+
+
+
\ No newline at end of file
diff --git a/src/etc/testcases/taskdefs/fail.xml b/src/etc/testcases/taskdefs/fail.xml
new file mode 100644
index 000000000..88ce615a3
--- /dev/null
+++ b/src/etc/testcases/taskdefs/fail.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/filter.xml b/src/etc/testcases/taskdefs/filter.xml
new file mode 100644
index 000000000..e05daa72e
--- /dev/null
+++ b/src/etc/testcases/taskdefs/filter.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/get.xml b/src/etc/testcases/taskdefs/get.xml
new file mode 100644
index 000000000..f10b6444b
--- /dev/null
+++ b/src/etc/testcases/taskdefs/get.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/gunzip.xml b/src/etc/testcases/taskdefs/gunzip.xml
new file mode 100644
index 000000000..cc94c6425
--- /dev/null
+++ b/src/etc/testcases/taskdefs/gunzip.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/gzip.xml b/src/etc/testcases/taskdefs/gzip.xml
new file mode 100644
index 000000000..da965e03a
--- /dev/null
+++ b/src/etc/testcases/taskdefs/gzip.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/mkdir.xml b/src/etc/testcases/taskdefs/mkdir.xml
new file mode 100644
index 000000000..6c14ab93b
--- /dev/null
+++ b/src/etc/testcases/taskdefs/mkdir.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/rename.xml b/src/etc/testcases/taskdefs/rename.xml
new file mode 100644
index 000000000..1a7067917
--- /dev/null
+++ b/src/etc/testcases/taskdefs/rename.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/replace.xml b/src/etc/testcases/taskdefs/replace.xml
new file mode 100644
index 000000000..74242898f
--- /dev/null
+++ b/src/etc/testcases/taskdefs/replace.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/tar.xml b/src/etc/testcases/taskdefs/tar.xml
new file mode 100644
index 000000000..666b702fe
--- /dev/null
+++ b/src/etc/testcases/taskdefs/tar.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/taskdef.xml b/src/etc/testcases/taskdefs/taskdef.xml
new file mode 100644
index 000000000..eafcd6d18
--- /dev/null
+++ b/src/etc/testcases/taskdefs/taskdef.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/template.xml b/src/etc/testcases/taskdefs/template.xml
new file mode 100644
index 000000000..02a0f4766
--- /dev/null
+++ b/src/etc/testcases/taskdefs/template.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/unzip.xml b/src/etc/testcases/taskdefs/unzip.xml
new file mode 100644
index 000000000..e203523df
--- /dev/null
+++ b/src/etc/testcases/taskdefs/unzip.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/etc/testcases/taskdefs/zip.xml b/src/etc/testcases/taskdefs/zip.xml
new file mode 100644
index 000000000..d3988c2a7
--- /dev/null
+++ b/src/etc/testcases/taskdefs/zip.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java b/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java
new file mode 100644
index 000000000..75e480a15
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/AntStructureTest.java
@@ -0,0 +1,73 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class AntStructureTest extends TaskdefsTest {
+
+ public AntStructureTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/antstructure.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java b/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java
new file mode 100644
index 000000000..7d9db0072
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/AntTest.java
@@ -0,0 +1,95 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class AntTest extends TaskdefsTest {
+
+ public AntTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/ant.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "recursive call");
+ }
+
+ // target must be specified
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ // Should fail since a recursion will occur...
+ public void test3() {
+ expectBuildException("test1", "recursive call");
+ }
+
+ public void test4() {
+ expectBuildException("test4", "target doesn't exist");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ }
+
+ public void test6() {
+ executeTarget("test6");
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/AvailableTest.java b/src/testcases/org/apache/tools/ant/taskdefs/AvailableTest.java
new file mode 100644
index 000000000..214917d37
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/AvailableTest.java
@@ -0,0 +1,160 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class AvailableTest extends TaskdefsTest {
+
+ public AvailableTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/available.xml");
+ }
+
+ // Nothing specified -> Fail
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ // Only property specified -> Fail
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ // Only file specified -> Fail
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
+ }
+
+ // file doesn't exist -> property 'test' == null
+ public void test4() {
+ executeTarget("test4");
+ assert(project.getProperty("test") == null);
+ }
+
+ // file does exist -> property 'test' == 'true'
+ public void test5() {
+ executeTarget("test5");
+ assertEquals(project.getProperty("test"), "true");
+ }
+
+ // resource doesn't exist -> property 'test' == null
+ public void test6() {
+ executeTarget("test6");
+ assert(project.getProperty("test") == null);
+ }
+
+ // resource does exist -> property 'test' == 'true'
+ public void test7() {
+ executeTarget("test7");
+ assertEquals(project.getProperty("test"), "true");
+ }
+
+ // class doesn't exist -> property 'test' == null
+ public void test8() {
+ executeTarget("test8");
+ assert(project.getProperty("test") == null);
+ }
+
+ // class does exist -> property 'test' == 'true'
+ public void test9() {
+ executeTarget("test9");
+ assertEquals(project.getProperty("test"), "true");
+ }
+
+ // All three specified and all three exist -> true
+ public void test10() {
+ executeTarget("test10");
+ assertEquals(project.getProperty("test"), "true");
+ }
+
+ // All three specified but class missing -> null
+ public void test11() {
+ executeTarget("test11");
+ assertEquals(project.getProperty("test"), null);
+ }
+
+ // Specified property-name is "" -> true
+ public void test12() {
+ executeTarget("test12");
+ assertEquals(project.getProperty("test"), null);
+ assertEquals(project.getProperty(""), "true");
+ }
+
+ // Specified file is "" -> current directory should always exis :-)
+ public void test13() {
+ executeTarget("test13");
+ assertEquals(project.getProperty("test"), "true");
+ }
+
+ // Specified resource is "" -> can such a thing exist?
+ /*
+ * returns non null IBM JDK 1.3 Linux
+ */
+// public void test14() {
+// executeTarget("test14");
+// assertEquals(project.getProperty("test"), null);
+// }
+
+ // Specified class is "" -> can not exist
+ public void test15() {
+ executeTarget("test15");
+ assertEquals(project.getProperty("test"), null);
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/CopydirTest.java b/src/testcases/org/apache/tools/ant/taskdefs/CopydirTest.java
new file mode 100644
index 000000000..fe323aa5a
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/CopydirTest.java
@@ -0,0 +1,99 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class CopydirTest extends TaskdefsTest {
+
+ public CopydirTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/copydir.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
+ }
+
+ public void test4() {
+ expectLog("test4", "Warning: src == dest");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ java.io.File f = new java.io.File("src/etc/testcases/taskdefs.tmp");
+ if (!f.exists() || !f.isDirectory()) {
+ fail("Copy failed");
+ }
+ // We keep this, so we have something to delete in later tests :-)
+ }
+
+ public void test6() {
+ expectBuildException("test6", "target is file");
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/CopyfileTest.java b/src/testcases/org/apache/tools/ant/taskdefs/CopyfileTest.java
new file mode 100644
index 000000000..ed9b7fa43
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/CopyfileTest.java
@@ -0,0 +1,100 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class CopyfileTest extends TaskdefsTest {
+
+ public CopyfileTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/copyfile.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
+ }
+
+ public void test4() {
+ expectLog("test4", "Warning: src == dest");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ java.io.File f = new java.io.File("src/etc/testcases/taskdefs/copyfile.tmp");
+ if (f.exists()) {
+ f.delete();
+ } else {
+ fail("Copy failed");
+ }
+ }
+/*
+ public void test6() {
+ expectBuildException("test6", "target is directory");
+ }
+*/
+}
diff --git a/src/testcases/org/apache/tools/ant/types/AllJUnitTests.java b/src/testcases/org/apache/tools/ant/taskdefs/DeleteTest.java
similarity index 76%
rename from src/testcases/org/apache/tools/ant/types/AllJUnitTests.java
rename to src/testcases/org/apache/tools/ant/taskdefs/DeleteTest.java
index 788d7ffa3..7fd04c34e 100644
--- a/src/testcases/org/apache/tools/ant/types/AllJUnitTests.java
+++ b/src/testcases/org/apache/tools/ant/taskdefs/DeleteTest.java
@@ -52,30 +52,34 @@
* .
*/
-package org.apache.tools.ant.types;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+package org.apache.tools.ant.taskdefs;
/**
- * Simple class to build a TestSuite out of the individual test classes.
- *
- * @author Stefan Bodewig stefan.bodewig@megabit.net
+ * @author Nico Seessle
*/
-public class AllJUnitTests extends TestCase {
-
- public AllJUnitTests(String name) {
+public class DeleteTest extends TaskdefsTest {
+
+ public DeleteTest(String name) {
super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/delete.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
}
- public static Test suite() {
- TestSuite suite = new TestSuite(CommandlineTest.class);
- suite.addTest(new TestSuite(CommandlineJavaTest.class));
- suite.addTest(new TestSuite(EnumeratedAttributeTest.class));
- suite.addTest(new TestSuite(PathTest.class));
- suite.addTest(new TestSuite(PatternSetTest.class));
- suite.addTest(new TestSuite(FileSetTest.class));
- return suite;
- }
+ public void test2() {
+ executeTarget("test2");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "Not a directory");
+ }
+
+ public void test4() {
+ executeTarget("test4");
+ }
}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/DeltreeTest.java b/src/testcases/org/apache/tools/ant/taskdefs/DeltreeTest.java
new file mode 100644
index 000000000..b50de2181
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/DeltreeTest.java
@@ -0,0 +1,79 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class DeltreeTest extends TaskdefsTest {
+
+ public DeltreeTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/deltree.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ // We try to delete the directory created in CopydirTest
+ executeTarget("test2");
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/EchoTest.java b/src/testcases/org/apache/tools/ant/taskdefs/EchoTest.java
new file mode 100644
index 000000000..e64777ef6
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/EchoTest.java
@@ -0,0 +1,87 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class EchoTest extends TaskdefsTest {
+
+ public EchoTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/echo.xml");
+ }
+
+ // Output an empty String
+ public void test1() {
+ expectOutput("test1", "\n");
+ }
+
+ // Output 'OUTPUT OF ECHO'
+ public void test2() {
+ expectOutput("test2", "OUTPUT OF ECHO\n");
+ }
+
+ public void test3() {
+ expectOutput("test3", "This \n"+
+ " is\n"+
+ " a \n"+
+ " multiline\n"+
+ " message\n");
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/FailTest.java b/src/testcases/org/apache/tools/ant/taskdefs/FailTest.java
new file mode 100644
index 000000000..8c616a914
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/FailTest.java
@@ -0,0 +1,77 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class FailTest extends TaskdefsTest {
+
+ public FailTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/fail.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "it is required to fail :-)");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "it is required to fail :-)");
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/FilterTest.java b/src/testcases/org/apache/tools/ant/taskdefs/FilterTest.java
new file mode 100644
index 000000000..037f19f34
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/FilterTest.java
@@ -0,0 +1,86 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class FilterTest extends TaskdefsTest {
+
+ public FilterTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/filter.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument missing");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument missing");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument missing");
+ }
+
+ public void test4() {
+ executeTarget("test4");
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java b/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java
new file mode 100644
index 000000000..9c52f882a
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/GUnzipTest.java
@@ -0,0 +1,90 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class GUnzipTest extends TaskdefsTest {
+
+ public GUnzipTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/gunzip.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument missing");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "attribute src invalid");
+ }
+
+ public void test3() {
+ executeTarget("test3");
+ java.io.File f = new java.io.File("src/etc/testcases/taskdefs/gzip.tmp2");
+ if (!f.exists()) {
+ fail("gzip failed");
+ } else {
+ f.delete();
+ f = new java.io.File("src/etc/testcases/taskdefs/gzip.tmp");
+ if (f.exists()) f.delete();
+ }
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/GetTest.java b/src/testcases/org/apache/tools/ant/taskdefs/GetTest.java
new file mode 100644
index 000000000..cf85857ea
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/GetTest.java
@@ -0,0 +1,101 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class GetTest extends TaskdefsTest {
+
+ public GetTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/get.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument missing");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument missing");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument missing");
+ }
+
+ public void test4() {
+ expectBuildException("test4", "src invalid");
+ }
+
+ public void test5() {
+ expectBuildException("test5", "dest invalid (or no http-server on local machine)");
+ }
+
+ public void test6() {
+ executeTarget("test6");
+ java.io.File f = new java.io.File("src/etc/testcases/taskdefs/get.tmp");
+ if (!f.exists()) {
+ fail("get failed");
+ } else {
+ f.delete();
+ }
+
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/GzipTest.java b/src/testcases/org/apache/tools/ant/taskdefs/GzipTest.java
new file mode 100644
index 000000000..97bce1fbe
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/GzipTest.java
@@ -0,0 +1,95 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class GzipTest extends TaskdefsTest {
+
+ public GzipTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/gzip.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument missing");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument missing");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument missing");
+ }
+
+ public void test4() {
+ expectBuildException("test4", "attribute zipfile invalid");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ java.io.File f = new java.io.File("src/etc/testcases/taskdefs/gzip.tmp");
+ if (!f.exists()) {
+ fail("gzip failed");
+ }
+ // Keep for unzip
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/MkdirTest.java b/src/testcases/org/apache/tools/ant/taskdefs/MkdirTest.java
new file mode 100644
index 000000000..41b9783ac
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/MkdirTest.java
@@ -0,0 +1,90 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class MkdirTest extends TaskdefsTest {
+
+ public MkdirTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/mkdir.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument missing");
+ }
+
+ public void test2() {
+ executeTarget("test2");
+ String log = getLog();
+ assert(log.indexOf("Warning: Specified directory is a file: ") > -1);
+ }
+
+ public void test3() {
+ executeTarget("test3");
+ java.io.File f = new java.io.File("src/etc/testcases/taskdefs/testdir.tmp");
+ if (!f.exists() || !f.isDirectory()) {
+ fail("mkdir failed");
+ } else {
+ f.delete();
+ }
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/RenameTest.java b/src/testcases/org/apache/tools/ant/taskdefs/RenameTest.java
new file mode 100644
index 000000000..adea12a04
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/RenameTest.java
@@ -0,0 +1,91 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class RenameTest extends TaskdefsTest {
+
+ public RenameTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/rename.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument missing");
+ }
+ public void test2() {
+ expectBuildException("test2", "required argument missing");
+ }
+ public void test3() {
+ expectBuildException("test3", "required argument missing");
+ }
+/*
+ public void test4() {
+ expectBuildException("test4", "source and destination the same");
+ }
+ public void test5() {
+ executeTarget("test5");
+ }
+ */
+ public void test6() {
+ executeTarget("test6");
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/ReplaceTest.java b/src/testcases/org/apache/tools/ant/taskdefs/ReplaceTest.java
new file mode 100644
index 000000000..a8e1e13b6
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/ReplaceTest.java
@@ -0,0 +1,90 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class ReplaceTest extends TaskdefsTest {
+
+ public ReplaceTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/replace.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
+ }
+
+ public void test4() {
+ expectBuildException("test4", "empty token not allowed");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java b/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java
new file mode 100644
index 000000000..a3d7a3e93
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java
@@ -0,0 +1,82 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class TarTest extends TaskdefsTest {
+
+ public TarTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/tar.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
+ }
+
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/TaskdefTest.java b/src/testcases/org/apache/tools/ant/taskdefs/TaskdefTest.java
new file mode 100644
index 000000000..7ba24e131
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/TaskdefTest.java
@@ -0,0 +1,89 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class TaskdefTest extends TaskdefsTest {
+
+ public TaskdefTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/taskdef.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
+ }
+
+ public void test4() {
+ expectBuildException("test4", "classname specified doesn't exist");
+ }
+
+ public void test5() {
+ executeTarget("test5");
+ }
+}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java b/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java
new file mode 100644
index 000000000..33668f2f0
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java
@@ -0,0 +1,224 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+import junit.framework.*;
+import org.apache.tools.ant.*;
+import java.io.*;
+
+/**
+ * @author Nico Seessle
+ */
+public abstract class TaskdefsTest extends TestCase {
+
+ protected Project project;
+
+ private StringBuffer logBuffer;
+ private StringBuffer outBuffer;
+ private BuildException buildException;
+
+ public TaskdefsTest(String name) {
+ super(name);
+ }
+
+ protected String getLog() {
+ return logBuffer.toString();
+ }
+
+ protected void expectBuildException(String taskname, String cause) {
+ try {
+ executeTarget(taskname);
+ } catch (org.apache.tools.ant.BuildException ex) {
+ return;
+ }
+ fail("Should throw BuildException because: " + cause);
+ }
+
+ protected void expectOutput(String taskname, String output) {
+ executeTarget(taskname);
+ String realOutput = getOutput();
+ assertEquals(output, realOutput);
+ }
+
+ protected void expectLog(String taskname, String log) {
+ executeTarget(taskname);
+ String realLog = getLog();
+ assertEquals(log, realLog);
+ }
+
+ protected String getOutput() {
+ StringBuffer cleanOut = new StringBuffer();
+ boolean cr = false;
+ for (int i = 0; i < outBuffer.length(); i++) {
+ char ch = outBuffer.charAt(i);
+ if (ch == '\r') {
+ cr = true;
+ continue;
+ }
+
+ if (!cr) {
+ cleanOut.append(ch);
+ } else {
+ if (ch == '\n') {
+ cleanOut.append(ch);
+ } else {
+ cleanOut.append('\r').append(ch);
+ }
+ }
+ }
+ return cleanOut.toString();
+ }
+
+ protected void configureProject(String filename) {
+ project = new Project();
+ project.init();
+ project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() );
+ project.addBuildListener(new AntTestListener());
+ ProjectHelper.configureProject(project, new File(filename));
+ }
+
+ protected void executeTarget(String targetName) {
+ PrintStream sysOut = System.out;
+ try {
+ outBuffer = new StringBuffer();
+ sysOut.flush();
+ PrintStream out = new PrintStream(new AntOutputStream());
+ System.setOut(out);
+ logBuffer = new StringBuffer();
+ buildException = null;
+ project.executeTarget(targetName);
+ } finally {
+ System.setOut(sysOut);
+ }
+
+ }
+
+ private class AntOutputStream extends java.io.OutputStream {
+ public void write(int b) {
+ outBuffer.append((char)b);
+ }
+ }
+
+ private class AntTestListener implements BuildListener {
+ /**
+ * Fired before any targets are started.
+ */
+ public void buildStarted(BuildEvent event) {
+ }
+
+ /**
+ * Fired after the last target has finished. This event
+ * will still be thrown if an error occured during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void buildFinished(BuildEvent event) {
+ }
+
+ /**
+ * Fired when a target is started.
+ *
+ * @see BuildEvent#getTarget()
+ */
+ public void targetStarted(BuildEvent event) {
+ //System.out.println("targetStarted " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a target has finished. This event will
+ * still be thrown if an error occured during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void targetFinished(BuildEvent event) {
+ //System.out.println("targetFinished " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a task is started.
+ *
+ * @see BuildEvent#getTask()
+ */
+ public void taskStarted(BuildEvent event) {
+ //System.out.println("taskStarted " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired when a task has finished. This event will still
+ * be throw if an error occured during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void taskFinished(BuildEvent event) {
+ //System.out.println("taskFinished " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired whenever a message is logged.
+ *
+ * @see BuildEvent#getMessage()
+ * @see BuildEvent#getPriority()
+ */
+ public void messageLogged(BuildEvent event) {
+ if (event.getPriority() == Project.MSG_INFO ||
+ event.getPriority() == Project.MSG_ERR)
+ {
+ logBuffer.append(event.getMessage());
+ }
+ }
+ }
+
+
+}
diff --git a/src/testcases/org/apache/tools/ant/AllJUnitTests.java b/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java
similarity index 79%
rename from src/testcases/org/apache/tools/ant/AllJUnitTests.java
rename to src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java
index 87f569a03..66ced43f3 100644
--- a/src/testcases/org/apache/tools/ant/AllJUnitTests.java
+++ b/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java
@@ -52,27 +52,31 @@
* .
*/
-package org.apache.tools.ant;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+package org.apache.tools.ant.taskdefs;
/**
- * Simple class to build a TestSuite out of the individual test classes.
- *
- * @author Stefan Bodewig stefan.bodewig@megabit.net
+ * @author Nico Seessle
*/
-public class AllJUnitTests extends TestCase {
-
- public AllJUnitTests(String name) {
+public class UnzipTest extends TaskdefsTest {
+
+ public UnzipTest(String name) {
super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/unzip.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+
+ public void test3() {
+ expectBuildException("test3", "required argument not specified");
}
- public static Test suite() {
- TestSuite suite = new TestSuite(IntrospectionHelperTest.class);
- suite.addTest(new TestSuite(org.apache.tools.ant.ProjectTest.class));
- suite.addTest(org.apache.tools.ant.types.AllJUnitTests.suite());
- return suite;
- }
}
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java b/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java
new file mode 100644
index 000000000..51da27f47
--- /dev/null
+++ b/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java
@@ -0,0 +1,77 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * .
+ */
+
+package org.apache.tools.ant.taskdefs;
+
+/**
+ * @author Nico Seessle
+ */
+public class ZipTest extends TaskdefsTest {
+
+ public ZipTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ configureProject("src/etc/testcases/taskdefs/zip.xml");
+ }
+
+ public void test1() {
+ expectBuildException("test1", "required argument not specified");
+ }
+
+ public void test2() {
+ expectBuildException("test2", "required argument not specified");
+ }
+}