1 | <project name="ftp-test" basedir=".">
|
---|
2 | <property file="../../../../../../ftp.properties"/>
|
---|
3 | <property name="ftp.user" value="${user.name}"/>
|
---|
4 | <property name="ftp.host" value="localhost"/>
|
---|
5 | <property name="ftp.port" value="21" />
|
---|
6 | <property name="ftp.password" value="sunshine" />
|
---|
7 | <property name="ftp.filesep" value="/"/>
|
---|
8 | <property name="tmp.dir" location="tmp"/>
|
---|
9 | <property name="tmp.get.dir" location="tmp.get"/>
|
---|
10 | <fileset dir="${tmp.get.dir}" id="fileset-destination-with-selector">
|
---|
11 | <include name="alpha/**"/>
|
---|
12 | <filename name="**/alpha.xml" />
|
---|
13 | </fileset>
|
---|
14 | <fileset dir="${tmp.dir}" id="fileset-source-without-selector">
|
---|
15 | <include name="alpha/**"/>
|
---|
16 | </fileset>
|
---|
17 | <fileset dir="${tmp.get.dir}" id="fileset-destination-without-selector">
|
---|
18 | <include name="alpha/**"/>
|
---|
19 | </fileset>
|
---|
20 | <fileset dir="${tmp.get.dir}" id="fileset-destination-followsymlinks" followsymlinks="true">
|
---|
21 | <include name="alpha/**"/>
|
---|
22 | </fileset>
|
---|
23 | <fileset dir="${tmp.get.dir}" id="fileset-destination-nofollowsymlinks" followsymlinks="false">
|
---|
24 | <include name="alpha/**"/>
|
---|
25 | </fileset>
|
---|
26 | <target name="setup">
|
---|
27 | <mkdir dir="${tmp.get.dir}"/>
|
---|
28 | <mkdir dir="${tmp.dir}/alpha/beta/gamma"/>
|
---|
29 | <touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/>
|
---|
30 | <touch file="${tmp.dir}/alpha/beta/beta.xml"/>
|
---|
31 | </target>
|
---|
32 | <target name="ftp-get-with-selector">
|
---|
33 | <ftp action="get"
|
---|
34 | server="${ftp.host}"
|
---|
35 | userid="${ftp.user}"
|
---|
36 | password="${ftp.password}"
|
---|
37 | separator="${ftp.filesep}"
|
---|
38 | remotedir="${tmp.dir}">
|
---|
39 | <fileset refid="fileset-destination-with-selector"/>
|
---|
40 | </ftp>
|
---|
41 | </target>
|
---|
42 | <target name="children-of-excluded-dir-setup" depends="setup">
|
---|
43 | <mkdir dir="${tmp.dir}/delta"/>
|
---|
44 | <touch file="${tmp.dir}/delta/delta.xml"/>
|
---|
45 | </target>
|
---|
46 | <target name="cleanup">
|
---|
47 | <delete dir="${tmp.dir}" quiet="true"/>
|
---|
48 | <delete dir="${tmp.get.dir}" quiet="true"/>
|
---|
49 | </target>
|
---|
50 | <target name="symlink-setup" depends="setup">
|
---|
51 | <mkdir dir="${tmp.dir}/epsilon/gamma"/>
|
---|
52 | <delete dir="${tmp.dir}/alpha/beta"/>
|
---|
53 | <symlink link="${tmp.dir}/alpha/beta" resource="${tmp.dir}/epsilon"/>
|
---|
54 | <touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/>
|
---|
55 | </target>
|
---|
56 | <target name="ftp-get-directory-symbolic-link" depends="symlink-setup">
|
---|
57 | <ftp action="get"
|
---|
58 | server="${ftp.host}"
|
---|
59 | userid="${ftp.user}"
|
---|
60 | password="${ftp.password}"
|
---|
61 | separator="${ftp.filesep}"
|
---|
62 | remotedir="${tmp.dir}"
|
---|
63 | >
|
---|
64 | <fileset refid="fileset-destination-followsymlinks"/>
|
---|
65 | </ftp>
|
---|
66 | </target>
|
---|
67 | <target name="ftp-get-directory-no-symbolic-link" depends="symlink-setup">
|
---|
68 | <ftp action="get"
|
---|
69 | server="${ftp.host}"
|
---|
70 | userid="${ftp.user}"
|
---|
71 | password="${ftp.password}"
|
---|
72 | separator="${ftp.filesep}"
|
---|
73 | remotedir="${tmp.dir}"
|
---|
74 | >
|
---|
75 | <fileset refid="fileset-destination-nofollowsymlinks"/>
|
---|
76 | </ftp>
|
---|
77 | </target>
|
---|
78 | <target name="symlink-file-setup" depends="setup">
|
---|
79 | <delete file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/>
|
---|
80 | <symlink link="${tmp.dir}/alpha/beta/gamma/gamma.xml"
|
---|
81 | resource="${tmp.dir}/alpha/beta/beta.xml"/>
|
---|
82 | </target>
|
---|
83 | <target name="ftp-delete">
|
---|
84 | <!-- this target can produce an error if the rmdir does not work -->
|
---|
85 | <!-- there can be problems with the rmdir action if the directories are not removed in a proper order -->
|
---|
86 | <!-- which means beginning by the leaves of the tree, going back to the trunk -->
|
---|
87 | <ftp action="del"
|
---|
88 | server="${ftp.host}"
|
---|
89 | userid="${ftp.user}"
|
---|
90 | password="${ftp.password}"
|
---|
91 | separator="${ftp.filesep}"
|
---|
92 | remotedir="${tmp.dir}">
|
---|
93 | <fileset dir="${tmp.get.dir}">
|
---|
94 | <include name="**"/>
|
---|
95 | </fileset>
|
---|
96 | </ftp>
|
---|
97 | <ftp action="rmdir"
|
---|
98 | server="${ftp.host}"
|
---|
99 | userid="${ftp.user}"
|
---|
100 | password="${ftp.password}"
|
---|
101 | separator="${ftp.filesep}"
|
---|
102 | remotedir="${tmp.dir}">
|
---|
103 | <fileset dir="${tmp.get.dir}">
|
---|
104 | <include name="**"/>
|
---|
105 | </fileset>
|
---|
106 | </ftp>
|
---|
107 | </target>
|
---|
108 | </project> |
---|