git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1584252 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -18,8 +18,10 @@ | |||||
| <project name="available-test" basedir="." default="test1"> | <project name="available-test" basedir="." default="test1"> | ||||
| <target name="tearDown"> | |||||
| <delete dir="greatgrandparent"/> | |||||
| <import file="../buildfiletest-base.xml"/> | |||||
| <target name="setUp"> | |||||
| <mkdir dir="${output}" /> | |||||
| </target> | </target> | ||||
| <target name="test1"> | <target name="test1"> | ||||
| @@ -153,14 +155,12 @@ | |||||
| <target name="test24"> | <target name="test24"> | ||||
| <!-- create a dummy file and look for it --> | <!-- create a dummy file and look for it --> | ||||
| <mkdir dir="${user.dir}/test"/> | |||||
| <echo message="package test;public class test {}" file="${user.dir}/test/test.java"/> | |||||
| <javac srcdir="${user.dir}" includes="test/test.java"/> | |||||
| <jar destfile="${user.dir}/test.jar" basedir="${user.dir}" includes="test/test.class"/> | |||||
| <mkdir dir="${output}/test"/> | |||||
| <echo message="package test;public class test {}" file="${output}/test/test.java"/> | |||||
| <javac srcdir="${output}" includes="test/test.java"/> | |||||
| <jar destfile="${output}/test.jar" basedir="${output}" includes="test/test.class"/> | |||||
| <available property="test" | <available property="test" | ||||
| classname="test.test" classpath="${user.dir}/test.jar"/> | |||||
| <delete dir="${user.dir}/test"/> | |||||
| <delete file="${user.dir}/test.jar"/> | |||||
| classname="test.test" classpath="${output}/test.jar"/> | |||||
| </target> | </target> | ||||
| <target name="searchInPathNotThere"> | <target name="searchInPathNotThere"> | ||||
| @@ -183,14 +183,13 @@ | |||||
| </target> | </target> | ||||
| <target name="prep.parents"> | <target name="prep.parents"> | ||||
| <delete quiet="yes" dir="greatgrandparent"/> | |||||
| <mkdir dir="greatgrandparent/grandparent/parent/dir"/> | |||||
| <touch file="greatgrandparent/a.txt"/> | |||||
| <touch file="greatgrandparent/grandparent/b.txt"/> | |||||
| <touch file="greatgrandparent/grandparent/parent/c.txt"/> | |||||
| <touch file="greatgrandparent/grandparent/parent/dir/d.txt"/> | |||||
| <mkdir dir="${output}/greatgrandparent/grandparent/parent/dir"/> | |||||
| <touch file="${output}/greatgrandparent/a.txt"/> | |||||
| <touch file="${output}/greatgrandparent/grandparent/b.txt"/> | |||||
| <touch file="${output}/greatgrandparent/grandparent/parent/c.txt"/> | |||||
| <touch file="${output}/greatgrandparent/grandparent/parent/dir/d.txt"/> | |||||
| <property name="available.test.dir" | <property name="available.test.dir" | ||||
| value="greatgrandparent/grandparent/parent/dir"/> | |||||
| value="${output}/greatgrandparent/grandparent/parent/dir"/> | |||||
| </target> | </target> | ||||
| <target name="search-parents" depends="prep.parents"> | <target name="search-parents" depends="prep.parents"> | ||||
| <echo>testing greatgrandparent - should see</echo> | <echo>testing greatgrandparent - should see</echo> | ||||
| @@ -15,85 +15,106 @@ | |||||
| See the License for the specific language governing permissions and | See the License for the specific language governing permissions and | ||||
| limitations under the License. | limitations under the License. | ||||
| --> | --> | ||||
| <project name ="calltarget-test" default="testinheritreffileset" basedir="."> | |||||
| <property name="tmp.dir" value="tmp.dir" /> | |||||
| <target name="setup"> | |||||
| <mkdir dir="${tmp.dir}"/> | |||||
| </target> | |||||
| <target name="cleanup"> | |||||
| <delete dir="${tmp.dir}" quiet="true"/> | |||||
| </target> | |||||
| <target name="mytarget"> | |||||
| <pathconvert property="myproperty" targetos="unix" refid="myfileset"/> | |||||
| <echo message="myproperty=${myproperty}"/> | |||||
| </target> | |||||
| <target name="testinheritreffileset"> | |||||
| <project name="calltarget-test" default="testinheritreffileset" basedir="."> | |||||
| <import file="../buildfiletest-base.xml"/> | |||||
| <target name="setUp"> | |||||
| <mkdir dir="${output}"/> | |||||
| </target> | |||||
| <target name="mytarget"> | |||||
| <pathconvert property="myproperty" targetos="unix" refid="myfileset"/> | |||||
| <echo message="myproperty=${myproperty}"/> | |||||
| </target> | |||||
| <target name="testinheritreffileset"> | |||||
| <!-- this testcase should show that the fileset defined here | <!-- this testcase should show that the fileset defined here | ||||
| can be read in the called target --> | can be read in the called target --> | ||||
| <fileset dir="." id="myfileset"> | |||||
| <include name="calltarget.xml"/> | |||||
| </fileset> | |||||
| <antcall target="mytarget" inheritrefs="true"/> | |||||
| </target> | |||||
| <target name="copytest2"> | |||||
| <copy file="${tmp.dir}/copytest.in" toFile="${tmp.dir}/copytest1.out" overwrite="true"> | |||||
| <filterset refid="foo"/> | |||||
| </copy> | |||||
| </target> | |||||
| <target name="testinheritreffilterset" depends="setup"> | |||||
| <echo file="${tmp.dir}/copytest.in">@@foo@@</echo> | |||||
| <filterset id="foo" begintoken="@@" endtoken="@@"> | |||||
| <filter token="foo" value="bar"/> | |||||
| </filterset> | |||||
| <antcall target="copytest2" inheritrefs="true"/> | |||||
| <copy file="${tmp.dir}/copytest.in" toFile="${tmp.dir}/copytest2.out" overwrite="true"> | |||||
| <filterset refid="foo"/> | |||||
| </copy> | |||||
| <loadfile srcFile="${tmp.dir}/copytest2.out" property="copytest2"/> | |||||
| <loadfile srcFile="${tmp.dir}/copytest1.out" property="copytest1"/> | |||||
| <condition property="success"> | |||||
| <equals arg1="${copytest1}" arg2="${copytest2}"/> | |||||
| </condition> | |||||
| <fail message="filterset not properly passed across by antcall" unless="success"/> | |||||
| </target> | |||||
| <property name="multi" value="DEFAULT"/> | |||||
| <target name="multi"> | |||||
| <echo>multi is ${multi}</echo> | |||||
| </target> | |||||
| <target name="call-multi"> | |||||
| <antcall target="multi"> | |||||
| <param name="multi" value="SET"/> | |||||
| </antcall> | |||||
| </target> | |||||
| <target name="blank-target"> | |||||
| <antcall> | |||||
| <target name="" /> | |||||
| </antcall> | |||||
| </target> | |||||
| <target name="multiple-targets"> | |||||
| <antcall> | |||||
| <target name="ta" /> | |||||
| <target name="tb" /> | |||||
| <target name="tc" /> | |||||
| </antcall> | |||||
| </target> | |||||
| <target name="multiple-targets-2"> | |||||
| <ant antfile="ant.xml"> | |||||
| <target name="tb" /> | |||||
| <target name="da" /> | |||||
| </ant> | |||||
| </target> | |||||
| <target name="ta"><echo>ta</echo></target> | |||||
| <target name="tb" depends="da,dc"><echo>tb</echo></target> | |||||
| <target name="tc" depends="db,dc"><echo>tc</echo></target> | |||||
| <target name="da"><echo>da</echo></target> | |||||
| <target name="db"><echo>db</echo></target> | |||||
| <target name="dc"><echo>dc</echo></target> | |||||
| <fileset dir="." id="myfileset"> | |||||
| <include name="calltarget.xml"/> | |||||
| </fileset> | |||||
| <antcall target="mytarget" inheritrefs="true"/> | |||||
| </target> | |||||
| <target name="copytest2"> | |||||
| <copy file="${output}/copytest.in" toFile="${output}/copytest1.out" overwrite="true"> | |||||
| <filterset refid="foo"/> | |||||
| </copy> | |||||
| </target> | |||||
| <target name="testinheritreffilterset" depends="setUp"> | |||||
| <echo file="${output}/copytest.in">@@foo@@</echo> | |||||
| <filterset id="foo" begintoken="@@" endtoken="@@"> | |||||
| <filter token="foo" value="bar"/> | |||||
| </filterset> | |||||
| <antcall target="copytest2" inheritrefs="true"/> | |||||
| <copy file="${output}/copytest.in" toFile="${output}/copytest2.out" overwrite="true"> | |||||
| <filterset refid="foo"/> | |||||
| </copy> | |||||
| <loadfile srcFile="${output}/copytest2.out" property="copytest2"/> | |||||
| <loadfile srcFile="${output}/copytest1.out" property="copytest1"/> | |||||
| <condition property="success"> | |||||
| <equals arg1="${copytest1}" arg2="${copytest2}"/> | |||||
| </condition> | |||||
| <fail message="filterset not properly passed across by antcall" unless="success"/> | |||||
| </target> | |||||
| <property name="multi" value="DEFAULT"/> | |||||
| <target name="multi"> | |||||
| <echo>multi is ${multi}</echo> | |||||
| </target> | |||||
| <target name="call-multi"> | |||||
| <antcall target="multi"> | |||||
| <param name="multi" value="SET"/> | |||||
| </antcall> | |||||
| </target> | |||||
| <target name="blank-target"> | |||||
| <antcall> | |||||
| <target name=""/> | |||||
| </antcall> | |||||
| </target> | |||||
| <target name="multiple-targets"> | |||||
| <antcall> | |||||
| <target name="ta"/> | |||||
| <target name="tb"/> | |||||
| <target name="tc"/> | |||||
| </antcall> | |||||
| </target> | |||||
| <target name="multiple-targets-2"> | |||||
| <ant antfile="ant.xml"> | |||||
| <target name="tb"/> | |||||
| <target name="da"/> | |||||
| </ant> | |||||
| </target> | |||||
| <target name="ta"> | |||||
| <echo>ta</echo> | |||||
| </target> | |||||
| <target name="tb" depends="da,dc"> | |||||
| <echo>tb</echo> | |||||
| </target> | |||||
| <target name="tc" depends="db,dc"> | |||||
| <echo>tc</echo> | |||||
| </target> | |||||
| <target name="da"> | |||||
| <echo>da</echo> | |||||
| </target> | |||||
| <target name="db"> | |||||
| <echo>db</echo> | |||||
| </target> | |||||
| <target name="dc"> | |||||
| <echo>dc</echo> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -18,64 +18,66 @@ | |||||
| <project name="copy-test" basedir="." default="test1"> | <project name="copy-test" basedir="." default="test1"> | ||||
| <import file="../buildfiletest-base.xml"/> | |||||
| <target name="setUp"> | |||||
| <mkdir dir="${output}" /> | |||||
| </target> | |||||
| <target name="test1"> | <target name="test1"> | ||||
| <copy file="copy.xml" tofile="copytest1.tmp" /> | |||||
| <copy file="copy.xml" tofile="${output}/copytest1.tmp" /> | |||||
| </target> | </target> | ||||
| <target name="test2"> | <target name="test2"> | ||||
| <copy file="copy.xml" todir="copytest1dir" overwrite="true"/> | |||||
| <copy file="copy.xml" todir="${output}/copytest1dir" overwrite="true"/> | |||||
| </target> | </target> | ||||
| <target name="filtertest"> | <target name="filtertest"> | ||||
| <!-- check fix for bugzilla 23154 --> | <!-- check fix for bugzilla 23154 --> | ||||
| <delete quiet="yes" file="copy.filter.out"/> | |||||
| <delete quiet="yes" file="copy.filter.inp"/> | |||||
| <concat destfile="copy.filter.inp"> | |||||
| <concat destfile="${output}/copy.filter.inp"> | |||||
| PRODUCT_VERSION=6.2.1.4 | PRODUCT_VERSION=6.2.1.4 | ||||
| PRODUCT_BUILD=6.5 (BLD_65036) | PRODUCT_BUILD=6.5 (BLD_65036) | ||||
| PRODUCT_VERSION=6.2.1.4 | PRODUCT_VERSION=6.2.1.4 | ||||
| PRODUCT_BUILD=6.5 (BLD_65036) | PRODUCT_BUILD=6.5 (BLD_65036) | ||||
| </concat> | </concat> | ||||
| <copy file="copy.filter.inp" tofile="copy.filter.out"> | |||||
| <copy file="${output}/copy.filter.inp" tofile="${output}/copy.filter.out"> | |||||
| <filterset begintoken="6" endtoken="4"> | <filterset begintoken="6" endtoken="4"> | ||||
| <filter token=".2.1." value="2.6.4" /> | <filter token=".2.1." value="2.6.4" /> | ||||
| </filterset> | </filterset> | ||||
| </copy> | </copy> | ||||
| <concat><path path="copy.filter.out"/></concat> | |||||
| <concat><path path="${output}/copy.filter.out"/></concat> | |||||
| </target> | </target> | ||||
| <target name="infinitetest"> | <target name="infinitetest"> | ||||
| <delete quiet="yes" file="copy.filter.out"/> | |||||
| <delete quiet="yes" file="copy.filter.inp"/> | |||||
| <concat destfile="copy.filter.inp"> | |||||
| <concat destfile="${output}/copy.filter.inp"> | |||||
| a=b= | a=b= | ||||
| </concat> | </concat> | ||||
| <copy file="copy.filter.inp" tofile="copy.filter.out"> | |||||
| <copy file="${output}/copy.filter.inp" tofile="${output}/copy.filter.out"> | |||||
| <filterset begintoken="=" endtoken="="> | <filterset begintoken="=" endtoken="="> | ||||
| <filter token="b" value="=b="/> | <filter token="b" value="=b="/> | ||||
| </filterset> | </filterset> | ||||
| </copy> | </copy> | ||||
| <concat><path path="copy.filter.out"/></concat> | |||||
| <concat><path path="${output}/copy.filter.out"/></concat> | |||||
| </target> | </target> | ||||
| <target name="test3"> | <target name="test3"> | ||||
| <!-- create an empty file --> | <!-- create an empty file --> | ||||
| <touch file="copytest3.tmp"/> | |||||
| <touch file="${output}/copytest3.tmp"/> | |||||
| <!--wait --> | <!--wait --> | ||||
| <sleep seconds="4"/> | <sleep seconds="4"/> | ||||
| <!-- copy a different file to two places --> | <!-- copy a different file to two places --> | ||||
| <copy file="copy.xml" tofile="copytest3a.tmp" overwrite="true"/> | |||||
| <copy file="copy.xml" tofile="copytest3b.tmp" overwrite="true"/> | |||||
| <copy file="copy.xml" tofile="${output}/copytest3a.tmp" overwrite="true"/> | |||||
| <copy file="copy.xml" tofile="${output}/copytest3b.tmp" overwrite="true"/> | |||||
| <!--wait --> | <!--wait --> | ||||
| <sleep seconds="4"/> | <sleep seconds="4"/> | ||||
| <!-- copy an old file onto a newer file (should not work) --> | <!-- copy an old file onto a newer file (should not work) --> | ||||
| <copy file="copytest3.tmp" tofile="copytest3b.tmp" /> | |||||
| <copy file="${output}/copytest3.tmp" tofile="${output}/copytest3b.tmp" /> | |||||
| <!-- copy an older file onto a new one, should succeed --> | <!-- copy an older file onto a new one, should succeed --> | ||||
| <copy file="copytest3.tmp" tofile="copytest3c.tmp" | |||||
| <copy file="${output}/copytest3.tmp" tofile="${output}/copytest3c.tmp" | |||||
| overwrite="true" | overwrite="true" | ||||
| preservelastmodified="true" /> | preservelastmodified="true" /> | ||||
| <!-- copy a newer file onto an older one (should work) --> | <!-- copy a newer file onto an older one (should work) --> | ||||
| <copy file="copytest3a.tmp" tofile="copytest3.tmp" | |||||
| <copy file="${output}/copytest3a.tmp" tofile="${output}/copytest3.tmp" | |||||
| preservelastmodified="true" /> | preservelastmodified="true" /> | ||||
| <!-- expected state : | <!-- expected state : | ||||
| 3a.tmp==3.tmp==copy.xml | 3a.tmp==3.tmp==copy.xml | ||||
| @@ -87,13 +89,13 @@ a=b= | |||||
| </target> | </target> | ||||
| <target name="test_single_file_fileset"> | <target name="test_single_file_fileset"> | ||||
| <copy tofile="copytest_single_file_fileset.tmp"> | |||||
| <copy tofile="${output}/copytest_single_file_fileset.tmp"> | |||||
| <fileset dir="." includes="copy.xml"/> | <fileset dir="." includes="copy.xml"/> | ||||
| </copy> | </copy> | ||||
| </target> | </target> | ||||
| <target name="test_single_file_path"> | <target name="test_single_file_path"> | ||||
| <copy tofile="copytest_single_file_path.tmp"> | |||||
| <copy tofile="${output}/copytest_single_file_path.tmp"> | |||||
| <path> | <path> | ||||
| <pathelement location="copy.xml"/> | <pathelement location="copy.xml"/> | ||||
| </path> | </path> | ||||
| @@ -101,7 +103,7 @@ a=b= | |||||
| </target> | </target> | ||||
| <target name="testFilterSet"> | <target name="testFilterSet"> | ||||
| <copy file="copy.filterset" tofile="copy.filterset.tmp"> | |||||
| <copy file="copy.filterset" tofile="${output}/copy.filterset.tmp"> | |||||
| <filterset> | <filterset> | ||||
| <filter token="TITLE" value="Apache Ant Project"/> | <filter token="TITLE" value="Apache Ant Project"/> | ||||
| </filterset> | </filterset> | ||||
| @@ -109,7 +111,7 @@ a=b= | |||||
| </target> | </target> | ||||
| <target name="testFilterChain"> | <target name="testFilterChain"> | ||||
| <copy file="copy.filterset" tofile="copy.filterchain.tmp"> | |||||
| <copy file="copy.filterset" tofile="${output}/copy.filterchain.tmp"> | |||||
| <filterchain> | <filterchain> | ||||
| <replacetokens> | <replacetokens> | ||||
| <token key="TITLE" value="Apache Ant Project"/> | <token key="TITLE" value="Apache Ant Project"/> | ||||
| @@ -119,34 +121,34 @@ a=b= | |||||
| </target> | </target> | ||||
| <target name="testTranscoding"> | <target name="testTranscoding"> | ||||
| <copy file="copy/input/iso8859-1" tofile="copytest1.tmp" | |||||
| <copy file="copy/input/iso8859-1" tofile="${output}/copytest1.tmp" | |||||
| encoding="ISO8859_1" outputencoding="UTF8"/> | encoding="ISO8859_1" outputencoding="UTF8"/> | ||||
| </target> | </target> | ||||
| <target name="testMissingFileIgnore"> | <target name="testMissingFileIgnore"> | ||||
| <copy file="not-there" tofile="copytest1.tmp" | |||||
| <copy file="not-there" tofile="${output}/copytest1.tmp" | |||||
| failonerror="false"/> | failonerror="false"/> | ||||
| </target> | </target> | ||||
| <target name="testMissingFileBail"> | <target name="testMissingFileBail"> | ||||
| <copy file="not-there" tofile="copytest1.tmp" | |||||
| <copy file="not-there" tofile="${output}/copytest1.tmp" | |||||
| failonerror="true"/> | failonerror="true"/> | ||||
| </target> | </target> | ||||
| <target name="testMissingDirIgnore"> | <target name="testMissingDirIgnore"> | ||||
| <copy todir="copytest1dir" failonerror="false"> | |||||
| <copy todir="${output}" failonerror="false"> | |||||
| <fileset dir="not-there"/> | <fileset dir="not-there"/> | ||||
| </copy> | </copy> | ||||
| </target> | </target> | ||||
| <target name="testMissingDirBail"> | <target name="testMissingDirBail"> | ||||
| <copy todir="copytest1dir" failonerror="true"> | |||||
| <copy todir="${output}" failonerror="true"> | |||||
| <fileset dir="not-there"/> | <fileset dir="not-there"/> | ||||
| </copy> | </copy> | ||||
| </target> | </target> | ||||
| <property name="to.dir" value="copy-todir-tmp"/> | |||||
| <property name="from.dir" value="copy-fromdir-tmp"/> | |||||
| <property name="to.dir" value="${output}/copy-todir-tmp"/> | |||||
| <property name="from.dir" value="${output}/copy-fromdir-tmp"/> | |||||
| <target name="testResource.prepare"> | <target name="testResource.prepare"> | ||||
| <mkdir dir="${from.dir}"/> | <mkdir dir="${from.dir}"/> | ||||
| @@ -266,21 +268,4 @@ a=b= | |||||
| </fail> | </fail> | ||||
| </target> | </target> | ||||
| <target name="cleanup"> | |||||
| <delete file="copytest1.tmp"/> | |||||
| <delete file="copytest3.tmp"/> | |||||
| <delete file="copytest3a.tmp"/> | |||||
| <delete file="copytest3b.tmp"/> | |||||
| <delete file="copytest3c.tmp"/> | |||||
| <delete file="copytest_single_file_fileset.tmp"/> | |||||
| <delete file="copytest_single_file_path.tmp"/> | |||||
| <delete file="copy.filterset.tmp"/> | |||||
| <delete file="copy.filterchain.tmp"/> | |||||
| <delete dir="copytest1dir"/> | |||||
| <delete quiet="yes" file="copy.filter.out"/> | |||||
| <delete quiet="yes" file="copy.filter.inp"/> | |||||
| <delete dir="${from.dir}" quiet="true" /> | |||||
| <delete dir="${to.dir}" quiet="true" /> | |||||
| </target> | |||||
| </project> | </project> | ||||
| @@ -351,6 +351,15 @@ public abstract class BuildFileTest extends TestCase { | |||||
| return project.getBaseDir(); | return project.getBaseDir(); | ||||
| } | } | ||||
| /** | |||||
| * get location of temporary directory pointed to by property "output" | |||||
| * @return location of temporary directory pointed to by property "output" | |||||
| * @since Ant 1.9.4 | |||||
| */ | |||||
| public File getOutputDir() { | |||||
| return new File(project.getProperty("output")); | |||||
| } | |||||
| /** | /** | ||||
| * Runs a target, wait for a build exception. | * Runs a target, wait for a build exception. | ||||
| * | * | ||||
| @@ -31,6 +31,7 @@ public class AvailableTest extends BuildFileTest { | |||||
| public void setUp() { | public void setUp() { | ||||
| configureProject("src/etc/testcases/taskdefs/available.xml"); | configureProject("src/etc/testcases/taskdefs/available.xml"); | ||||
| executeTarget("setUp"); | |||||
| } | } | ||||
| // Nothing specified -> Fail | // Nothing specified -> Fail | ||||
| @@ -32,6 +32,7 @@ public class CallTargetTest extends BuildFileTest { | |||||
| public void setUp() { | public void setUp() { | ||||
| configureProject("src/etc/testcases/taskdefs/calltarget.xml"); | configureProject("src/etc/testcases/taskdefs/calltarget.xml"); | ||||
| executeTarget("setUp"); | |||||
| } | } | ||||
| // see bugrep 21724 (references not passing through with antcall) | // see bugrep 21724 (references not passing through with antcall) | ||||
| @@ -66,7 +67,4 @@ public class CallTargetTest extends BuildFileTest { | |||||
| expectLog("multiple-targets-2", "dadctb"); | expectLog("multiple-targets-2", "dadctb"); | ||||
| } | } | ||||
| public void tearDown() { | |||||
| project.executeTarget("cleanup"); | |||||
| } | |||||
| } | } | ||||
| @@ -39,23 +39,20 @@ public class CopyTest extends BuildFileTest { | |||||
| public void setUp() { | public void setUp() { | ||||
| configureProject("src/etc/testcases/taskdefs/copy.xml"); | configureProject("src/etc/testcases/taskdefs/copy.xml"); | ||||
| executeTarget("setUp"); | |||||
| } | } | ||||
| public void test1() { | public void test1() { | ||||
| executeTarget("test1"); | executeTarget("test1"); | ||||
| File f = new File(getProjectDir(), "copytest1.tmp"); | |||||
| File f = new File(getOutputDir(), "copytest1.tmp"); | |||||
| if ( !f.exists()) { | if ( !f.exists()) { | ||||
| fail("Copy failed"); | fail("Copy failed"); | ||||
| } | } | ||||
| } | } | ||||
| public void tearDown() { | |||||
| executeTarget("cleanup"); | |||||
| } | |||||
| public void test2() { | public void test2() { | ||||
| executeTarget("test2"); | executeTarget("test2"); | ||||
| File f = new File(getProjectDir(), "copytest1dir/copy.xml"); | |||||
| File f = new File(getOutputDir(), "copytest1dir/copy.xml"); | |||||
| if ( !f.exists()) { | if ( !f.exists()) { | ||||
| fail("Copy failed"); | fail("Copy failed"); | ||||
| } | } | ||||
| @@ -63,13 +60,13 @@ public class CopyTest extends BuildFileTest { | |||||
| public void test3() { | public void test3() { | ||||
| executeTarget("test3"); | executeTarget("test3"); | ||||
| File file3 = new File(getProjectDir(), "copytest3.tmp"); | |||||
| File file3 = new File(getOutputDir(), "copytest3.tmp"); | |||||
| assertTrue(file3.exists()); | assertTrue(file3.exists()); | ||||
| File file3a = new File(getProjectDir(), "copytest3a.tmp"); | |||||
| File file3a = new File(getOutputDir(), "copytest3a.tmp"); | |||||
| assertTrue(file3a.exists()); | assertTrue(file3a.exists()); | ||||
| File file3b = new File(getProjectDir(), "copytest3b.tmp"); | |||||
| File file3b = new File(getOutputDir(), "copytest3b.tmp"); | |||||
| assertTrue(file3b.exists()); | assertTrue(file3b.exists()); | ||||
| File file3c = new File(getProjectDir(), "copytest3c.tmp"); | |||||
| File file3c = new File(getOutputDir(), "copytest3c.tmp"); | |||||
| assertTrue(file3c.exists()); | assertTrue(file3c.exists()); | ||||
| //file length checks rely on touch generating a zero byte file | //file length checks rely on touch generating a zero byte file | ||||
| @@ -101,7 +98,7 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testFilterSet() throws IOException { | public void testFilterSet() throws IOException { | ||||
| executeTarget("testFilterSet"); | executeTarget("testFilterSet"); | ||||
| File tmp = new File(getProjectDir(), "copy.filterset.tmp"); | |||||
| File tmp = new File(getOutputDir(), "copy.filterset.tmp"); | |||||
| File check = new File(getProjectDir(), "expected/copy.filterset.filtered"); | File check = new File(getProjectDir(), "expected/copy.filterset.filtered"); | ||||
| assertTrue(tmp.exists()); | assertTrue(tmp.exists()); | ||||
| assertTrue(FILE_UTILS.contentEquals(tmp, check)); | assertTrue(FILE_UTILS.contentEquals(tmp, check)); | ||||
| @@ -109,7 +106,7 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testFilterChain() throws IOException { | public void testFilterChain() throws IOException { | ||||
| executeTarget("testFilterChain"); | executeTarget("testFilterChain"); | ||||
| File tmp = new File(getProjectDir(), "copy.filterchain.tmp"); | |||||
| File tmp = new File(getOutputDir(), "copy.filterchain.tmp"); | |||||
| File check = new File(getProjectDir(), "expected/copy.filterset.filtered"); | File check = new File(getProjectDir(), "expected/copy.filterset.filtered"); | ||||
| assertTrue(tmp.exists()); | assertTrue(tmp.exists()); | ||||
| assertTrue(FILE_UTILS.contentEquals(tmp, check)); | assertTrue(FILE_UTILS.contentEquals(tmp, check)); | ||||
| @@ -117,14 +114,14 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testSingleFileFileset() { | public void testSingleFileFileset() { | ||||
| executeTarget("test_single_file_fileset"); | executeTarget("test_single_file_fileset"); | ||||
| File file = new File(getProjectDir(), | |||||
| File file = new File(getOutputDir(), | |||||
| "copytest_single_file_fileset.tmp"); | "copytest_single_file_fileset.tmp"); | ||||
| assertTrue(file.exists()); | assertTrue(file.exists()); | ||||
| } | } | ||||
| public void testSingleFilePath() { | public void testSingleFilePath() { | ||||
| executeTarget("test_single_file_path"); | executeTarget("test_single_file_path"); | ||||
| File file = new File(getProjectDir(), | |||||
| File file = new File(getOutputDir(), | |||||
| "copytest_single_file_path.tmp"); | "copytest_single_file_path.tmp"); | ||||
| assertTrue(file.exists()); | assertTrue(file.exists()); | ||||
| } | } | ||||
| @@ -132,7 +129,7 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testTranscoding() throws IOException { | public void testTranscoding() throws IOException { | ||||
| executeTarget("testTranscoding"); | executeTarget("testTranscoding"); | ||||
| File f1 = getProject().resolveFile("copy/expected/utf-8"); | File f1 = getProject().resolveFile("copy/expected/utf-8"); | ||||
| File f2 = getProject().resolveFile("copytest1.tmp"); | |||||
| File f2 = new File(getOutputDir(), "copytest1.tmp"); | |||||
| assertTrue(FILE_UTILS.contentEquals(f1, f2)); | assertTrue(FILE_UTILS.contentEquals(f1, f2)); | ||||
| } | } | ||||
| @@ -158,9 +155,9 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testFileResourcePlain() { | public void testFileResourcePlain() { | ||||
| executeTarget("testFileResourcePlain"); | executeTarget("testFileResourcePlain"); | ||||
| File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); | |||||
| File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); | |||||
| File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); | |||||
| File file1 = new File(getProject().getProperty("to.dir")+"/file1.txt"); | |||||
| File file2 = new File(getProject().getProperty("to.dir")+"/file2.txt"); | |||||
| File file3 = new File(getProject().getProperty("to.dir")+"/file3.txt"); | |||||
| assertTrue(file1.exists()); | assertTrue(file1.exists()); | ||||
| assertTrue(file2.exists()); | assertTrue(file2.exists()); | ||||
| assertTrue(file3.exists()); | assertTrue(file3.exists()); | ||||
| @@ -168,9 +165,9 @@ public class CopyTest extends BuildFileTest { | |||||
| public void _testFileResourceWithMapper() { | public void _testFileResourceWithMapper() { | ||||
| executeTarget("testFileResourceWithMapper"); | executeTarget("testFileResourceWithMapper"); | ||||
| File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt.bak"); | |||||
| File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt.bak"); | |||||
| File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt.bak"); | |||||
| File file1 = new File(getProject().getProperty("to.dir")+"/file1.txt.bak"); | |||||
| File file2 = new File(getProject().getProperty("to.dir")+"/file2.txt.bak"); | |||||
| File file3 = new File(getProject().getProperty("to.dir")+"/file3.txt.bak"); | |||||
| assertTrue(file1.exists()); | assertTrue(file1.exists()); | ||||
| assertTrue(file2.exists()); | assertTrue(file2.exists()); | ||||
| assertTrue(file3.exists()); | assertTrue(file3.exists()); | ||||
| @@ -178,7 +175,7 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testFileResourceWithFilter() { | public void testFileResourceWithFilter() { | ||||
| executeTarget("testFileResourceWithFilter"); | executeTarget("testFileResourceWithFilter"); | ||||
| File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/fileNR.txt"); | |||||
| File file1 = new File(getProject().getProperty("to.dir")+"/fileNR.txt"); | |||||
| assertTrue(file1.exists()); | assertTrue(file1.exists()); | ||||
| try { | try { | ||||
| String file1Content = FileUtils.readFully(new FileReader(file1)); | String file1Content = FileUtils.readFully(new FileReader(file1)); | ||||
| @@ -190,9 +187,9 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testPathAsResource() { | public void testPathAsResource() { | ||||
| executeTarget("testPathAsResource"); | executeTarget("testPathAsResource"); | ||||
| File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); | |||||
| File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); | |||||
| File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); | |||||
| File file1 = new File(getProject().getProperty("to.dir")+"/file1.txt"); | |||||
| File file2 = new File(getProject().getProperty("to.dir")+"/file2.txt"); | |||||
| File file3 = new File(getProject().getProperty("to.dir")+"/file3.txt"); | |||||
| assertTrue(file1.exists()); | assertTrue(file1.exists()); | ||||
| assertTrue(file2.exists()); | assertTrue(file2.exists()); | ||||
| assertTrue(file3.exists()); | assertTrue(file3.exists()); | ||||
| @@ -200,9 +197,9 @@ public class CopyTest extends BuildFileTest { | |||||
| public void testZipfileset() { | public void testZipfileset() { | ||||
| executeTarget("testZipfileset"); | executeTarget("testZipfileset"); | ||||
| File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); | |||||
| File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); | |||||
| File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); | |||||
| File file1 = new File(getProject().getProperty("to.dir")+"/file1.txt"); | |||||
| File file2 = new File(getProject().getProperty("to.dir")+"/file2.txt"); | |||||
| File file3 = new File(getProject().getProperty("to.dir")+"/file3.txt"); | |||||
| assertTrue(file1.exists()); | assertTrue(file1.exists()); | ||||
| assertTrue(file2.exists()); | assertTrue(file2.exists()); | ||||
| assertTrue(file3.exists()); | assertTrue(file3.exists()); | ||||