1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <project name="copy-test" basedir="." default="test1">
|
---|
4 |
|
---|
5 | <target name="test1">
|
---|
6 | <copy file="copy.xml" tofile="copytest1.tmp" />
|
---|
7 | </target>
|
---|
8 |
|
---|
9 | <target name="test2">
|
---|
10 | <copy file="copy.xml" todir="copytest1dir" overwrite="true"/>
|
---|
11 | </target>
|
---|
12 |
|
---|
13 | <target name="filtertest">
|
---|
14 | <!-- check fix for bugzilla 23154 -->
|
---|
15 | <delete quiet="yes" file="copy.filter.out"/>
|
---|
16 | <delete quiet="yes" file="copy.filter.inp"/>
|
---|
17 | <concat destfile="copy.filter.inp">
|
---|
18 | PRODUCT_VERSION=6.2.1.4
|
---|
19 | PRODUCT_BUILD=6.5 (BLD_65036)
|
---|
20 | PRODUCT_VERSION=6.2.1.4
|
---|
21 | PRODUCT_BUILD=6.5 (BLD_65036)
|
---|
22 | </concat>
|
---|
23 | <copy file="copy.filter.inp" tofile="copy.filter.out">
|
---|
24 | <filterset begintoken="6" endtoken="4">
|
---|
25 | <filter token=".2.1." value="2.6.4" />
|
---|
26 | </filterset>
|
---|
27 | </copy>
|
---|
28 | <concat><path path="copy.filter.out"/></concat>
|
---|
29 | </target>
|
---|
30 |
|
---|
31 | <target name="infinitetest">
|
---|
32 | <delete quiet="yes" file="copy.filter.out"/>
|
---|
33 | <delete quiet="yes" file="copy.filter.inp"/>
|
---|
34 | <concat destfile="copy.filter.inp">
|
---|
35 | a=b=
|
---|
36 | </concat>
|
---|
37 | <copy file="copy.filter.inp" tofile="copy.filter.out">
|
---|
38 | <filterset begintoken="=" endtoken="=">
|
---|
39 | <filter token="b" value="=b="/>
|
---|
40 | </filterset>
|
---|
41 | </copy>
|
---|
42 | <concat><path path="copy.filter.out"/></concat>
|
---|
43 | </target>
|
---|
44 |
|
---|
45 | <target name="test3">
|
---|
46 | <!-- create an empty file -->
|
---|
47 | <touch file="copytest3.tmp"/>
|
---|
48 | <!--wait -->
|
---|
49 | <sleep seconds="4"/>
|
---|
50 | <!-- copy a different file to two places -->
|
---|
51 | <copy file="copy.xml" tofile="copytest3a.tmp" overwrite="true"/>
|
---|
52 | <copy file="copy.xml" tofile="copytest3b.tmp" overwrite="true"/>
|
---|
53 | <!--wait -->
|
---|
54 | <sleep seconds="4"/>
|
---|
55 | <!-- copy an old file onto a newer file (should not work) -->
|
---|
56 | <copy file="copytest3.tmp" tofile="copytest3b.tmp" />
|
---|
57 | <!-- copy an older file onto a new one, should succeed -->
|
---|
58 | <copy file="copytest3.tmp" tofile="copytest3c.tmp"
|
---|
59 | overwrite="true"
|
---|
60 | preservelastmodified="true" />
|
---|
61 | <!-- copy a newer file onto an older one (should work) -->
|
---|
62 | <copy file="copytest3a.tmp" tofile="copytest3.tmp"
|
---|
63 | preservelastmodified="true" />
|
---|
64 | <!-- expected state :
|
---|
65 | 3a.tmp==3.tmp==copy.xml
|
---|
66 | timeof(3a.tmp)==timeof(3.tmp)==now()-4
|
---|
67 | sizeof(3c)==0
|
---|
68 | timeof(3c.tmp)<timeof(3a.tmp);
|
---|
69 | 3b.tmp==copy.xml
|
---|
70 | -->
|
---|
71 | </target>
|
---|
72 |
|
---|
73 | <target name="test_single_file_fileset">
|
---|
74 | <copy tofile="copytest_single_file_fileset.tmp">
|
---|
75 | <fileset dir="." includes="copy.xml"/>
|
---|
76 | </copy>
|
---|
77 | </target>
|
---|
78 |
|
---|
79 | <target name="testFilterSet">
|
---|
80 | <copy file="copy.filterset" tofile="copy.filterset.tmp">
|
---|
81 | <filterset>
|
---|
82 | <filter token="TITLE" value="Apache Ant Project"/>
|
---|
83 | </filterset>
|
---|
84 | </copy>
|
---|
85 | </target>
|
---|
86 |
|
---|
87 | <target name="testFilterChain">
|
---|
88 | <copy file="copy.filterset" tofile="copy.filterchain.tmp">
|
---|
89 | <filterchain>
|
---|
90 | <replacetokens>
|
---|
91 | <token key="TITLE" value="Apache Ant Project"/>
|
---|
92 | </replacetokens>
|
---|
93 | </filterchain>
|
---|
94 | </copy>
|
---|
95 | </target>
|
---|
96 |
|
---|
97 | <target name="testTranscoding">
|
---|
98 | <copy file="copy/input/iso8859-1" tofile="copytest1.tmp"
|
---|
99 | encoding="ISO8859_1" outputencoding="UTF8"/>
|
---|
100 | </target>
|
---|
101 |
|
---|
102 | <target name="testMissingFileIgnore">
|
---|
103 | <copy file="not-there" tofile="copytest1.tmp"
|
---|
104 | failonerror="false"/>
|
---|
105 | </target>
|
---|
106 |
|
---|
107 | <target name="testMissingFileBail">
|
---|
108 | <copy file="not-there" tofile="copytest1.tmp"
|
---|
109 | failonerror="true"/>
|
---|
110 | </target>
|
---|
111 |
|
---|
112 | <target name="testMissingDirIgnore">
|
---|
113 | <copy todir="copytest1dir" failonerror="false">
|
---|
114 | <fileset dir="not-there"/>
|
---|
115 | </copy>
|
---|
116 | </target>
|
---|
117 |
|
---|
118 | <target name="testMissingDirBail">
|
---|
119 | <copy todir="copytest1dir" failonerror="true">
|
---|
120 | <fileset dir="not-there"/>
|
---|
121 | </copy>
|
---|
122 | </target>
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 | <target name="cleanup">
|
---|
127 | <delete file="copytest1.tmp"/>
|
---|
128 | <delete file="copytest3.tmp"/>
|
---|
129 | <delete file="copytest3a.tmp"/>
|
---|
130 | <delete file="copytest3b.tmp"/>
|
---|
131 | <delete file="copytest3c.tmp"/>
|
---|
132 | <delete file="copytest_single_file_fileset.tmp"/>
|
---|
133 | <delete file="copy.filterset.tmp"/>
|
---|
134 | <delete file="copy.filterchain.tmp"/>
|
---|
135 | <delete dir="copytest1dir"/>
|
---|
136 | <delete quiet="yes" file="copy.filter.out"/>
|
---|
137 | <delete quiet="yes" file="copy.filter.inp"/>
|
---|
138 | </target>
|
---|
139 |
|
---|
140 |
|
---|
141 | </project>
|
---|