git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1585684 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -17,48 +17,50 @@ | |||
| --> | |||
| <project name="depend" basedir="." default="help"> | |||
| <import file="../../../buildfiletest-base.xml"/> | |||
| <target name="setUp"> | |||
| <mkdir dir="${output}" /> | |||
| <property name="tempsrc.dir" value="${output}/tempsrc.dir"/> | |||
| <property name="cache.dir" value="${output}/tempsrc.dir"/> | |||
| <property name="classes.dir" value="${output}/classes"/> | |||
| </target> | |||
| <property name="src1.dir" value="src1"/> | |||
| <property name="src2.dir" value="src2"/> | |||
| <property name="src3.dir" value="src3"/> | |||
| <property name="src4.dir" value="src4"/> | |||
| <property name="src5.dir" value="src5"/> | |||
| <property name="tempsrc.dir" value="working"/> | |||
| <property name="cache.dir" value="working"/> | |||
| <property name="classes.dir" value="classes"/> | |||
| <target name="help"> | |||
| <echo>This buildfile is used as part of Ant's test suite.</echo> | |||
| </target> | |||
| <target name="basesetup" depends="clean"> | |||
| <mkdir dir="${tempsrc.dir}"/> | |||
| </target> | |||
| <target name="src1setup" depends="basesetup"> | |||
| <target name="src1setup" depends="setUp"> | |||
| <copy todir="${tempsrc.dir}"> | |||
| <fileset dir="${src1.dir}"/> | |||
| </copy> | |||
| </target> | |||
| <target name="src2setup" depends="basesetup"> | |||
| <target name="src2setup" depends="setUp"> | |||
| <copy todir="${tempsrc.dir}"> | |||
| <fileset dir="${src2.dir}"/> | |||
| </copy> | |||
| </target> | |||
| <target name="src3setup" depends="basesetup"> | |||
| <target name="src3setup" depends="setUp"> | |||
| <copy todir="${tempsrc.dir}"> | |||
| <fileset dir="${src3.dir}"/> | |||
| </copy> | |||
| </target> | |||
| <target name="src4setup" depends="basesetup"> | |||
| <target name="src4setup" depends="setUp"> | |||
| <copy todir="${tempsrc.dir}"> | |||
| <fileset dir="${src4.dir}"/> | |||
| </copy> | |||
| </target> | |||
| <target name="src5setup" depends="basesetup"> | |||
| <target name="src5setup" depends="setUp"> | |||
| <copy todir="${tempsrc.dir}"> | |||
| <fileset dir="${src5.dir}"/> | |||
| </copy> | |||
| @@ -69,11 +71,6 @@ | |||
| <javac srcdir="${tempsrc.dir}" destdir="${classes.dir}"/> | |||
| </target> | |||
| <target name="clean"> | |||
| <delete dir="${classes.dir}"/> | |||
| <delete dir="${tempsrc.dir}"/> | |||
| </target> | |||
| <target name="testdirect" depends="src1setup, compile"> | |||
| <sleep seconds="3"/> | |||
| <delete file="${tempsrc.dir}/C.java"/> | |||
| @@ -16,30 +16,29 @@ | |||
| limitations under the License. | |||
| --> | |||
| <project name="translate-test" default="test1" basedir="."> | |||
| <property name="input.dir" value="input"/> | |||
| <property name="output.dir" value="output"/> | |||
| <property name="expected.dir" value="expected"/> | |||
| <target name="setup"> | |||
| <mkdir dir="${output.dir}/de"/> | |||
| </target> | |||
| <target name="test1" depends="setup"> | |||
| <translate toDir="${output.dir}/de" | |||
| starttoken="@" | |||
| endtoken="@" | |||
| bundle="${input.dir}/resources" | |||
| bundlecountry="DE" | |||
| bundlelanguage="ger" | |||
| forceoverwrite="yes" | |||
| srcencoding="ISO8859_1" | |||
| destencoding="ISO8859_1" | |||
| bundleencoding="Cp1252"> | |||
| <fileset dir="${input.dir}"> | |||
| <include name="template.txt"/> | |||
| </fileset> | |||
| </translate> | |||
| </target> | |||
| <target name="cleanup"> | |||
| <delete dir="${output.dir}" quiet="true"/> | |||
| </target> | |||
| <property name="input.dir" value="input"/> | |||
| <property name="expected.dir" value="expected"/> | |||
| <import file="../../../../buildfiletest-base.xml"/> | |||
| <target name="setUp"> | |||
| <mkdir dir="${output}/de"/> | |||
| </target> | |||
| <target name="test1" depends="setUp"> | |||
| <translate toDir="${output}/de" | |||
| starttoken="@" | |||
| endtoken="@" | |||
| bundle="${input.dir}/resources" | |||
| bundlecountry="DE" | |||
| bundlelanguage="ger" | |||
| forceoverwrite="yes" | |||
| srcencoding="ISO8859_1" | |||
| destencoding="ISO8859_1" | |||
| bundleencoding="Cp1252"> | |||
| <fileset dir="${input.dir}"> | |||
| <include name="template.txt"/> | |||
| </fileset> | |||
| </translate> | |||
| </target> | |||
| </project> | |||
| @@ -18,59 +18,56 @@ | |||
| <project name="image-test" default="main" basedir="."> | |||
| <target name="main" depends="testSimpleScale"> | |||
| </target> | |||
| <import file="../../../buildfiletest-base.xml"/> | |||
| <target name="init"> | |||
| <property name="src.dir" location="${basedir}/src"/> | |||
| <property name="dest.dir" location="${basedir}/dest"/> | |||
| <mkdir dir="${dest.dir}"/> | |||
| </target> | |||
| <target name="cleanup"> | |||
| <delete dir="${dest.dir}"/> | |||
| </target> | |||
| <!-- this should produce a single file in the dest dir --> | |||
| <target name="testSimpleScale" depends="init"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${dest.dir}" overwrite="no" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <target name="setUp"> | |||
| <mkdir dir="${output}"/> | |||
| <property name="src.dir" location="${basedir}/src"/> | |||
| </target> | |||
| <!-- this should put some text in the log --> | |||
| <target name="testEchoToLog" depends="init"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${dest.dir}" overwrite="no" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <!-- this should produce a single file in the dest dir --> | |||
| <target name="testFailOnError" depends="init"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${dest.dir}" overwrite="no" failonerror="yes"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <!-- this should produce a single file in the dest dir, overwriting any existing file --> | |||
| <target name="testOverwriteTrue" depends="init"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${dest.dir}" overwrite="true" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <target name="main" depends="testSimpleScale"> | |||
| </target> | |||
| <!-- this should not overwrite the existing file --> | |||
| <target name="testOverwriteFalse" depends="init"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${dest.dir}" overwrite="false" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <target name="testSimpleScaleWithMapper" depends="init"> | |||
| <!-- this should produce a single file in the dest dir --> | |||
| <target name="testSimpleScale" depends="setUp"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${output}" overwrite="no" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <!-- this should put some text in the log --> | |||
| <target name="testEchoToLog" depends="setUp"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${output}" overwrite="no" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <!-- this should produce a single file in the dest dir --> | |||
| <target name="testFailOnError" depends="setUp"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${output}" overwrite="no" failonerror="yes"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <!-- this should produce a single file in the dest dir, overwriting any existing file --> | |||
| <target name="testOverwriteTrue" depends="setUp"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${output}" overwrite="true" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <!-- this should not overwrite the existing file --> | |||
| <target name="testOverwriteFalse" depends="setUp"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" destdir="${output}" overwrite="false" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| </image> | |||
| </target> | |||
| <target name="testSimpleScaleWithMapper" depends="setUp"> | |||
| <image includes="*.jpg" srcdir="${src.dir}" | |||
| destdir="${dest.dir}" overwrite="no" failonerror="no"> | |||
| destdir="${output}" overwrite="no" failonerror="no"> | |||
| <scale width="300" proportions="width"/> | |||
| <globmapper from="*" to="scaled-*"/> | |||
| </image> | |||
| </target> | |||
| </image> | |||
| </target> | |||
| </project> | |||
| @@ -46,31 +46,31 @@ | |||
| <property name="delay" value="3"/> | |||
| <property name="tdir" value="${basedir}/test-working"/> | |||
| <import file="../../../buildfiletest-base.xml"/> | |||
| <target name="setup"> | |||
| <delete dir="${tdir}"/> | |||
| <mkdir dir="${tdir}"/> | |||
| <target name="setUp"> | |||
| <mkdir dir="${output}" /> | |||
| </target> | |||
| <target name="all" | |||
| depends="setup, test-single, test-delete, test-record, test-recreate, teardown"/> | |||
| depends="setUp, test-single, test-delete, test-record, test-recreate, tearDown"/> | |||
| <!-- test for action = single --> | |||
| <!-- | |||
| Creates: | |||
| File: ${tdir}/symlink.test | |||
| Link: ${tdir}/singletest | |||
| File: ${output}/symlink.test | |||
| Link: ${output}/singletest | |||
| --> | |||
| <target name="test-single"> | |||
| <touch file="${tdir}/symlink.test"/> | |||
| <symlink resource="${tdir}/symlink.test" | |||
| link="${tdir}/singletest" | |||
| <touch file="${output}/symlink.test"/> | |||
| <symlink resource="${output}/symlink.test" | |||
| link="${output}/singletest" | |||
| failonerror="yes"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <available file="${tdir}/symlink.test" | |||
| <available file="${output}/symlink.test" | |||
| property="test.single.file.created"/> | |||
| <available file="${tdir}/singletest" | |||
| <available file="${output}/singletest" | |||
| property="test.single.link.created"/> | |||
| </target> | |||
| @@ -82,23 +82,23 @@ | |||
| Creates: | |||
| (none) | |||
| Deletes: | |||
| Link: ${tdir}/singletest | |||
| Link: ${output}/singletest | |||
| --> | |||
| <target name="test-delete"> | |||
| <touch file="${tdir}/symlink.test"/> | |||
| <symlink resource="${tdir}/symlink.test" | |||
| link="${tdir}/singletest" | |||
| <touch file="${output}/symlink.test"/> | |||
| <symlink resource="${output}/symlink.test" | |||
| link="${output}/singletest" | |||
| failonerror="yes"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <symlink action="delete" link="${tdir}/singletest" failonerror="yes"/> | |||
| <symlink action="delete" link="${tdir}/symlink.test" failonerror="no"/> | |||
| <symlink action="delete" link="${output}/singletest" failonerror="yes"/> | |||
| <symlink action="delete" link="${output}/symlink.test" failonerror="no"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <available file="${tdir}/symlink.test" | |||
| <available file="${output}/symlink.test" | |||
| property="test.delete.file.still.there"/> | |||
| <available file="${tdir}/singletest" | |||
| <available file="${output}/singletest" | |||
| property="test.delete.link.still.there" | |||
| value="ERROR: link deletion failed"/> | |||
| @@ -110,127 +110,127 @@ | |||
| <!-- | |||
| Creates: | |||
| Dir: ${tdir}/symtest1 | |||
| Dir: ${tdir}/symtest1/symtest2 | |||
| Dir: ${tdir}/symtest1/symtest3 | |||
| File: ${tdir}/symtest1/file1 | |||
| File: ${tdir}/symtest1/symtest2/file2 | |||
| File: ${tdir}/symtest1/symtest3/fileA | |||
| File: ${tdir}/symtest1/symtest3/fileB | |||
| File: ${tdir}/symtest1/symtest3/fileC | |||
| Link: ${tdir}/symtest1/link1==>${tdir}/symtest1/file1 | |||
| Link: ${tdir}/symtest1/link2==>${tdir}/symtest1/symtest2/file2 | |||
| Link: ${tdir}/symtest1/symtest2/link3==> | |||
| ${tdir}/symtest1/symtest2/file2 | |||
| Link: ${tdir}/symtest1/dirlink==>${tdir}/symtest1/symtest3 | |||
| Link: ${tdir}/symtest1/dirlink2==>${tdir}/symtest1/symtest3 | |||
| Link: ${tdir}/symtest1/dirlink3==>${tdir}/symtest1/symtest3 | |||
| File: ${tdir}/symtest1/recorded.links | |||
| File: ${tdir}/symtest1/symtest2/recorded.links | |||
| Dir: ${output}/symtest1 | |||
| Dir: ${output}/symtest1/symtest2 | |||
| Dir: ${output}/symtest1/symtest3 | |||
| File: ${output}/symtest1/file1 | |||
| File: ${output}/symtest1/symtest2/file2 | |||
| File: ${output}/symtest1/symtest3/fileA | |||
| File: ${output}/symtest1/symtest3/fileB | |||
| File: ${output}/symtest1/symtest3/fileC | |||
| Link: ${output}/symtest1/link1==>${output}/symtest1/file1 | |||
| Link: ${output}/symtest1/link2==>${output}/symtest1/symtest2/file2 | |||
| Link: ${output}/symtest1/symtest2/link3==> | |||
| ${output}/symtest1/symtest2/file2 | |||
| Link: ${output}/symtest1/dirlink==>${output}/symtest1/symtest3 | |||
| Link: ${output}/symtest1/dirlink2==>${output}/symtest1/symtest3 | |||
| Link: ${output}/symtest1/dirlink3==>${output}/symtest1/symtest3 | |||
| File: ${output}/symtest1/recorded.links | |||
| File: ${output}/symtest1/symtest2/recorded.links | |||
| Deletes: | |||
| (none) | |||
| --> | |||
| <target name="test-record"> | |||
| <mkdir dir="${tdir}/symtest1"/> | |||
| <mkdir dir="${tdir}/symtest1/symtest2"/> | |||
| <mkdir dir="${tdir}/symtest1/symtest3"/> | |||
| <touch file="${tdir}/symtest1/file1"/> | |||
| <touch file="${tdir}/symtest1/symtest2/file2"/> | |||
| <mkdir dir="${output}/symtest1"/> | |||
| <mkdir dir="${output}/symtest1/symtest2"/> | |||
| <mkdir dir="${output}/symtest1/symtest3"/> | |||
| <touch file="${output}/symtest1/file1"/> | |||
| <touch file="${output}/symtest1/symtest2/file2"/> | |||
| <touch file="${tdir}/symtest1/symtest3/fileA"/> | |||
| <touch file="${tdir}/symtest1/symtest3/fileB"/> | |||
| <touch file="${tdir}/symtest1/symtest3/fileC"/> | |||
| <touch file="${output}/symtest1/symtest3/fileA"/> | |||
| <touch file="${output}/symtest1/symtest3/fileB"/> | |||
| <touch file="${output}/symtest1/symtest3/fileC"/> | |||
| <symlink resource="${tdir}/symtest1/file1" | |||
| link="${tdir}/symtest1/link1" | |||
| <symlink resource="${output}/symtest1/file1" | |||
| link="${output}/symtest1/link1" | |||
| failonerror="no" /> | |||
| <symlink resource="${tdir}/symtest1/symtest2/file2" | |||
| link="${tdir}/symtest1/link2" | |||
| <symlink resource="${output}/symtest1/symtest2/file2" | |||
| link="${output}/symtest1/link2" | |||
| failonerror="no" /> | |||
| <symlink resource="${tdir}/symtest1/symtest2/file2" | |||
| link="${tdir}/symtest1/symtest2/link3" | |||
| <symlink resource="${output}/symtest1/symtest2/file2" | |||
| link="${output}/symtest1/symtest2/link3" | |||
| failonerror="no" /> | |||
| <symlink resource="${tdir}/symtest1/symtest3" | |||
| link="${tdir}/symtest1/dirlink" | |||
| <symlink resource="${output}/symtest1/symtest3" | |||
| link="${output}/symtest1/dirlink" | |||
| failonerror="no" /> | |||
| <symlink resource="${tdir}/symtest1/symtest3" | |||
| link="${tdir}/symtest1/dirlink2" | |||
| <symlink resource="${output}/symtest1/symtest3" | |||
| link="${output}/symtest1/dirlink2" | |||
| failonerror="no"/> | |||
| <symlink resource="${tdir}/symtest1/symtest3" | |||
| link="${tdir}/symtest1/dirlink3" | |||
| <symlink resource="${output}/symtest1/symtest3" | |||
| link="${output}/symtest1/dirlink3" | |||
| failonerror="no"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <symlink action="record" linkfilename="recorded.links"> | |||
| <fileset dir="${tdir}/symtest1" includes="**/**"/> | |||
| <fileset dir="${output}/symtest1" includes="**/**"/> | |||
| </symlink> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <!-- Test to see if the directories were created --> | |||
| <available file="${tdir}/symtest1" | |||
| <available file="${output}/symtest1" | |||
| type="dir" | |||
| property="test.record.dir1.created"/> | |||
| <available file="${tdir}/symtest1/symtest2" | |||
| <available file="${output}/symtest1/symtest2" | |||
| type="dir" | |||
| property="test.record.dir2.created"/> | |||
| <available file="${tdir}/symtest1/symtest3" | |||
| <available file="${output}/symtest1/symtest3" | |||
| type="dir" | |||
| property="test.record.dir3.created"/> | |||
| <!-- Test to see if the Files were created --> | |||
| <available file="${tdir}/symtest1/file1" | |||
| <available file="${output}/symtest1/file1" | |||
| property="test.record.file1.created"/> | |||
| <available file="${tdir}/symtest1/symtest2/file2" | |||
| <available file="${output}/symtest1/symtest2/file2" | |||
| property="test.record.file2.created"/> | |||
| <available file="${tdir}/symtest1/symtest3/fileA" | |||
| <available file="${output}/symtest1/symtest3/fileA" | |||
| property="test.record.fileA.created"/> | |||
| <available file="${tdir}/symtest1/symtest3/fileB" | |||
| <available file="${output}/symtest1/symtest3/fileB" | |||
| property="test.record.fileB.created"/> | |||
| <available file="${tdir}/symtest1/symtest3/fileC" | |||
| <available file="${output}/symtest1/symtest3/fileC" | |||
| property="test.record.fileC.created"/> | |||
| <!-- Test to see if the links were created --> | |||
| <available file="${tdir}/symtest1/link1" | |||
| <available file="${output}/symtest1/link1" | |||
| property="test.record.link1.created"/> | |||
| <available file="${tdir}/symtest1/link2" | |||
| <available file="${output}/symtest1/link2" | |||
| property="test.record.link2.created"/> | |||
| <available file="${tdir}/symtest1/symtest2/link3" | |||
| <available file="${output}/symtest1/symtest2/link3" | |||
| property="test.record.link3.created"/> | |||
| <available file="${tdir}/symtest1/dirlink" | |||
| <available file="${output}/symtest1/dirlink" | |||
| property="test.record.dirlink.created"/> | |||
| <!-- this is redundant for this test, but used in the recreate test --> | |||
| <available file="${tdir}/symtest1/dirlink2" | |||
| <available file="${output}/symtest1/dirlink2" | |||
| property="test.record.dirlink2.created"/> | |||
| <!-- Test to see if the linkfiles were created --> | |||
| <available file="${tdir}/symtest1/recorded.links" | |||
| <available file="${output}/symtest1/recorded.links" | |||
| property="test.record.dir1.recorded"/> | |||
| <available file="${tdir}/symtest1/symtest2/recorded.links" | |||
| <available file="${output}/symtest1/symtest2/recorded.links" | |||
| property="test.record.dir2.recorded"/> | |||
| <!-- THIS should not be set --> | |||
| <available file="${tdir}/symtest1/symtest3/recorded.links" | |||
| <available file="${output}/symtest1/symtest3/recorded.links" | |||
| property="test.record.dir3.recorded" | |||
| value="ERROR: symtest3/recorded.links should not exist"/> | |||
| @@ -241,95 +241,95 @@ | |||
| <!-- | |||
| Deletes: | |||
| Link: ${tdir}/symtest1/link1==>${tdir}/symtest1/file1 | |||
| Link: ${tdir}/symtest1/link2==>${tdir}/symtest1/symtest2/file2 | |||
| Link: ${tdir}/symtest1/symtest2/link3==> | |||
| ${tdir}/symtest1/symtest2/file2 | |||
| Link: ${tdir}/symtest1/dirlink==>${tdir}/symtest1/symtest3 | |||
| Link: ${tdir}/symtest1/dirlink3==>${tdir}/symtest1/symtest3 | |||
| Link: ${output}/symtest1/link1==>${output}/symtest1/file1 | |||
| Link: ${output}/symtest1/link2==>${output}/symtest1/symtest2/file2 | |||
| Link: ${output}/symtest1/symtest2/link3==> | |||
| ${output}/symtest1/symtest2/file2 | |||
| Link: ${output}/symtest1/dirlink==>${output}/symtest1/symtest3 | |||
| Link: ${output}/symtest1/dirlink3==>${output}/symtest1/symtest3 | |||
| Creates | |||
| Link: ${tdir}/symtest1/dirlink3==>${tdir}/symtest1/symtest2 | |||
| Link: ${output}/symtest1/dirlink3==>${output}/symtest1/symtest2 | |||
| Recreates: | |||
| Link: ${tdir}/symtest1/link1==>${tdir}/symtest1/file1 | |||
| Link: ${tdir}/symtest1/link2==>${tdir}/symtest1/symtest2/file2 | |||
| Link: ${tdir}/symtest1/symtest2/link3==> | |||
| ${tdir}/symtest1/symtest2/file2 | |||
| Link: ${tdir}/symtest1/dirlink==>${tdir}/symtest1/symtest3 | |||
| Link: ${output}/symtest1/link1==>${output}/symtest1/file1 | |||
| Link: ${output}/symtest1/link2==>${output}/symtest1/symtest2/file2 | |||
| Link: ${output}/symtest1/symtest2/link3==> | |||
| ${output}/symtest1/symtest2/file2 | |||
| Link: ${output}/symtest1/dirlink==>${output}/symtest1/symtest3 | |||
| Should Change: | |||
| Link: ${tdir}/symtest1/dirlink3==>${tdir}/symtest1/symtest2 | |||
| Link: ${output}/symtest1/dirlink3==>${output}/symtest1/symtest2 | |||
| to | |||
| ${tdir}/symtest1/dirlink3==>${tdir}/symtest1/symtest3 | |||
| ${output}/symtest1/dirlink3==>${output}/symtest1/symtest3 | |||
| Should Not Create (bug 25181): | |||
| Link: ${tdir}/symtest1/symtest3/dirlink2==>${tdir}/symtest1/symtest3 | |||
| Link: ${output}/symtest1/symtest3/dirlink2==>${output}/symtest1/symtest3 | |||
| --> | |||
| <target name="test-recreate" depends="test-record"> | |||
| <symlink action="delete" link="${tdir}/symtest1/link1"/> | |||
| <symlink action="delete" link="${tdir}/symtest1/link2"/> | |||
| <symlink action="delete" link="${tdir}/symtest1/symtest2/link3"/> | |||
| <symlink action="delete" link="${tdir}/symtest1/dirlink"/> | |||
| <symlink action="delete" link="${output}/symtest1/link1"/> | |||
| <symlink action="delete" link="${output}/symtest1/link2"/> | |||
| <symlink action="delete" link="${output}/symtest1/symtest2/link3"/> | |||
| <symlink action="delete" link="${output}/symtest1/dirlink"/> | |||
| <!-- dirlink2 intentionally not deleted to test bug 25181 --> | |||
| <symlink action="delete" link="${tdir}/symtest1/dirlink3"/> | |||
| <symlink action="delete" link="${output}/symtest1/dirlink3"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <symlink resource="${tdir}/symtest1/symtest2" | |||
| link="${tdir}/symtest1/dirlink3" | |||
| <symlink resource="${output}/symtest1/symtest2" | |||
| link="${output}/symtest1/dirlink3" | |||
| failonerror="no"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <available file="${tdir}/symtest1/link1" | |||
| <available file="${output}/symtest1/link1" | |||
| property="test.recreate.link1.not.removed" | |||
| value="ERROR: rm -f symtest1/link1 failed"/> | |||
| <available file="${tdir}/symtest1/link2" | |||
| <available file="${output}/symtest1/link2" | |||
| property="test.recreate.link2.not.removed" | |||
| value="ERROR: rm -f symtest1/link2 failed"/> | |||
| <available file="${tdir}/symtest1/symtest2/link3" | |||
| <available file="${output}/symtest1/symtest2/link3" | |||
| property="test.recreate.link3.not.removed" | |||
| value="ERROR: rm -f symtest1/symtest2/link3 failed"/> | |||
| <available file="${tdir}/symtest1/zdirlink" | |||
| <available file="${output}/symtest1/zdirlink" | |||
| property="test.recreate.zdirlink.not.removed" | |||
| value="ERROR: rm -f symtest1/zdirlink failed"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to do the execs --> | |||
| <symlink action="recreate"> | |||
| <fileset dir="${tdir}/symtest1" includes="**/recorded.links"/> | |||
| <fileset dir="${output}/symtest1" includes="**/recorded.links"/> | |||
| </symlink> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to catch up --> | |||
| <available file="${tdir}/symtest1/link1" | |||
| <available file="${output}/symtest1/link1" | |||
| property="test.recreate.link1.recreated"/> | |||
| <available file="${tdir}/symtest1/link2" | |||
| <available file="${output}/symtest1/link2" | |||
| property="test.recreate.link2.recreated"/> | |||
| <available file="${tdir}/symtest1/symtest2/link3" | |||
| <available file="${output}/symtest1/symtest2/link3" | |||
| property="test.recreate.link3.recreated"/> | |||
| <available file="${tdir}/symtest1/dirlink" | |||
| <available file="${output}/symtest1/dirlink" | |||
| property="test.recreate.dirlink.recreated"/> | |||
| <!-- this should not get set --> | |||
| <available file="${tdir}/symtest1/symtest3/symtest3" | |||
| <available file="${output}/symtest1/symtest3/symtest3" | |||
| property="test.recreate.dirlink2.recreated.twice" | |||
| value="ERROR: dirlink2 was created a second time (bug 25181)"/> | |||
| <touch file="${tdir}/symtest1/dirlink3/WhereAmI"/> | |||
| <touch file="${output}/symtest1/dirlink3/WhereAmI"/> | |||
| <sleep seconds="${delay}"/> <!-- make sure OS has time to do the execs --> | |||
| <available file="${tdir}/symtest1/symtest3/WhereAmI" | |||
| <available file="${output}/symtest1/symtest3/WhereAmI" | |||
| property="test.recreate.dirlink3.was.altered"/> | |||
| </target> | |||
| @@ -337,23 +337,18 @@ | |||
| <!-- actually tests the symlink methods in FileUtils, but this | |||
| testfixture already has all the necessary envirnment in place | |||
| --> | |||
| <target name="test-fileutils" depends="setup"> | |||
| <mkdir dir="${tdir}/dir1"/> | |||
| <mkdir dir="${tdir}/dir2"/> | |||
| <touch file="${tdir}/file1"/> | |||
| <touch file="${tdir}/file2"/> | |||
| <symlink link="${tdir}/dir.there" resource="${tdir}/dir1"/> | |||
| <symlink link="${tdir}/dir.notthere" resource="${tdir}/dir2"/> | |||
| <symlink link="${tdir}/file.there" resource="${tdir}/file1"/> | |||
| <symlink link="${tdir}/file.notthere" resource="${tdir}/file2"/> | |||
| <delete dir="${tdir}/dir2"/> | |||
| <delete file="${tdir}/file2"/> | |||
| <target name="test-fileutils" depends="setUp"> | |||
| <mkdir dir="${output}/dir1"/> | |||
| <mkdir dir="${output}/dir2"/> | |||
| <touch file="${output}/file1"/> | |||
| <touch file="${output}/file2"/> | |||
| <symlink link="${output}/dir.there" resource="${output}/dir1"/> | |||
| <symlink link="${output}/dir.notthere" resource="${output}/dir2"/> | |||
| <symlink link="${output}/file.there" resource="${output}/file1"/> | |||
| <symlink link="${output}/file.notthere" resource="${output}/file2"/> | |||
| <delete dir="${output}/dir2"/> | |||
| <delete file="${output}/file2"/> | |||
| </target> | |||
| <!-- CALL THIS to clean things up afterwards --> | |||
| <target name="teardown"> | |||
| <delete dir="${tdir}"/> | |||
| </target> | |||
| </project> | |||
| @@ -15,20 +15,23 @@ | |||
| See the License for the specific language governing permissions and | |||
| limitations under the License. | |||
| --> | |||
| <project name="rmic" default="teardown" basedir="."> | |||
| <project name="rmic" default="tearDown" basedir="."> | |||
| <property name="rmic.dir" location="." /> | |||
| <property name="src.dir" location="${rmic.dir}/src"/> | |||
| <property name="build.dir" location="${java.io.tmpdir}/build"/> | |||
| <property name="dest.dir" location="${java.io.tmpdir}/dest"/> | |||
| <target name="teardown"> | |||
| <delete dir="${build.dir}"/> | |||
| <delete dir="${dest.dir}"/> | |||
| <import file="../../buildfiletest-base.xml"/> | |||
| <target name="setUp"> | |||
| <mkdir dir="${output}" /> | |||
| <property name="build.dir" location="${output}/build"/> | |||
| <property name="dest.dir" location="${output}/dest"/> | |||
| </target> | |||
| <!-- init builds the java source --> | |||
| <target name="init" depends="probe-rmic"> | |||
| <target name="init" depends="probe-rmic,setUp"> | |||
| <mkdir dir="${build.dir}"/> | |||
| <mkdir dir="${dest.dir}"/> | |||
| @@ -16,59 +16,55 @@ | |||
| limitations under the License. | |||
| --> | |||
| <project name="xslt-test" basedir="." default="nothing"> | |||
| <project name="xslt-test" basedir="." default="tearDown"> | |||
| <property name="out.dir" value="out"/> | |||
| <import file="../../buildfiletest-base.xml"/> | |||
| <target name="setup"> | |||
| <target name="setUp"> | |||
| <mkdir dir="${output}" /> | |||
| </target> | |||
| <target name="teardown"> | |||
| <delete dir="${out.dir}" failonerror="false" /> | |||
| </target> | |||
| <target name="testStyleIsSet"> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml"/> | |||
| <xslt in="data.xml" out="${output}/out.xml"/> | |||
| </target> | |||
| <target name="testTransferParameterSet"> | |||
| <property name="value" value="myvalue"/> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl"> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="printParams.xsl"> | |||
| <param name="set" expression="${value}"/> | |||
| </xslt> | |||
| </target> | |||
| <target name="testTransferParameterEmpty"> | |||
| <property name="value" value=""/> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl"> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="printParams.xsl"> | |||
| <param name="empty" expression="${value}"/> | |||
| </xslt> | |||
| </target> | |||
| <target name="testTransferParameterUnset"> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl"> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="printParams.xsl"> | |||
| <param name="undefined" expression="${value}"/> | |||
| </xslt> | |||
| </target> | |||
| <target name="testTransferParameterUnsetWithIf"> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl"> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="printParams.xsl"> | |||
| <param name="undefined" expression="${value}" if="value" /> | |||
| </xslt> | |||
| </target> | |||
| <target name="testDefaultMapper"> | |||
| <property name="value" value="myvalue"/> | |||
| <xslt style="printParams.xsl" destDir="${out.dir}" basedir="."> | |||
| <xslt style="printParams.xsl" destDir="${output}" basedir="."> | |||
| <param name="set" expression="${value}"/> | |||
| </xslt> | |||
| </target> | |||
| <target name="testCustomMapper"> | |||
| <property name="value" value="myvalue"/> | |||
| <xslt style="printParams.xsl" destDir="${out.dir}" basedir="."> | |||
| <xslt style="printParams.xsl" destDir="${output}" basedir="."> | |||
| <param name="set" expression="${value}"/> | |||
| <mapper type="glob" from="data.*" to="out.*"/> | |||
| </xslt> | |||
| @@ -76,7 +72,7 @@ | |||
| <target name="testTypedMapper"> | |||
| <property name="value" value="myvalue"/> | |||
| <xslt style="printParams.xsl" destDir="${out.dir}" basedir="."> | |||
| <xslt style="printParams.xsl" destDir="${output}" basedir="."> | |||
| <param name="set" expression="${value}"/> | |||
| <globmapper from="data.*" to="out.*"/> | |||
| </xslt> | |||
| @@ -84,7 +80,7 @@ | |||
| <target name="testExplicitFileset"> | |||
| <property name="value" value="myvalue"/> | |||
| <xslt style="printParams.xsl" destDir="${out.dir}" | |||
| <xslt style="printParams.xsl" destDir="${output}" | |||
| useImplicitFileset="false" basedir=".."> | |||
| <param name="set" expression="${value}"/> | |||
| <fileset dir="."/> | |||
| @@ -95,26 +91,26 @@ | |||
| <antcall target="copyXsl"> | |||
| <param name="xsl.value" value="old-value"/> | |||
| </antcall> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="tmp.xsl"/> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="tmp.xsl"/> | |||
| <antcall target="copyXsl"> | |||
| <param name="xsl.value" value="new-value"/> | |||
| </antcall> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="tmp.xsl"/> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="tmp.xsl"/> | |||
| <delete file="tmp.xsl"/> | |||
| </target> | |||
| <target name="testDirectoryHierarchyWithDirMatching"> | |||
| <mkdir dir="${out.dir}/src/level1/"/> | |||
| <copy file="data.xml" todir="${out.dir}/src/level1/"/> | |||
| <xslt basedir="${out.dir}/src" destdir="${out.dir}/dest" | |||
| <mkdir dir="${output}/src/level1/"/> | |||
| <copy file="data.xml" todir="${output}/src/level1/"/> | |||
| <xslt basedir="${output}/src" destdir="${output}/dest" | |||
| style="printParams.xsl"/> | |||
| </target> | |||
| <target name="testDirsWithSpaces"> | |||
| <mkdir dir="${out.dir}/s rc/"/> | |||
| <copy file="data.xml" todir="${out.dir}/s rc/"/> | |||
| <xslt basedir="${out.dir}/s rc" destdir="${out.dir}/d est" | |||
| <mkdir dir="${output}/s rc/"/> | |||
| <copy file="data.xml" todir="${output}/s rc/"/> | |||
| <xslt basedir="${output}/s rc" destdir="${output}/d est" | |||
| style="printParams.xsl"/> | |||
| </target> | |||
| @@ -127,13 +123,13 @@ | |||
| <target name="testWithStyleAttrAndResource"> | |||
| <!-- also testing style as resources, with refid --> | |||
| <file id="xslFile" file="printParams.xsl"/> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml" style="printParams.xsl"> | |||
| <xslt in="data.xml" out="${output}/out.xml" style="printParams.xsl"> | |||
| <style refid="xslFile" /> | |||
| </xslt> | |||
| </target> | |||
| <target name="testWithFileResource"> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml"> | |||
| <xslt in="data.xml" out="${output}/out.xml"> | |||
| <style> | |||
| <file file="printParams.xsl"/> | |||
| </style> | |||
| @@ -143,7 +139,7 @@ | |||
| <target name="testWithUrlResource"> | |||
| <makeurl file="printParams.xsl" property="printParams.xsl.url"/> | |||
| <xslt in="data.xml" out="${out.dir}/out.xml"> | |||
| <xslt in="data.xml" out="${output}/out.xml"> | |||
| <style> | |||
| <url url="${printParams.xsl.url}"/> | |||
| </style> | |||
| @@ -152,15 +148,14 @@ | |||
| </target> | |||
| <target name="testFilenameAndFiledirAsParam"> | |||
| <mkdir dir="${out.dir}/xml/dir"/> | |||
| <mkdir dir="${out.dir}/out"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/one.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/two.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/three.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/dir/four.xml"/> | |||
| <mkdir dir="${output}/xml/dir"/> | |||
| <copy file="data.xml" tofile="${output}/xml/one.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/two.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/three.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/dir/four.xml"/> | |||
| <xslt style="printFilename.xsl" | |||
| destdir="${out.dir}/out" | |||
| basedir="${out.dir}/xml" | |||
| destdir="${output}" | |||
| basedir="${output}/xml" | |||
| includes="**/*.xml" | |||
| extension=".txt" | |||
| @@ -170,15 +165,14 @@ | |||
| </target> | |||
| <target name="testFilenameAsParam"> | |||
| <mkdir dir="${out.dir}/xml/dir"/> | |||
| <mkdir dir="${out.dir}/out"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/one.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/two.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/three.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/dir/four.xml"/> | |||
| <mkdir dir="${output}/xml/dir"/> | |||
| <copy file="data.xml" tofile="${output}/xml/one.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/two.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/three.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/dir/four.xml"/> | |||
| <xslt style="printFilename.xsl" | |||
| destdir="${out.dir}/out" | |||
| basedir="${out.dir}/xml" | |||
| destdir="${output}" | |||
| basedir="${output}/xml" | |||
| includes="**/*.xml" | |||
| extension=".txt" | |||
| @@ -187,15 +181,14 @@ | |||
| </target> | |||
| <target name="testFilenameAsParamNoSetting"> | |||
| <mkdir dir="${out.dir}/xml/dir"/> | |||
| <mkdir dir="${out.dir}/out"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/one.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/two.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/three.xml"/> | |||
| <copy file="data.xml" tofile="${out.dir}/xml/dir/four.xml"/> | |||
| <mkdir dir="${output}/xml/dir"/> | |||
| <copy file="data.xml" tofile="${output}/xml/one.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/two.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/three.xml"/> | |||
| <copy file="data.xml" tofile="${output}/xml/dir/four.xml"/> | |||
| <xslt style="printFilename.xsl" | |||
| destdir="${out.dir}/out" | |||
| basedir="${out.dir}/xml" | |||
| destdir="${output}" | |||
| basedir="${output}/xml" | |||
| includes="**/*.xml" | |||
| extension=".txt" | |||
| /> <!-- without 'filenameparameter' to check, that the xsl:param is NOT set --> | |||
| @@ -44,13 +44,6 @@ public class RmicAdvancedTest extends BuildFileTest { | |||
| configureProject(TASKDEFS_DIR + "rmic.xml"); | |||
| } | |||
| /** | |||
| * The teardown method for JUnit | |||
| */ | |||
| public void tearDown() { | |||
| executeTarget("teardown"); | |||
| } | |||
| /** | |||
| * verify that "default" binds us to the default compiler | |||
| */ | |||
| @@ -18,6 +18,7 @@ | |||
| package org.apache.tools.ant.taskdefs; | |||
| import java.io.File; | |||
| import java.io.FileReader; | |||
| import java.io.IOException; | |||
| import java.io.Reader; | |||
| @@ -45,10 +46,6 @@ public class StyleTest extends BuildFileTest { | |||
| //commented out for performance while target is empty | |||
| } | |||
| protected void tearDown() throws Exception { | |||
| executeTarget("teardown"); | |||
| } | |||
| public void testStyleIsSet() throws Exception { | |||
| expectSpecificBuildException("testStyleIsSet", | |||
| "no stylesheet specified", "specify the " + | |||
| @@ -58,31 +55,31 @@ public class StyleTest extends BuildFileTest { | |||
| public void testTransferParameterSet() throws Exception { | |||
| expectFileContains("testTransferParameterSet", // target | |||
| "out/out.xml", // file | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", // file | |||
| "set='myvalue'"); // exptected string | |||
| } | |||
| public void testTransferParameterEmpty() throws Exception { | |||
| expectFileContains("testTransferParameterEmpty", | |||
| "out/out.xml", | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", | |||
| "empty=''"); | |||
| } | |||
| public void testTransferParameterUnset() throws Exception { | |||
| expectFileContains("testTransferParameterUnset", | |||
| "out/out.xml", | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", | |||
| "undefined='${value}'"); | |||
| } | |||
| public void testTransferParameterUnsetWithIf() throws Exception { | |||
| expectFileContains("testTransferParameterUnsetWithIf", | |||
| "out/out.xml", | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", | |||
| "undefined='undefined default value'"); | |||
| } | |||
| public void testNewerStylesheet() throws Exception { | |||
| expectFileContains("testNewerStylesheet", | |||
| "out/out.xml", | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", | |||
| "new-value"); | |||
| } | |||
| @@ -95,40 +92,36 @@ public class StyleTest extends BuildFileTest { | |||
| } | |||
| public void testDefaultMapper(String target) throws Exception { | |||
| assertTrue(!(FileUtils.getFileUtils().resolveFile( | |||
| getProject().getBaseDir(),"out/data.html")).exists()); | |||
| assertTrue(!( | |||
| new File(getOutputDir().getAbsoluteFile(), "data.html").exists())); | |||
| expectFileContains(target, | |||
| "out/data.html", | |||
| getOutputDir().getAbsoluteFile() + "/data.html", | |||
| "set='myvalue'"); | |||
| } | |||
| public void testCustomMapper() throws Exception { | |||
| assertTrue(!FILE_UTILS.resolveFile( | |||
| getProject().getBaseDir(), "out/out.xml").exists()); | |||
| assertTrue(!new File(getOutputDir().getAbsoluteFile(), "out.xml").exists()); | |||
| expectFileContains("testCustomMapper", | |||
| "out/out.xml", | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", | |||
| "set='myvalue'"); | |||
| } | |||
| public void testTypedMapper() throws Exception { | |||
| assertTrue(!FILE_UTILS.resolveFile( | |||
| getProject().getBaseDir(), "out/out.xml").exists()); | |||
| assertTrue(!new File(getOutputDir().getAbsoluteFile(), "out.xml").exists()); | |||
| expectFileContains("testTypedMapper", | |||
| "out/out.xml", | |||
| getOutputDir().getAbsoluteFile() + "/out.xml", | |||
| "set='myvalue'"); | |||
| } | |||
| public void testDirectoryHierarchyWithDirMatching() throws Exception { | |||
| executeTarget("testDirectoryHierarchyWithDirMatching"); | |||
| assertTrue(FILE_UTILS.resolveFile( | |||
| getProject().getBaseDir(), "out/dest/level1/data.html") | |||
| assertTrue(new File(getOutputDir().getAbsoluteFile(), "dest/level1/data.html") | |||
| .exists()); | |||
| } | |||
| public void testDirsWithSpaces() throws Exception { | |||
| executeTarget("testDirsWithSpaces"); | |||
| assertTrue(FILE_UTILS.resolveFile( | |||
| getProject().getBaseDir(), "out/d est/data.html") | |||
| assertTrue(new File(getOutputDir().getAbsoluteFile(), "d est/data.html") | |||
| .exists()); | |||
| } | |||
| @@ -141,36 +134,36 @@ public class StyleTest extends BuildFileTest { | |||
| } | |||
| public void testWithFileResource() throws Exception { | |||
| expectFileContains("testWithFileResource", "out/out.xml", "set='value'"); | |||
| expectFileContains("testWithFileResource", getOutputDir().getAbsoluteFile() + "/out.xml", "set='value'"); | |||
| } | |||
| public void testWithUrlResource() throws Exception { | |||
| expectFileContains("testWithUrlResource", "out/out.xml", "set='value'"); | |||
| expectFileContains("testWithUrlResource", getOutputDir().getAbsoluteFile() + "/out.xml", "set='value'"); | |||
| } | |||
| public void testFilenameAsParam() throws Exception { | |||
| executeTarget("testFilenameAsParam"); | |||
| assertFileContains("out/out/one.txt", "filename='one.xml'"); | |||
| assertFileContains("out/out/two.txt", "filename='two.xml'"); | |||
| assertFileContains("out/out/three.txt", "filename='three.xml'"); | |||
| assertFileContains("out/out/dir/four.txt", "filename='four.xml'"); | |||
| assertFileContains("out/out/dir/four.txt", "filedir ='-not-set-'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/one.txt", "filename='one.xml'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/two.txt", "filename='two.xml'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/three.txt", "filename='three.xml'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/dir/four.txt", "filename='four.xml'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/dir/four.txt", "filedir ='-not-set-'"); | |||
| } | |||
| public void testFilenameAsParamNoSetting() throws Exception { | |||
| executeTarget("testFilenameAsParamNoSetting"); | |||
| assertFileContains("out/out/one.txt", "filename='-not-set-'"); | |||
| assertFileContains("out/out/two.txt", "filename='-not-set-'"); | |||
| assertFileContains("out/out/three.txt", "filename='-not-set-'"); | |||
| assertFileContains("out/out/dir/four.txt", "filename='-not-set-'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/one.txt", "filename='-not-set-'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/two.txt", "filename='-not-set-'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/three.txt", "filename='-not-set-'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/dir/four.txt", "filename='-not-set-'"); | |||
| } | |||
| public void testFilenameAndFiledirAsParam() throws Exception { | |||
| executeTarget("testFilenameAndFiledirAsParam"); | |||
| assertFileContains("out/out/one.txt", "filename='one.xml'"); | |||
| assertFileContains("out/out/one.txt", "filedir ='.'"); | |||
| assertFileContains("out/out/dir/four.txt", "filename='four.xml'"); | |||
| assertFileContains("out/out/dir/four.txt", "filedir ='dir'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/one.txt", "filename='one.xml'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/one.txt", "filedir ='.'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/dir/four.txt", "filename='four.xml'"); | |||
| assertFileContains(getOutputDir().getAbsoluteFile() + "/dir/four.txt", "filedir ='dir'"); | |||
| } | |||
| @@ -42,10 +42,6 @@ public class DependTest extends BuildFileTest { | |||
| configureProject(TEST_BUILD_FILE); | |||
| } | |||
| public void tearDown() { | |||
| executeTarget("clean"); | |||
| } | |||
| /** | |||
| * Test direct dependency removal | |||
| */ | |||
| @@ -43,27 +43,21 @@ public class TranslateTest extends BuildFileTest { | |||
| configureProject(TASKDEFS_DIR + "/translate.xml"); | |||
| } | |||
| public void tearDown() { | |||
| executeTarget("cleanup"); | |||
| } | |||
| public void test1() { | |||
| executeTarget("test1"); | |||
| assertTrue("translation of "+ TASKDEFS_DIR + "/input/template.txt",compareFiles(TASKDEFS_DIR+"/expected/de/template.txt",TASKDEFS_DIR+"/output/de/template.txt")); | |||
| assertTrue("translation of "+ TASKDEFS_DIR + "/input/template.txt",compareFiles(new File(getProjectDir(), "expected/de/template.txt"), | |||
| new File(getOutputDir(), "de/template.txt"))); | |||
| } | |||
| private boolean compareFiles(String name1, String name2) { | |||
| File file1 = new File(System.getProperty("root"), name1); | |||
| File file2 = new File(System.getProperty("root"), name2); | |||
| private boolean compareFiles(File file1, File file2) { | |||
| try { | |||
| if (!file1.exists() || !file2.exists()) { | |||
| System.out.println("One or both files do not exist:" + name1 + ", " + name2); | |||
| System.out.println("One or both files do not exist:" + file1.getAbsoluteFile() + ", " + file2.getAbsoluteFile()); | |||
| return false; | |||
| } | |||
| if (file1.length() != file2.length()) { | |||
| System.out.println("File size mismatch:" + name1 + "(" + file1.length() + "), " + | |||
| name2 + "(" + file2.length() + ")"); | |||
| System.out.println("File size mismatch:" + file1.getAbsoluteFile() + "(" + file1.length() + "), " + | |||
| file2.getAbsoluteFile() + "(" + file2.length() + ")"); | |||
| return false; | |||
| } | |||
| @@ -79,7 +73,7 @@ public class TranslateTest extends BuildFileTest { | |||
| fis2.read(buffer2); | |||
| for (int i = 0; i < read; ++i, ++index) { | |||
| if (buffer1[i] != buffer2[i]) { | |||
| System.out.println("Bytes mismatch:" + name1 + ", " + name2 + | |||
| System.out.println("Bytes mismatch:" + file1.getAbsoluteFile() + ", " + file2.getAbsoluteFile() + | |||
| " at byte " + index); | |||
| return false; | |||
| } | |||
| @@ -88,7 +82,7 @@ public class TranslateTest extends BuildFileTest { | |||
| return true; | |||
| } | |||
| catch (IOException e) { | |||
| System.out.println("IOException comparing files: " + name1 + ", " + name2); | |||
| System.out.println("IOException comparing files: " + file1.getAbsoluteFile() + ", " + file2.getAbsoluteFile()); | |||
| return false; | |||
| } | |||
| } | |||
| @@ -47,17 +47,13 @@ public class ImageTest extends BuildFileTest { | |||
| } | |||
| public void tearDown() { | |||
| executeTarget("cleanup"); | |||
| } | |||
| public void testEchoToLog() { | |||
| expectLogContaining("testEchoToLog", "Processing File"); | |||
| } | |||
| public void testSimpleScale(){ | |||
| expectLogContaining("testSimpleScale", "Processing File"); | |||
| File f = createRelativeFile("/dest/" + LARGEIMAGE); | |||
| File f = new File(getOutputDir(), LARGEIMAGE); | |||
| assertTrue( | |||
| "Did not create "+f.getAbsolutePath(), | |||
| f.exists()); | |||
| @@ -66,7 +62,7 @@ public class ImageTest extends BuildFileTest { | |||
| public void testOverwriteTrue() { | |||
| expectLogContaining("testSimpleScale", "Processing File"); | |||
| File f = createRelativeFile("/dest/" + LARGEIMAGE); | |||
| File f = new File(getOutputDir(), LARGEIMAGE); | |||
| long lastModified = f.lastModified(); | |||
| try { | |||
| Thread.sleep(FILE_UTILS | |||
| @@ -74,7 +70,7 @@ public class ImageTest extends BuildFileTest { | |||
| } | |||
| catch (InterruptedException e) {} | |||
| expectLogContaining("testOverwriteTrue", "Processing File"); | |||
| f = createRelativeFile("/dest/" + LARGEIMAGE); | |||
| f = new File(getOutputDir(), LARGEIMAGE); | |||
| long overwrittenLastModified = f.lastModified(); | |||
| assertTrue("File was not overwritten.", | |||
| lastModified < overwrittenLastModified); | |||
| @@ -82,10 +78,10 @@ public class ImageTest extends BuildFileTest { | |||
| public void testOverwriteFalse() { | |||
| expectLogContaining("testSimpleScale", "Processing File"); | |||
| File f = createRelativeFile("/dest/" + LARGEIMAGE); | |||
| File f = new File(getOutputDir(), LARGEIMAGE); | |||
| long lastModified = f.lastModified(); | |||
| expectLogContaining("testOverwriteFalse", "Processing File"); | |||
| f = createRelativeFile("/dest/" + LARGEIMAGE); | |||
| f = new File(getOutputDir(), LARGEIMAGE); | |||
| long overwrittenLastModified = f.lastModified(); | |||
| assertTrue("File was overwritten.", | |||
| lastModified == overwrittenLastModified); | |||
| @@ -93,7 +89,7 @@ public class ImageTest extends BuildFileTest { | |||
| public void testSimpleScaleWithMapper() { | |||
| expectLogContaining("testSimpleScaleWithMapper", "Processing File"); | |||
| File f = createRelativeFile("/dest/scaled-" + LARGEIMAGE); | |||
| File f = new File(getOutputDir(), "scaled-" + LARGEIMAGE); | |||
| assertTrue( | |||
| "Did not create "+f.getAbsolutePath(), | |||
| f.exists()); | |||
| @@ -113,15 +109,5 @@ public class ImageTest extends BuildFileTest { | |||
| .indexOf("Unable to process image stream") > -1); | |||
| } | |||
| } | |||
| protected File createRelativeFile(String filename) { | |||
| if (filename.equals(".")) { | |||
| return getProjectDir(); | |||
| } | |||
| // else | |||
| return new File(getProjectDir(), filename); | |||
| } | |||
| } | |||
| @@ -35,6 +35,8 @@ import org.apache.tools.ant.BuildFileTest; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.util.SymbolicLinkUtils; | |||
| import java.io.File; | |||
| /** | |||
| * Test cases for the Symlink task. Link creation, link deletion, recording | |||
| * of links in multiple directories, and restoration of links recorded are | |||
| @@ -56,7 +58,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| public void setUp() { | |||
| if (supportsSymlinks) { | |||
| configureProject("src/etc/testcases/taskdefs/optional/unix/symlink.xml"); | |||
| executeTarget("setup"); | |||
| executeTarget("setUp"); | |||
| } | |||
| } | |||
| @@ -187,7 +189,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| executeTarget("test-fileutils"); | |||
| SymbolicLinkUtils su = SymbolicLinkUtils.getSymbolicLinkUtils(); | |||
| java.io.File f = getProject().resolveFile("test-working/file1"); | |||
| java.io.File f = new File(getOutputDir(), "file1"); | |||
| assertTrue(f.exists()); | |||
| assertFalse(f.isDirectory()); | |||
| assertTrue(f.isFile()); | |||
| @@ -198,7 +200,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| assertFalse(su.isDanglingSymbolicLink(f.getParentFile(), | |||
| f.getName())); | |||
| f = getProject().resolveFile("test-working/dir1"); | |||
| f = new File(getOutputDir(), "dir1"); | |||
| assertTrue(f.exists()); | |||
| assertTrue(f.isDirectory()); | |||
| assertFalse(f.isFile()); | |||
| @@ -209,7 +211,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| assertFalse(su.isDanglingSymbolicLink(f.getParentFile(), | |||
| f.getName())); | |||
| f = getProject().resolveFile("test-working/file2"); | |||
| f = new File(getOutputDir(), "file2"); | |||
| assertFalse(f.exists()); | |||
| assertFalse(f.isDirectory()); | |||
| assertFalse(f.isFile()); | |||
| @@ -220,7 +222,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| assertFalse(su.isDanglingSymbolicLink(f.getParentFile(), | |||
| f.getName())); | |||
| f = getProject().resolveFile("test-working/dir2"); | |||
| f = new File(getOutputDir(), "dir2"); | |||
| assertFalse(f.exists()); | |||
| assertFalse(f.isDirectory()); | |||
| assertFalse(f.isFile()); | |||
| @@ -232,7 +234,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| f.getName())); | |||
| f = getProject().resolveFile("test-working/file.there"); | |||
| f = new File(getOutputDir(), "file.there"); | |||
| assertTrue(f.exists()); | |||
| assertFalse(f.isDirectory()); | |||
| assertTrue(f.isFile()); | |||
| @@ -243,7 +245,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| assertFalse(su.isDanglingSymbolicLink(f.getParentFile(), | |||
| f.getName())); | |||
| f = getProject().resolveFile("test-working/dir.there"); | |||
| f = new File(getOutputDir(), "dir.there"); | |||
| assertTrue(f.exists()); | |||
| assertTrue(f.isDirectory()); | |||
| assertFalse(f.isFile()); | |||
| @@ -260,7 +262,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| // this is not true under Snow Leopard and JDK 1.5 | |||
| // Removing special handling of MacOS until someone shouts | |||
| // Antoine | |||
| f = getProject().resolveFile("test-working/file.notthere"); | |||
| f = new File(getOutputDir(), "file.notthere"); | |||
| assertFalse(f.exists()); | |||
| assertFalse(f.isDirectory()); | |||
| assertFalse(f.isFile()); | |||
| @@ -270,7 +272,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| assertTrue(su.isDanglingSymbolicLink(f.getParentFile(), | |||
| f.getName())); | |||
| f = getProject().resolveFile("test-working/dir.notthere"); | |||
| f = new File(getOutputDir(), "dir.notthere"); | |||
| assertFalse(f.exists()); | |||
| assertFalse(f.isDirectory()); | |||
| assertFalse(f.isFile()); | |||
| @@ -285,7 +287,7 @@ public class SymlinkTest extends BuildFileTest { | |||
| public void tearDown() { | |||
| if (supportsSymlinks) { | |||
| executeTarget("teardown"); | |||
| executeTarget("tearDown"); | |||
| } | |||
| } | |||
| @@ -42,10 +42,6 @@ public class ClassFileSetTest extends BuildFileTest { | |||
| configureProject("src/etc/testcases/taskdefs/optional/depend/depend.xml"); | |||
| } | |||
| public void tearDown() { | |||
| executeTarget("clean"); | |||
| } | |||
| /** | |||
| * Test basic classfileset | |||
| */ | |||