diff --git a/WHATSNEW b/WHATSNEW index 21953a30d..1ce483b1e 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -147,6 +147,11 @@ Other changes: * has now a threads attribute allowing to run the tests in several threads. Bugzilla Report 55925 +* addition of a new ProcessUtil class providing the process id of the current process + +* changes to allow to run the JUnit testcases of Ant in parallel, + by making them use unique temporary directories + Changes from Ant 1.9.2 TO Ant 1.9.3 =================================== diff --git a/src/etc/testcases/buildfiletest-base.xml b/src/etc/testcases/buildfiletest-base.xml new file mode 100644 index 000000000..3c3268195 --- /dev/null +++ b/src/etc/testcases/buildfiletest-base.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/etc/testcases/core/antclassloader.xml b/src/etc/testcases/core/antclassloader.xml index b6f278edd..5e138dae8 100644 --- a/src/etc/testcases/core/antclassloader.xml +++ b/src/etc/testcases/core/antclassloader.xml @@ -16,10 +16,10 @@ limitations under the License. --> - - + + - + @@ -27,7 +27,7 @@ - + @@ -49,12 +49,8 @@ - - - - - + + - - - - - - + + + + - - - + + + - - - - - - - - - + + + + + diff --git a/src/etc/testcases/core/loaderref/loaderref.xml b/src/etc/testcases/core/loaderref/loaderref.xml index b06efe802..b1f58c615 100644 --- a/src/etc/testcases/core/loaderref/loaderref.xml +++ b/src/etc/testcases/core/loaderref/loaderref.xml @@ -19,7 +19,13 @@ - + + + + + + + @@ -27,20 +33,15 @@ This build file is intended to be used for testing Ant - - - - - - + + classpath="${output}"/> diff --git a/src/etc/testcases/core/taskcontainer.xml b/src/etc/testcases/core/taskcontainer.xml index 3dca12eb5..4a2137301 100644 --- a/src/etc/testcases/core/taskcontainer.xml +++ b/src/etc/testcases/core/taskcontainer.xml @@ -17,7 +17,7 @@ --> - + This build file is supposed to be run by a Unit test @@ -33,11 +33,11 @@ - - + + - + @@ -58,8 +58,5 @@ - - - diff --git a/src/etc/testcases/filters/build.xml b/src/etc/testcases/filters/build.xml index 9ae69fc27..cc3798ac1 100644 --- a/src/etc/testcases/filters/build.xml +++ b/src/etc/testcases/filters/build.xml @@ -15,18 +15,15 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - + + + + - - - - - + + @@ -36,14 +33,11 @@ - - + + tofile="${output}/negatelinecontains.test"> @@ -54,15 +48,15 @@ - - - + + @@ -70,13 +64,13 @@ - + - - + + @@ -84,8 +78,8 @@ - - + + @@ -95,24 +89,24 @@ - - + + - + - + - - This has no new lines - + + This has no new lines + - + File was modified diff --git a/src/etc/testcases/filters/concat.xml b/src/etc/testcases/filters/concat.xml index 7de106437..262dd1608 100644 --- a/src/etc/testcases/filters/concat.xml +++ b/src/etc/testcases/filters/concat.xml @@ -17,103 +17,99 @@ --> - - - - - - + + + + + + + + - + - - - - - - - - + + - - + + - + - - + + - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/etc/testcases/filters/dynamicfilter.xml b/src/etc/testcases/filters/dynamicfilter.xml index ed91e1d90..cb52d2158 100644 --- a/src/etc/testcases/filters/dynamicfilter.xml +++ b/src/etc/testcases/filters/dynamicfilter.xml @@ -15,14 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. --> - + - - - + - - + + @@ -36,11 +34,11 @@ - + hello world - + diff --git a/src/etc/testcases/filters/head-tail.xml b/src/etc/testcases/filters/head-tail.xml index ab709ee37..e0ffed741 100644 --- a/src/etc/testcases/filters/head-tail.xml +++ b/src/etc/testcases/filters/head-tail.xml @@ -15,53 +15,52 @@ See the License for the specific language governing permissions and limitations under the License. --> - + - - - + - - + + + - - + + - - + + - - + + - - + + - + + tofile="${output}/head-tail.filterReaderHeadLinesSkip.test"> @@ -71,8 +70,8 @@ - - + + @@ -81,41 +80,41 @@ - - + + - - + + - - + + - - + + - + + tofile="${output}/head-tail.filterReaderTailLinesSkip.test"> @@ -125,8 +124,8 @@ - - + + @@ -135,8 +134,8 @@ - - + + diff --git a/src/etc/testcases/filters/tokenfilter.xml b/src/etc/testcases/filters/tokenfilter.xml index a23bc82e9..7648635be 100644 --- a/src/etc/testcases/filters/tokenfilter.xml +++ b/src/etc/testcases/filters/tokenfilter.xml @@ -15,18 +15,16 @@ See the License for the specific language governing permissions and limitations under the License. --> - + - - - + - - + + - + @@ -34,12 +32,12 @@ - + Hello World - + @@ -48,12 +46,12 @@ - + - + This is the contents of the trimmed file. This is the second line. @@ -63,7 +61,7 @@ - + This is the contents of the trimmed file. This is the second line. @@ -74,7 +72,7 @@ - + This is foo bar @@ -93,11 +91,11 @@ - + This is a number of words - + @@ -105,12 +103,12 @@ - + - + This is a number of words @@ -122,7 +120,7 @@ - + This is a number of words @@ -134,11 +132,11 @@ - + This is a number of words - + @@ -149,7 +147,7 @@ - + this is the sun @@ -171,11 +169,11 @@ - + this is a line contains foo this line does not - + @@ -186,14 +184,14 @@ - + hello Hello HELLO hello cat Cat cat Sun Sun Sun WhiteSpace tab This is a line with digits - 1234 -- there - + @@ -209,7 +207,7 @@ - + hello Hello HELLO hello @@ -228,12 +226,12 @@ - + hello world this is the moon World here - + @@ -243,7 +241,7 @@ - + hello world this is the moon World here @@ -258,11 +256,11 @@ - + SUITE(TestSuite, bits); here - + - + This is some ### s some **** @@ -287,10 +285,10 @@ - + hello world - + @@ -302,10 +300,10 @@ - + hello moon - + self.setToken(self.getToken().toUpperCase()); @@ -327,11 +325,11 @@ - + hello world - + @@ -348,10 +346,10 @@ - + hello world - diff --git a/src/etc/testcases/taskdefs/abstractcvstask.xml b/src/etc/testcases/taskdefs/abstractcvstask.xml index f65bf6e5b..5de8b5e77 100644 --- a/src/etc/testcases/taskdefs/abstractcvstask.xml +++ b/src/etc/testcases/taskdefs/abstractcvstask.xml @@ -17,50 +17,31 @@ --> + default="tearDown"> - - - - - - - - - - - - - - - - - - + + + + - - - - - + - - - diff --git a/src/etc/testcases/taskdefs/javadoc/javadoc.xml b/src/etc/testcases/taskdefs/javadoc/javadoc.xml index 12e339658..2a05ec0fe 100644 --- a/src/etc/testcases/taskdefs/javadoc/javadoc.xml +++ b/src/etc/testcases/taskdefs/javadoc/javadoc.xml @@ -17,25 +17,27 @@ * --> + + + + + + - - - - - + - + - + @@ -48,29 +50,29 @@ - + - + - + - + - + @@ -78,7 +80,7 @@ - + @@ -94,11 +96,11 @@ + destdir="${output}" /> - + @@ -112,7 +114,7 @@ + packagenames="etc.testcases.taskdefs.javadoc.*" destdir="${output}" /> @@ -122,11 +124,11 @@ + packagenames="*" destdir="${output}" /> - + @@ -136,19 +138,17 @@ - + - - - public class stuff1 {} - public class stuff2 {} - x=4 - - + public class stuff1 {} + public class stuff2 {} + x=4 + + diff --git a/src/etc/testcases/taskdefs/multimap.xml b/src/etc/testcases/taskdefs/multimap.xml index e23620638..ce4b12185 100644 --- a/src/etc/testcases/taskdefs/multimap.xml +++ b/src/etc/testcases/taskdefs/multimap.xml @@ -16,6 +16,9 @@ limitations under the License. --> + + + @@ -26,11 +29,11 @@ classpathref="testclasses"/> - + - + @@ -39,7 +42,7 @@ - + @@ -53,7 +56,7 @@ multicopy failed - + @@ -78,7 +81,7 @@ task to ignore multiple mappings --> - + @@ -95,7 +98,7 @@ singlecopy failed - + @@ -185,8 +188,5 @@ movewithempty failed - - - diff --git a/src/etc/testcases/taskdefs/optional/javah/build.xml b/src/etc/testcases/taskdefs/optional/javah/build.xml index 9a14b3925..ea70b9e57 100644 --- a/src/etc/testcases/taskdefs/optional/javah/build.xml +++ b/src/etc/testcases/taskdefs/optional/javah/build.xml @@ -18,41 +18,38 @@ --> - - - - - For tests only - + - + - - + + + + For tests only - + - + - + - - + + - + diff --git a/src/etc/testcases/taskdefs/optional/native2ascii/build.xml b/src/etc/testcases/taskdefs/optional/native2ascii/build.xml index ec0165a98..27b40313d 100644 --- a/src/etc/testcases/taskdefs/optional/native2ascii/build.xml +++ b/src/etc/testcases/taskdefs/optional/native2ascii/build.xml @@ -18,23 +18,20 @@ --> - - - - - For tests only - + - + - - + + + + For tests only - diff --git a/src/etc/testcases/taskdefs/tar.xml b/src/etc/testcases/taskdefs/tar.xml index dc92a75c5..2eda0b544 100644 --- a/src/etc/testcases/taskdefs/tar.xml +++ b/src/etc/testcases/taskdefs/tar.xml @@ -18,6 +18,13 @@ + + + + + + + @@ -31,172 +38,163 @@ - - + + - - + - + - - - + + + + + + - + - + - - - + + + + + + - + - + - - - + + + + + + - + - + - + - + - + - + - - - + + + - + - - - + + + - + - + - - + + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - + + - - - - - + + - + diff --git a/src/etc/testcases/taskdefs/untar.xml b/src/etc/testcases/taskdefs/untar.xml index d546f34dc..e1490d847 100644 --- a/src/etc/testcases/taskdefs/untar.xml +++ b/src/etc/testcases/taskdefs/untar.xml @@ -16,82 +16,79 @@ limitations under the License. --> - + - - - - - + + + + + - - + - - + - - + - + - + - + - + - + - - + + - - + + - - - - - + + + + + - + - - + + diff --git a/src/etc/testcases/taskdefs/unzip.xml b/src/etc/testcases/taskdefs/unzip.xml index 414afcef6..ee96ee1f0 100644 --- a/src/etc/testcases/taskdefs/unzip.xml +++ b/src/etc/testcases/taskdefs/unzip.xml @@ -18,13 +18,13 @@ - - - - - + + + + + @@ -39,30 +39,28 @@ - - + - - + - + - - - - - + + + + + - + @@ -70,7 +68,7 @@ - + @@ -78,7 +76,7 @@ - + @@ -87,7 +85,7 @@ - + @@ -98,7 +96,7 @@ - + @@ -110,13 +108,13 @@ - - + + - + @@ -125,16 +123,16 @@ - - - - - + + + + + - + @@ -144,7 +142,7 @@ - + @@ -153,7 +151,7 @@ - + @@ -163,7 +161,7 @@ - + @@ -175,8 +173,8 @@ - - + + diff --git a/src/etc/testcases/taskdefs/zip.xml b/src/etc/testcases/taskdefs/zip.xml index ada643b3e..ee51fd5d6 100644 --- a/src/etc/testcases/taskdefs/zip.xml +++ b/src/etc/testcases/taskdefs/zip.xml @@ -18,26 +18,32 @@ + + + + + + - + - - + + @@ -49,44 +55,47 @@ - + - + + + + - + - + - - - + - + @@ -96,13 +105,13 @@ - + - @@ -110,16 +119,17 @@ - - + + - + @@ -128,23 +138,23 @@ - - - - + + - + @@ -152,20 +162,20 @@ - + - + - + - + @@ -176,25 +186,25 @@ - + - + - + - + - + @@ -202,15 +212,20 @@ - - + + + + + + + - + @@ -220,68 +235,53 @@ - - - - - + + + + - + - + - - + + - + - + - - - - - + + + + + - - - - - - - - - - - - - - - - + diff --git a/src/etc/testcases/types/assertions.xml b/src/etc/testcases/types/assertions.xml index a28721358..2af2311c6 100644 --- a/src/etc/testcases/types/assertions.xml +++ b/src/etc/testcases/types/assertions.xml @@ -16,33 +16,31 @@ limitations under the License. --> - + + + + + + + + - - - + + - - - - - - - - - + @@ -53,7 +51,7 @@ - + @@ -64,7 +62,7 @@ - + @@ -73,7 +71,7 @@ - + @@ -87,7 +85,7 @@ - + @@ -102,7 +100,7 @@ - + @@ -129,7 +127,7 @@ - + @@ -140,7 +138,7 @@ - + @@ -152,7 +150,7 @@ - + @@ -168,7 +166,7 @@ - + @@ -186,7 +184,7 @@ - + diff --git a/src/etc/testcases/types/resources/tarentry.xml b/src/etc/testcases/types/resources/tarentry.xml index 09902ff48..c0fa379c2 100644 --- a/src/etc/testcases/types/resources/tarentry.xml +++ b/src/etc/testcases/types/resources/tarentry.xml @@ -16,18 +16,19 @@ limitations under the License. --> - - only use from within unit tests - + - - + + + + + only use from within unit tests - + @@ -36,8 +37,4 @@ - - - - \ No newline at end of file diff --git a/src/main/org/apache/tools/ant/util/ProcessUtil.java b/src/main/org/apache/tools/ant/util/ProcessUtil.java new file mode 100644 index 000000000..71ab7e477 --- /dev/null +++ b/src/main/org/apache/tools/ant/util/ProcessUtil.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.util; + +import java.lang.management.ManagementFactory; + +/** + * Process Utilities + */ +public class ProcessUtil { + /** + * provide id of the current process + * @param fallback + * @return current process id + */ + public static String getProcessId(final String fallback) { + // Note: may fail in some JVM implementations + // therefore fallback has to be provided + + // something like '@', at least in SUN / Oracle JVMs + final String jvmName = ManagementFactory.getRuntimeMXBean().getName(); + final int index = jvmName.indexOf('@'); + + if (index < 1) { + // part before '@' empty (index = 0) / '@' not found (index = -1) + return fallback; + } + + try { + return Long.toString(Long.parseLong(jvmName.substring(0, index))); + } catch (NumberFormatException e) { + // ignore + } + return fallback; + } + public static void main(String [] args) { + System.out.println(getProcessId("")); + try { + Thread.sleep(120000); + } catch (Exception exc) {} + } +} diff --git a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java index 963fa7b19..7877db3d2 100644 --- a/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java +++ b/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java @@ -30,7 +30,6 @@ import org.apache.tools.ant.util.FileUtils; */ public class AntClassLoaderTest extends BuildFileTest { - private Project p; private AntClassLoader loader; public AntClassLoaderTest(String name) { @@ -38,17 +37,19 @@ public class AntClassLoaderTest extends BuildFileTest { } public void setUp() { - p = new Project(); - p.init(); - configureProject("src/etc/testcases/core/antclassloader.xml"); - getProject().executeTarget("setup"); + super.configureProject("src/etc/testcases/core/antclassloader.xml"); + getProject().executeTarget("setUp"); } public void tearDown() { if (loader != null) { loader.cleanup(); } - getProject().executeTarget("cleanup"); + try { + super.tearDown(); + } catch ( Exception e) { + System.err.println(e.getMessage()); + } } //test inspired by bug report 37085 public void testJarWithManifestInDirWithSpace() { @@ -72,8 +73,8 @@ public class AntClassLoaderTest extends BuildFileTest { assertEquals(mainjarstring + File.pathSeparator + extjarstring, path); } public void testCleanup() throws BuildException { - Path path = new Path(p, "."); - loader = p.createClassLoader(path); + Path path = new Path(project, "."); + loader = project.createClassLoader(path); try { // we don't expect to find this loader.findClass("fubar"); @@ -94,7 +95,7 @@ public class AntClassLoaderTest extends BuildFileTest { } // tell the build it is finished - p.fireBuildFinished(null); + project.fireBuildFinished(null); try { // we don't expect to find this loader.findClass("fubar"); @@ -149,7 +150,9 @@ public class AntClassLoaderTest extends BuildFileTest { } /** - * @see https://issues.apache.org/bugzilla/show_bug.cgi?id=47593 + * @see + * bug 47593, request to log the name of corrupt zip files from which + * classes cannot be loaded */ public void testInvalidZipException() throws Exception { executeTarget("createNonJar"); diff --git a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java index cca3c4ee1..1a6e7bcdb 100644 --- a/src/tests/junit/org/apache/tools/ant/BuildFileTest.java +++ b/src/tests/junit/org/apache/tools/ant/BuildFileTest.java @@ -23,6 +23,7 @@ import java.io.PrintStream; import java.net.URL; import junit.framework.TestCase; +import org.apache.tools.ant.util.ProcessUtil; /** * A BuildFileTest is a TestCase which executes targets from an Ant buildfile @@ -296,6 +297,9 @@ public abstract class BuildFileTest extends TestCase { project.init(); File antFile = new File(System.getProperty("root"), filename); project.setUserProperty("ant.file" , antFile.getAbsolutePath()); + // set two new properties to allow to build unique names when running multithreaded tests + project.setProperty("ant.processid", ProcessUtil.getProcessId("")); + project.setProperty("ant.threadname", Thread.currentThread().getName()); project.addBuildListener(new AntTestListener(logLevel)); ProjectHelper.configureProject(project, antFile); } diff --git a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java index 8b46e27fc..7aebfa0a2 100644 --- a/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java +++ b/src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java @@ -43,16 +43,13 @@ public class DirectoryScannerTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/core/directoryscanner.xml"); - getProject().executeTarget("setup"); + getProject().executeTarget("setUp"); } - public void tearDown() { - getProject().executeTarget("cleanup"); - } public void test1() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha"}); ds.scan(); compareFiles(ds, new String[] {} ,new String[] {"alpha"}); @@ -60,7 +57,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void test2() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/"}); ds.scan(); compareFiles(ds, new String[] {"alpha/beta/beta.xml", @@ -70,7 +67,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void test3() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.scan(); compareFiles(ds, new String[] {"alpha/beta/beta.xml", "alpha/beta/gamma/gamma.xml"}, @@ -80,7 +77,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testFullPathMatchesCaseSensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); ds.scan(); compareFiles(ds, new String[] {}, new String[] {}); @@ -89,7 +86,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testFullPathMatchesCaseInsensitive() { DirectoryScanner ds = new DirectoryScanner(); ds.setCaseSensitive(false); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); ds.scan(); compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, @@ -98,7 +95,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void test2ButCaseInsensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"ALPHA/"}); ds.setCaseSensitive(false); ds.scan(); @@ -114,7 +111,7 @@ public class DirectoryScannerTest extends BuildFileTest { getProject().executeTarget("symlink-setup"); DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/beta/gamma/"}); ds.scan(); compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, @@ -128,7 +125,7 @@ public class DirectoryScannerTest extends BuildFileTest { getProject().executeTarget("symlink-setup"); DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/beta/gamma/"}); ds.setFollowSymlinks(false); ds.scan(); @@ -141,13 +138,13 @@ public class DirectoryScannerTest extends BuildFileTest { "alpha/beta/gamma/gamma.xml"}; String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" }; DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/be?a/**", "alpha/beta/gamma/"}); ds.scan(); compareFiles(ds, expectedFiles, expectedDirectories); // redo the test, but the 2 include patterns are inverted ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/beta/gamma/", "alpha/be?a/**"}); ds.scan(); compareFiles(ds, expectedFiles, expectedDirectories); @@ -155,7 +152,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testPatternsDifferInCaseScanningSensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); ds.scan(); compareFiles(ds, new String[] {"alpha/beta/beta.xml", @@ -165,7 +162,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testPatternsDifferInCaseScanningInsensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); ds.setCaseSensitive(false); ds.scan(); @@ -176,7 +173,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testFullpathDiffersInCaseScanningSensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] { "alpha/beta/gamma/gamma.xml", "alpha/beta/gamma/GAMMA.XML" @@ -188,7 +185,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testFullpathDiffersInCaseScanningInsensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] { "alpha/beta/gamma/gamma.xml", "alpha/beta/gamma/GAMMA.XML" @@ -201,7 +198,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testParentDiffersInCaseScanningSensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); ds.scan(); compareFiles(ds, new String[] {"alpha/beta/beta.xml", @@ -211,7 +208,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testParentDiffersInCaseScanningInsensitive() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); ds.setCaseSensitive(false); ds.scan(); @@ -318,7 +315,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testExcludeOneFile() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] { "**/*.xml" }); @@ -332,7 +329,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testExcludeHasPrecedence() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] { "alpha/**" }); @@ -347,7 +344,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testAlternateIncludeExclude() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setIncludes(new String[] { "alpha/**", "alpha/beta/gamma/**" @@ -363,7 +360,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testAlternateExcludeInclude() { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setExcludes(new String[] { "alpha/**", "alpha/beta/gamma/**" @@ -383,7 +380,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testChildrenOfExcludedDirectory() { getProject().executeTarget("children-of-excluded-dir-setup"); DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setExcludes(new String[] {"alpha/**"}); ds.setFollowSymlinks(false); ds.scan(); @@ -391,7 +388,7 @@ public class DirectoryScannerTest extends BuildFileTest { new String[] {"", "delta"}); ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setExcludes(new String[] {"alpha"}); ds.setFollowSymlinks(false); ds.scan(); @@ -417,7 +414,7 @@ public class DirectoryScannerTest extends BuildFileTest { } getProject().executeTarget("children-of-excluded-dir-setup"); DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setExcludes(new String[] {"**/gamma/**"}); ds.setFollowSymlinks(false); ds.scan(); @@ -430,8 +427,8 @@ public class DirectoryScannerTest extends BuildFileTest { public void testAbsolute1() { getProject().executeTarget("extended-setup"); DirectoryScanner ds = new DirectoryScanner(); - String tmpdir = getProject().getBaseDir().getAbsolutePath().replace( - File.separatorChar, '/') + "/tmp"; + String tmpdir = getProject().getProperty("output").replace( + File.separatorChar, '/'); ds.setIncludes(new String[] {tmpdir + "/**/*"}); ds.scan(); compareFiles(ds, new String[] {tmpdir + "/alpha/beta/beta.xml", @@ -444,7 +441,6 @@ public class DirectoryScannerTest extends BuildFileTest { } public void testAbsolute2() { - getProject().executeTarget("setup"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); ds.scan(); @@ -455,8 +451,8 @@ public class DirectoryScannerTest extends BuildFileTest { public void testAbsolute3() { getProject().executeTarget("extended-setup"); DirectoryScanner ds = new DirectoryScanner(); - String tmpdir = getProject().getBaseDir().getAbsolutePath().replace( - File.separatorChar, '/') + "/tmp"; + String tmpdir = getProject().getProperty("output").replace( + File.separatorChar, '/'); ds.setIncludes(new String[] {tmpdir + "/**/*"}); ds.setExcludes(new String[] {"**/alpha", "**/delta/*"}); @@ -471,8 +467,8 @@ public class DirectoryScannerTest extends BuildFileTest { public void testAbsolute4() { getProject().executeTarget("extended-setup"); DirectoryScanner ds = new DirectoryScanner(); - String tmpdir = getProject().getBaseDir().getAbsolutePath().replace( - File.separatorChar, '/') + "/tmp"; + String tmpdir = getProject().getProperty("output").replace( + File.separatorChar, '/') ; ds.setIncludes(new String[] {tmpdir + "/alpha/beta/**/*", tmpdir + "/delta/*"}); ds.setExcludes(new String[] {"**/beta.xml"}); @@ -535,7 +531,7 @@ public class DirectoryScannerTest extends BuildFileTest { public void testRecursiveExcludes() throws Exception { DirectoryScanner ds = new DirectoryScanner(); - ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); + ds.setBasedir(new File(getProject().getProperty("output"))); ds.setExcludes(new String[] {"**/beta/**"}); ds.scan(); List dirs = Arrays.asList(ds.getExcludedDirectories()); diff --git a/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java b/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java index 946c59cdf..50cd3eaaa 100644 --- a/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java +++ b/src/tests/junit/org/apache/tools/ant/LoaderRefTest.java @@ -30,10 +30,7 @@ public class LoaderRefTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/core/loaderref/loaderref.xml"); - } - - public void tearDown() { - executeTarget("clean"); + executeTarget("setUp"); } // override allowed on diff --git a/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java b/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java index e582f1388..beff4c267 100644 --- a/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java +++ b/src/tests/junit/org/apache/tools/ant/TaskContainerTest.java @@ -28,10 +28,6 @@ public class TaskContainerTest extends BuildFileTest { configureProject("src/etc/testcases/core/taskcontainer.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testPropertyExpansion() { executeTarget("testPropertyExpansion"); assertTrue("attribute worked", diff --git a/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java index 46060bb73..8a0de7b73 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/ConcatFilterTest.java @@ -74,14 +74,11 @@ public class ConcatFilterTest extends BuildFileTest { configureProject("src/etc/testcases/filters/concat.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } public void testFilterReaderNoArgs() throws IOException { executeTarget("testFilterReaderNoArgs"); - File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"input/concatfilter.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/concat.FilterReaderNoArgs.test"); + File expected = new File(getProject().getProperty("output"), "concatfilter.test"); + File result = new File(getProject().getProperty("output"), "concat.FilterReaderNoArgs.test"); assertTrue("testFilterReaderNoArgs: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } @@ -124,7 +121,7 @@ public class ConcatFilterTest extends BuildFileTest { */ protected void doTest(String target, String expectedStart, String expectedEnd) { executeTarget(target); - String resultContent = read("result/concat." + target.substring(4) + ".test"); + String resultContent = read(getProject().getProperty("output") + "/concat." + target.substring(4) + ".test"); assertTrue("First 5 lines differs.", resultContent.startsWith(expectedStart)); assertTrue("Last 5 lines differs.", resultContent.endsWith(expectedEnd)); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java index 6de81c648..74ff7f37b 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java @@ -37,14 +37,11 @@ public class DynamicFilterTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/filters/dynamicfilter.xml"); - executeTarget("init"); + executeTarget("setUp"); } - public void tearDown() { - executeTarget("cleanup"); - } public void testCustomFilter() throws IOException { - expectFileContains("dynamicfilter", "result/dynamicfilter", + expectFileContains("dynamicfilter", getProject().getProperty("output") + "/dynamicfilter", "hellO wOrld"); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/EscapeUnicodeTest.java b/src/tests/junit/org/apache/tools/ant/filters/EscapeUnicodeTest.java index b054699ad..4de10b4d1 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/EscapeUnicodeTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/EscapeUnicodeTest.java @@ -38,14 +38,10 @@ public class EscapeUnicodeTest extends BuildFileTest { configureProject("src/etc/testcases/filters/build.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testEscapeUnicode() throws IOException { executeTarget("testEscapeUnicode"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/escapeunicode.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/escapeunicode.test"); + File result = new File(getProject().getProperty("output"), "escapeunicode.test"); assertTrue(FILE_UTILS.contentEquals(expected, result)); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java b/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java index 4bff51720..8f896ff42 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/HeadTailTest.java @@ -41,35 +41,31 @@ public class HeadTailTest extends BuildFileTest { configureProject("src/etc/testcases/filters/head-tail.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testHead() throws IOException { executeTarget("testHead"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.head.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/head-tail.head.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.head.test"); assertTrue("testHead: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } public void testHeadLines() throws IOException { executeTarget("testHeadLines"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.headLines.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/head-tail.headLines.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.headLines.test"); assertTrue("testHeadLines: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } public void testHeadSkip() throws IOException { executeTarget("testHeadSkip"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headSkip.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.headSkip.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.headSkip.test"); assertTrue("testHeadSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } public void testHeadLinesSkip() throws IOException { executeTarget("testHeadLinesSkip"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headLinesSkip.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.headLinesSkip.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.headLinesSkip.test"); assertTrue("testHeadLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } @@ -77,8 +73,7 @@ public class HeadTailTest extends BuildFileTest { executeTarget("testFilterReaderHeadLinesSkip"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.headLinesSkip.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), - "result/head-tail.filterReaderHeadLinesSkip.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.filterReaderHeadLinesSkip.test"); assertTrue("testFilterReaderHeadLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } @@ -86,28 +81,28 @@ public class HeadTailTest extends BuildFileTest { public void testTail() throws IOException { executeTarget("testTail"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tail.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tail.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.tail.test"); assertTrue("testTail: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } public void testTailLines() throws IOException { executeTarget("testTailLines"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailLines.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tailLines.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.tailLines.test"); assertTrue("testTailLines: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } public void testTailSkip() throws IOException { executeTarget("testTailSkip"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailSkip.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tailSkip.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.tailSkip.test"); assertTrue("testTailSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } public void testTailLinesSkip() throws IOException { executeTarget("testTailLinesSkip"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailLinesSkip.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tailLinesSkip.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.tailLinesSkip.test"); assertTrue("testTailLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } @@ -115,8 +110,7 @@ public class HeadTailTest extends BuildFileTest { executeTarget("testFilterReaderTailLinesSkip"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.tailLinesSkip.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), - "result/head-tail.filterReaderTailLinesSkip.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.filterReaderTailLinesSkip.test"); assertTrue("testFilterReaderTailLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } @@ -124,7 +118,7 @@ public class HeadTailTest extends BuildFileTest { public void testHeadTail() throws IOException { executeTarget("testHeadTail"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headtail.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.headtail.test"); + File result = new File(getProject().getProperty("output") + "/head-tail.headtail.test"); assertTrue("testHeadTail: Result not like expected", FILE_UTILS.contentEquals(expected, result)); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java b/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java index fb3336453..e48a882b6 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/LineContainsTest.java @@ -38,14 +38,10 @@ public class LineContainsTest extends BuildFileTest { configureProject("src/etc/testcases/filters/build.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testLineContains() throws IOException { executeTarget("testLineContains"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/linecontains.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/linecontains.test"); + File result = new File(getProject().getProperty("output"),"linecontains.test"); assertTrue(FILE_UTILS.contentEquals(expected, result)); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java b/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java index 00df34e51..1b8779ca0 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/NoNewLineTest.java @@ -36,10 +36,6 @@ public class NoNewLineTest extends BuildFileTest { configureProject("src/etc/testcases/filters/build.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testNoAddNewLine() throws IOException { executeTarget("testNoAddNewLine"); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/ReplaceTokensTest.java b/src/tests/junit/org/apache/tools/ant/filters/ReplaceTokensTest.java index 7a4294833..07ce0a4a5 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/ReplaceTokensTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/ReplaceTokensTest.java @@ -38,21 +38,17 @@ public class ReplaceTokensTest extends BuildFileTest { configureProject("src/etc/testcases/filters/build.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testReplaceTokens() throws IOException { executeTarget("testReplaceTokens"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/replacetokens.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/replacetokens.test"); + File result = new File(getProject().getProperty("output"), "replacetokens.test"); assertTrue(FILE_UTILS.contentEquals(expected, result)); } public void testReplaceTokensPropertyFile() throws IOException { executeTarget("testReplaceTokensPropertyFile"); File expected = FILE_UTILS.resolveFile(getProjectDir(), "expected/replacetokens.test"); - File result = FILE_UTILS.resolveFile(getProjectDir(), "result/replacetokensPropertyFile.test"); + File result = new File(getProject().getProperty("output"), "replacetokensPropertyFile.test"); assertTrue(FILE_UTILS.contentEquals(expected, result)); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/StripJavaCommentsTest.java b/src/tests/junit/org/apache/tools/ant/filters/StripJavaCommentsTest.java index c3311c067..6356141ef 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/StripJavaCommentsTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/StripJavaCommentsTest.java @@ -38,14 +38,10 @@ public class StripJavaCommentsTest extends BuildFileTest { configureProject("src/etc/testcases/filters/build.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testStripJavaComments() throws IOException { executeTarget("testStripJavaComments"); File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/stripjavacomments.test"); - File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/stripjavacomments.test"); + File result = new File(getProject().getProperty("output"), "stripjavacomments.test"); assertTrue(FILE_UTILS.contentEquals(expected, result)); } diff --git a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java index acd944a9e..00aa66abb 100644 --- a/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java +++ b/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java @@ -37,11 +37,7 @@ public class TokenFilterTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/filters/tokenfilter.xml"); - executeTarget("init"); - } - - public void tearDown() { - executeTarget("cleanup"); + executeTarget("setUp"); } /** make sure tokenfilter exists */ @@ -60,26 +56,26 @@ public class TokenFilterTest extends BuildFileTest { public void testUnixLineOutput() throws IOException { expectFileContains( - "unixlineoutput", "result/unixlineoutput", + "unixlineoutput", getProject().getProperty("output") + "/unixlineoutput", "\nThis\nis\na\nnumber\nof\nwords\n"); } public void testDosLineOutput() throws IOException { expectFileContains( - "doslineoutput", "result/doslineoutput", + "doslineoutput", getProject().getProperty("output") + "/doslineoutput", "\r\nThis\r\nis\r\na\r\nnumber\r\nof\r\nwords\r\n"); } public void testFileTokenizer() throws IOException { String contents = getFileString( - "filetokenizer", "result/filetokenizer"); + "filetokenizer", getProject().getProperty("output") + "/filetokenizer"); assertStringContains(contents, " of words"); assertStringNotContains(contents, " This is"); } public void testReplaceString() throws IOException { expectFileContains( - "replacestring", "result/replacestring", + "replacestring", getProject().getProperty("output") + "/replacestring", "this is the moon"); } @@ -89,7 +85,7 @@ public class TokenFilterTest extends BuildFileTest { public void testContainsString() throws IOException { String contents = getFileString( - "containsstring", "result/containsstring"); + "containsstring", getProject().getProperty("output") + "/containsstring"); assertStringContains(contents, "this is a line contains foo"); assertStringNotContains(contents, "this line does not"); } @@ -98,7 +94,7 @@ public class TokenFilterTest extends BuildFileTest { if (! hasRegex("testReplaceRegex")) return; String contents = getFileString( - "replaceregex", "result/replaceregex"); + "replaceregex", getProject().getProperty("output") + "/replaceregex"); assertStringContains(contents, "world world world world"); assertStringContains(contents, "dog Cat dog"); assertStringContains(contents, "moon Sun Sun"); @@ -111,7 +107,7 @@ public class TokenFilterTest extends BuildFileTest { if (! hasRegex("testFilterReplaceRegex")) return; String contents = getFileString( - "filterreplaceregex", "result/filterreplaceregex"); + "filterreplaceregex", getProject().getProperty("output") + "/filterreplaceregex"); assertStringContains(contents, "world world world world"); } @@ -123,7 +119,7 @@ public class TokenFilterTest extends BuildFileTest { public void testTrimFile() throws IOException { String contents = getFileString( - "trimfile", "result/trimfile"); + "trimfile", getProject().getProperty("output") + "/trimfile"); assertTrue("no ws at start", contents.startsWith("This is th")); assertTrue("no ws at end", contents.endsWith("second line.")); assertStringContains(contents, " This is the second"); @@ -131,7 +127,7 @@ public class TokenFilterTest extends BuildFileTest { public void testTrimFileByLine() throws IOException { String contents = getFileString( - "trimfilebyline", "result/trimfilebyline"); + "trimfilebyline", getProject().getProperty("output") + "/trimfilebyline"); assertFalse("no ws at start", contents.startsWith("This is th")); assertFalse("no ws at end", contents.endsWith("second line.")); assertStringNotContains(contents, " This is the second"); @@ -140,7 +136,7 @@ public class TokenFilterTest extends BuildFileTest { public void testFilterReplaceString() throws IOException { String contents = getFileString( - "filterreplacestring", "result/filterreplacestring"); + "filterreplacestring", getProject().getProperty("output") + "/filterreplacestring"); assertStringContains(contents, "This is the moon"); } @@ -152,7 +148,7 @@ public class TokenFilterTest extends BuildFileTest { if (! hasRegex("testContainsRegex")) return; String contents = getFileString( - "containsregex", "result/containsregex"); + "containsregex", getProject().getProperty("output") + "/containsregex"); assertStringContains(contents, "hello world"); assertStringNotContains(contents, "this is the moon"); assertStringContains(contents, "World here"); @@ -162,7 +158,7 @@ public class TokenFilterTest extends BuildFileTest { if (! hasRegex("testFilterContainsRegex")) return; String contents = getFileString( - "filtercontainsregex", "result/filtercontainsregex"); + "filtercontainsregex", getProject().getProperty("output") + "/filtercontainsregex"); assertStringContains(contents, "hello world"); assertStringNotContains(contents, "this is the moon"); assertStringContains(contents, "World here"); @@ -172,13 +168,13 @@ public class TokenFilterTest extends BuildFileTest { if (! hasRegex("testContainsRegex2")) return; String contents = getFileString( - "containsregex2", "result/containsregex2"); + "containsregex2", getProject().getProperty("output") + "/containsregex2"); assertStringContains(contents, "void register_bits();"); } public void testDeleteCharacters() throws IOException { String contents = getFileString( - "deletecharacters", "result/deletechars"); + "deletecharacters", getProject().getProperty("output") + "/deletechars"); assertStringNotContains(contents, "#"); assertStringNotContains(contents, "*"); assertStringContains(contents, "This is some "); @@ -188,7 +184,7 @@ public class TokenFilterTest extends BuildFileTest { if (! hasScript("testScriptFilter")) return; - expectFileContains("scriptfilter", "result/scriptfilter", + expectFileContains("scriptfilter", getProject().getProperty("output") + "/scriptfilter", "HELLO WORLD"); } @@ -197,12 +193,12 @@ public class TokenFilterTest extends BuildFileTest { if (! hasScript("testScriptFilter")) return; - expectFileContains("scriptfilter2", "result/scriptfilter2", + expectFileContains("scriptfilter2", getProject().getProperty("output") + "/scriptfilter2", "HELLO MOON"); } public void testCustomTokenFilter() throws IOException { - expectFileContains("customtokenfilter", "result/custom", + expectFileContains("customtokenfilter", getProject().getProperty("output") + "/custom", "Hello World"); } @@ -224,7 +220,7 @@ public class TokenFilterTest extends BuildFileTest { private boolean hasRegex(String test) { try { executeTarget("hasregex"); - expectFileContains("result/replaceregexp", "bye world"); + expectFileContains(getProject().getProperty("output") + "/replaceregexp", "bye world"); } catch (Throwable ex) { System.out.println(test + ": skipped - regex not present " diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java index 50e3f61fc..e8473859f 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java @@ -35,27 +35,20 @@ public class AbstractCvsTaskTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/taskdefs/abstractcvstask.xml"); - } - - public void tearDown() { - executeTarget("cleanup"); - } - - public void testAbstractCvsTask() { - executeTarget( "all" ); + executeTarget("setUp"); } public void testPackageAttribute() { - File f = getProject().resolveFile("tmpdir/ant/build.xml"); + File f = new File(getProject().getProperty("output") + "/src/Makefile"); assertTrue("starting empty", !f.exists()); - expectLogContaining("package-attribute", "U ant/build.xml"); + expectLogContaining("package-attribute", "U src/Makefile"); assertTrue("now it is there", f.exists()); } public void testTagAttribute() { - File f = getProject().resolveFile("tmpdir/ant/build.xml"); + File f = new File(getProject().getProperty("output") + "/src/Makefile"); assertTrue("starting empty", !f.exists()); - expectLogContaining("tag-attribute", "ANT_141 (revision: 1.175.2.13)"); + expectLogContaining("tag-attribute", "OPENBSD_5_3"); assertTrue("now it is there", f.exists()); } } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java index 680a8eb41..86620d5df 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MultiMapTest.java @@ -34,10 +34,6 @@ public class MultiMapTest extends BuildFileTest { configureProject("src/etc/testcases/taskdefs/multimap.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testMultiCopy() { executeTarget("multicopy"); } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java index 55bed190f..ba5aa14a0 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/TarTest.java @@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs; import java.io.IOException; import java.io.File; import org.apache.tools.ant.BuildFileTest; +import org.apache.tools.ant.Project; import org.apache.tools.ant.util.FileUtils; /** @@ -33,6 +34,7 @@ public class TarTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/taskdefs/tar.xml"); + executeTarget("setUp"); } public void test1() { @@ -54,7 +56,7 @@ public class TarTest extends BuildFileTest { public void test5() { executeTarget("test5"); File f - = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test5.tar"); + = new File(getProject().getProperty("output"), "test5.tar"); if (!f.exists()) { fail("Tarring a directory failed"); @@ -80,14 +82,14 @@ public class TarTest extends BuildFileTest { private void test7(String target) { executeTarget(target); File f1 - = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test7-prefix"); + = new File(getProject().getProperty("output"), "untar/test7-prefix"); if (!(f1.exists() && f1.isDirectory())) { fail("The prefix attribute is not working properly."); } File f2 - = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test7dir"); + = new File(getProject().getProperty("output"), "untar/test7dir"); if (!(f2.exists() && f2.isDirectory())) { fail("The prefix attribute is not working properly."); @@ -117,7 +119,7 @@ public class TarTest extends BuildFileTest { private void test8(String target) { executeTarget(target); File f1 - = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test8.xml"); + = new File(getProject().getProperty("output"), "untar/test8.xml"); if (! f1.exists()) { fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); } @@ -130,7 +132,7 @@ public class TarTest extends BuildFileTest { public void test10() { executeTarget("test10"); File f1 - = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test10.xml"); + = new File(getProject().getProperty("output"), "untar/test10.xml"); if (! f1.exists()) { fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); } @@ -139,7 +141,7 @@ public class TarTest extends BuildFileTest { public void test11() { executeTarget("test11"); File f1 - = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test11.xml"); + = new File(getProject().getProperty("output"), "untar/test11.xml"); if (! f1.exists()) { fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); } @@ -149,10 +151,8 @@ public class TarTest extends BuildFileTest { executeTarget("testGZipResource"); assertTrue(FileUtils.getFileUtils() .contentEquals(getProject().resolveFile("../asf-logo.gif"), - getProject().resolveFile("testout/asf-logo.gif.gz"))); + new File(getProject().getProperty("output"), "untar/asf-logo.gif.gz"))); } - public void tearDown() { - executeTarget("cleanup"); - } + } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java index 5ec3b9f7a..ae7176adf 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java @@ -20,6 +20,8 @@ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.BuildFileTest; import org.apache.tools.ant.util.FileUtils; +import java.io.File; + /** */ public class UntarTest extends BuildFileTest { @@ -35,10 +37,6 @@ public class UntarTest extends BuildFileTest { configureProject("src/etc/testcases/taskdefs/untar.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void testRealTest() throws java.io.IOException { testLogoExtraction("realTest"); } @@ -81,12 +79,13 @@ public class UntarTest extends BuildFileTest { private void testLogoExtraction(String target) throws java.io.IOException { executeTarget(target); assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), - project.resolveFile("asf-logo.gif"))); + new File(getProject().getProperty("output"), "untar/" + + "asf-logo.gif"))); } public void testDocumentationClaimsOnCopy() { executeTarget("testDocumentationClaimsOnCopy"); - assertFalse(getProject().resolveFile("untartestout/1/foo").exists()); - assertTrue(getProject().resolveFile("untartestout/2/bar").exists()); + assertFalse(new File(getProject().getProperty("output"), "untar/1/foo").exists()); + assertTrue(new File(getProject().getProperty("output"), "untar/2/bar").exists()); } } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java index ed90ca412..21edc0cc9 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UnzipTest.java @@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; import org.apache.tools.ant.BuildFileTest; import org.apache.tools.ant.util.FileUtils; +import java.io.File; import java.io.IOException; /** @@ -37,10 +38,6 @@ public class UnzipTest extends BuildFileTest { configureProject("src/etc/testcases/taskdefs/unzip.xml"); } - public void tearDown() { - executeTarget("cleanup"); - } - public void test1() { expectBuildException("test1", "required argument not specified"); } @@ -65,7 +62,7 @@ public class UnzipTest extends BuildFileTest { */ private void assertLogoUncorrupted() throws IOException { assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), - project.resolveFile("asf-logo.gif"))); + new File(getProject().getProperty("output"), "asf-logo.gif"))); } public void testTestZipTask() throws java.io.IOException { @@ -83,8 +80,8 @@ public class UnzipTest extends BuildFileTest { */ public void testPatternSetExcludeOnly() { executeTarget("testPatternSetExcludeOnly"); - assertFileMissing("1/foo is excluded", "unziptestout/1/foo"); - assertFileExists("2/bar is not excluded", "unziptestout/2/bar"); + assertFileMissing("1/foo is excluded", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("2/bar is not excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); } /* @@ -92,8 +89,8 @@ public class UnzipTest extends BuildFileTest { */ public void testPatternSetIncludeOnly() { executeTarget("testPatternSetIncludeOnly"); - assertFileMissing("1/foo is not included", "unziptestout/1/foo"); - assertFileExists("2/bar is included", "unziptestout/2/bar"); + assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("2/bar is included", getProject().getProperty("output") + "/unziptestout/2/bar"); } /* @@ -101,8 +98,8 @@ public class UnzipTest extends BuildFileTest { */ public void testPatternSetIncludeAndExclude() { executeTarget("testPatternSetIncludeAndExclude"); - assertFileMissing("1/foo is not included", "unziptestout/1/foo"); - assertFileMissing("2/bar is excluded", "unziptestout/2/bar"); + assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileMissing("2/bar is excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); } /* @@ -110,8 +107,8 @@ public class UnzipTest extends BuildFileTest { */ public void testTwoPatternSets() { executeTarget("testTwoPatternSets"); - assertFileMissing("1/foo is not included", "unziptestout/1/foo"); - assertFileExists("2/bar is included", "unziptestout/2/bar"); + assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("2/bar is included", getProject().getProperty("output") + "/unziptestout/2/bar"); } /* @@ -119,8 +116,8 @@ public class UnzipTest extends BuildFileTest { */ public void testTwoPatternSetsWithExcludes() { executeTarget("testTwoPatternSetsWithExcludes"); - assertFileMissing("1/foo is not included", "unziptestout/1/foo"); - assertFileMissing("2/bar is excluded", "unziptestout/2/bar"); + assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileMissing("2/bar is excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); } /* @@ -138,8 +135,8 @@ public class UnzipTest extends BuildFileTest { */ public void testPatternSetSlashOnly() { executeTarget("testPatternSetSlashOnly"); - assertFileMissing("1/foo is not included", "unziptestout/1/foo"); - assertFileExists("\"2/bar is included", "unziptestout/2/bar"); + assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("\"2/bar is included", getProject().getProperty("output") + "/unziptestout/2/bar"); } @@ -148,7 +145,7 @@ public class UnzipTest extends BuildFileTest { */ public void testEncoding() { executeTarget("encodingTest"); - assertFileExists("foo has been properly named", "unziptestout/foo"); + assertFileExists("foo has been properly named", getProject().getProperty("output") + "/unziptestout/foo"); } /* @@ -156,8 +153,8 @@ public class UnzipTest extends BuildFileTest { */ public void testFlattenMapper() { executeTarget("testFlattenMapper"); - assertFileMissing("1/foo is not flattened", "unziptestout/1/foo"); - assertFileExists("foo is flattened", "unziptestout/foo"); + assertFileMissing("1/foo is not flattened", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("foo is flattened", getProject().getProperty("output") + "/unziptestout/foo"); } /** @@ -186,8 +183,8 @@ public class UnzipTest extends BuildFileTest { */ public void testGlobMapper() { executeTarget("testGlobMapper"); - assertFileMissing("1/foo is not mapped", "unziptestout/1/foo"); - assertFileExists("1/foo is mapped", "unziptestout/1/foo.txt"); + assertFileMissing("1/foo is not mapped", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("1/foo is mapped", getProject().getProperty("output") + "/unziptestout/1/foo.txt"); } public void testTwoMappers() { @@ -197,12 +194,12 @@ public class UnzipTest extends BuildFileTest { public void testResourceCollections() { executeTarget("testResourceCollection"); assertFileExists("junit.jar has been extracted", - "unziptestout/junit/framework/Assert.class"); + getProject().getProperty("output") + "/unziptestout/junit/framework/Assert.class"); } public void testDocumentationClaimsOnCopy() { executeTarget("testDocumentationClaimsOnCopy"); - assertFileMissing("1/foo is excluded", "unziptestout/1/foo"); - assertFileExists("2/bar is not excluded", "unziptestout/2/bar"); + assertFileMissing("1/foo is excluded", getProject().getProperty("output") + "/unziptestout/1/foo"); + assertFileExists("2/bar is not excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); } } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java index 7d10a927b..b9e9cf496 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ZipTest.java @@ -38,6 +38,7 @@ public class ZipTest extends BuildFileTest { public void setUp() { configureProject("src/etc/testcases/taskdefs/zip.xml"); + executeTarget("setUp"); } public void test1() { @@ -65,7 +66,11 @@ public class ZipTest extends BuildFileTest { } catch (IOException e) { //ignored } - executeTarget("cleanup"); + try { + super.tearDown(); + } catch (Exception exc) { + System.err.println(exc.getMessage()); + } } public void test5() { @@ -89,7 +94,7 @@ public class ZipTest extends BuildFileTest { public void testZipgroupfileset() throws IOException { executeTarget("testZipgroupfileset"); - ZipFile zipFile = new ZipFile(new File(getProjectDir(), "zipgroupfileset.zip")); + ZipFile zipFile = new ZipFile(new File(getProject().getProperty("output"), "zipgroupfileset.zip")); assertTrue(zipFile.getEntry("ant.xml") != null); assertTrue(zipFile.getEntry("optional/jspc.xml") != null); @@ -113,7 +118,7 @@ public class ZipTest extends BuildFileTest { // Bugzilla Report 18403 public void testPrefixAddsDir() throws IOException { executeTarget("testPrefixAddsDir"); - File archive = getProject().resolveFile("test3.zip"); + File archive = new File(getProject().getProperty("output"), "test3.zip"); zfPrefixAddsDir = new ZipFile(archive); ZipEntry ze = zfPrefixAddsDir.getEntry("test/"); assertNotNull("test/ has been added", ze); @@ -124,10 +129,10 @@ public class ZipTest extends BuildFileTest { public void testFilesOnlyDoesntCauseRecreate() throws InterruptedException { executeTarget("testFilesOnlyDoesntCauseRecreateSetup"); - long l = getProject().resolveFile("test3.zip").lastModified(); + long l = new File(getProject().getProperty("output"), "test3.zip").lastModified(); Thread.sleep(3000); executeTarget("testFilesOnlyDoesntCauseRecreate"); - assertEquals(l, getProject().resolveFile("test3.zip").lastModified()); + assertEquals(l, new File(getProject().getProperty("output"), "test3.zip").lastModified()); } // Bugzilla Report 22865 @@ -156,7 +161,7 @@ public class ZipTest extends BuildFileTest { executeTarget("testDefaultExcludesAndUpdate"); ZipFile f = null; try { - f = new ZipFile(getProject().resolveFile("test3.zip")); + f = new ZipFile(new File(getProject().getProperty("output"), "test3.zip")); assertNotNull("ziptest~ should be included", f.getEntry("ziptest~")); } finally { @@ -178,8 +183,7 @@ public class ZipTest extends BuildFileTest { executeTarget("testTarFileSet"); org.apache.tools.zip.ZipFile zf = null; try { - zf = new org.apache.tools.zip.ZipFile(getProject() - .resolveFile("test3.zip")); + zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); org.apache.tools.zip.ZipEntry ze = zf.getEntry("asf-logo.gif"); assertEquals(UnixStat.FILE_FLAG | 0446, ze.getUnixMode()); } finally { @@ -193,8 +197,7 @@ public class ZipTest extends BuildFileTest { executeTarget("rewriteZeroPermissions"); org.apache.tools.zip.ZipFile zf = null; try { - zf = new org.apache.tools.zip.ZipFile(getProject() - .resolveFile("test3.zip")); + zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt"); assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode()); } finally { @@ -208,8 +211,7 @@ public class ZipTest extends BuildFileTest { executeTarget("acceptZeroPermissions"); org.apache.tools.zip.ZipFile zf = null; try { - zf = new org.apache.tools.zip.ZipFile(getProject() - .resolveFile("test3.zip")); + zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt"); assertEquals(0000, ze.getUnixMode()); } finally { @@ -223,8 +225,7 @@ public class ZipTest extends BuildFileTest { executeTarget("testForBugzilla34764"); org.apache.tools.zip.ZipFile zf = null; try { - zf = new org.apache.tools.zip.ZipFile(getProject() - .resolveFile("test3.zip")); + zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); org.apache.tools.zip.ZipEntry ze = zf.getEntry("file1"); assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode()); } finally { diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java index 8caa42c53..883477cb8 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/JavahTest.java @@ -19,6 +19,8 @@ package org.apache.tools.ant.taskdefs.optional; import org.apache.tools.ant.BuildFileTest; +import java.io.File; + public class JavahTest extends BuildFileTest { private final static String BUILD_XML = @@ -32,19 +34,15 @@ public class JavahTest extends BuildFileTest { configureProject(BUILD_XML); } - public void tearDown() { - executeTarget("tearDown"); - } - public void testSimpleCompile() { executeTarget("simple-compile"); - assertTrue(getProject().resolveFile("output/org_example_Foo.h") - .exists()); + assertTrue(new File(getProject().getProperty("output"), "org_example_Foo.h") + .exists()); } public void testCompileFileset() { executeTarget("test-fileset"); - assertTrue(getProject().resolveFile("output/org_example_Foo.h") + assertTrue(new File(getProject().getProperty("output"), "org_example_Foo.h") .exists()); } } diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java index d18c82ad6..c6886d4f3 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/Native2AsciiTest.java @@ -35,14 +35,10 @@ public class Native2AsciiTest extends BuildFileTest { configureProject(BUILD_XML); } - public void tearDown() { - executeTarget("tearDown"); - } - public void testIso8859_1() throws java.io.IOException { executeTarget("testIso8859-1"); File in = getProject().resolveFile("expected/iso8859-1.test"); - File out = getProject().resolveFile("output/iso8859-1.test"); + File out = new File(getProject().getProperty("output"), "iso8859-1.test"); assertTrue(FileUtils.getFileUtils().contentEquals(in, out, true)); } } diff --git a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java index cf56bc25b..37b590c8d 100644 --- a/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/AssertionsTest.java @@ -32,10 +32,6 @@ public class AssertionsTest extends BuildFileTest { configureProject("src/etc/testcases/types/assertions.xml"); } - protected void tearDown() throws Exception { - executeTarget("teardown"); - } - /** * runs a test and expects an assertion thrown in forked code * @param target diff --git a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java index c2157dc04..d0483ae66 100644 --- a/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/resources/TarResourceTest.java @@ -20,6 +20,8 @@ package org.apache.tools.ant.types.resources; import org.apache.tools.ant.BuildFileTest; import org.apache.tools.ant.util.FileUtils; +import java.io.File; + public class TarResourceTest extends BuildFileTest { private static final FileUtils FU = FileUtils.getFileUtils(); @@ -32,13 +34,9 @@ public class TarResourceTest extends BuildFileTest { configureProject("src/etc/testcases/types/resources/tarentry.xml"); } - protected void tearDown() throws Exception { - executeTarget("tearDown"); - } - public void testUncompressSource() throws java.io.IOException { executeTarget("uncompressSource"); assertTrue(FU.contentEquals(project.resolveFile("../../asf-logo.gif"), - project.resolveFile("testout/asf-logo.gif"))); + new File(getProject().getProperty("output"), "asf-logo.gif"))); } }