blob: f797fe422eaed2aedbe340a3a2cd84882c57c517 [file] [log] [blame]
<?xml version="1.0"?>
<project name="copy-test" basedir="." default="test1">
<target name="test1">
<copy file="copy.xml" tofile="copytest1.tmp" />
</target>
<target name="test2">
<copy file="copy.xml" todir="copytest1dir" overwrite="true"/>
</target>
<target name="filtertest">
<!-- check fix for bugzilla 23154 -->
<delete quiet="yes" file="copy.filter.out"/>
<delete quiet="yes" file="copy.filter.inp"/>
<concat destfile="copy.filter.inp">
PRODUCT_VERSION=6.2.1.4
PRODUCT_BUILD=6.5 (BLD_65036)
PRODUCT_VERSION=6.2.1.4
PRODUCT_BUILD=6.5 (BLD_65036)
</concat>
<copy file="copy.filter.inp" tofile="copy.filter.out">
<filterset begintoken="6" endtoken="4">
<filter token=".2.1." value="2.6.4" />
</filterset>
</copy>
<concat><path path="copy.filter.out"/></concat>
</target>
<target name="infinitetest">
<delete quiet="yes" file="copy.filter.out"/>
<delete quiet="yes" file="copy.filter.inp"/>
<concat destfile="copy.filter.inp">
a=b=
</concat>
<copy file="copy.filter.inp" tofile="copy.filter.out">
<filterset begintoken="=" endtoken="=">
<filter token="b" value="=b="/>
</filterset>
</copy>
<concat><path path="copy.filter.out"/></concat>
</target>
<target name="test3">
<!-- create an empty file -->
<touch file="copytest3.tmp"/>
<!--wait -->
<sleep seconds="4"/>
<!-- 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"/>
<!--wait -->
<sleep seconds="4"/>
<!-- copy an old file onto a newer file (should not work) -->
<copy file="copytest3.tmp" tofile="copytest3b.tmp" />
<!-- copy an older file onto a new one, should succeed -->
<copy file="copytest3.tmp" tofile="copytest3c.tmp"
overwrite="true"
preservelastmodified="true" />
<!-- copy a newer file onto an older one (should work) -->
<copy file="copytest3a.tmp" tofile="copytest3.tmp"
preservelastmodified="true" />
<!-- expected state :
3a.tmp==3.tmp==copy.xml
timeof(3a.tmp)==timeof(3.tmp)==now()-4
sizeof(3c)==0
timeof(3c.tmp)<timeof(3a.tmp);
3b.tmp==copy.xml
-->
</target>
<target name="test_single_file_fileset">
<copy tofile="copytest_single_file_fileset.tmp">
<fileset dir="." includes="copy.xml"/>
</copy>
</target>
<target name="testFilterSet">
<copy file="copy.filterset" tofile="copy.filterset.tmp">
<filterset>
<filter token="TITLE" value="Apache Ant Project"/>
</filterset>
</copy>
</target>
<target name="testFilterChain">
<copy file="copy.filterset" tofile="copy.filterchain.tmp">
<filterchain>
<replacetokens>
<token key="TITLE" value="Apache Ant Project"/>
</replacetokens>
</filterchain>
</copy>
</target>
<target name="testTranscoding">
<copy file="copy/input/iso8859-1" tofile="copytest1.tmp"
encoding="ISO8859_1" outputencoding="UTF8"/>
</target>
<target name="testMissingFileIgnore">
<copy file="not-there" tofile="copytest1.tmp"
failonerror="false"/>
</target>
<target name="testMissingFileBail">
<copy file="not-there" tofile="copytest1.tmp"
failonerror="true"/>
</target>
<target name="testMissingDirIgnore">
<copy todir="copytest1dir" failonerror="false">
<fileset dir="not-there"/>
</copy>
</target>
<target name="testMissingDirBail">
<copy todir="copytest1dir" failonerror="true">
<fileset dir="not-there"/>
</copy>
</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="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"/>
</target>
</project>