git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@477922 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,481 +0,0 @@ | |||
| <project default="all" | |||
| xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors"> | |||
| <property name="dirname" value="work" /> | |||
| <property name="dir" location="${dirname}" /> | |||
| <property name="zip" location="${dirname}.zip" /> | |||
| <property name="jar" location="${dirname}.jar" /> | |||
| <property name="file" location="${dirname}/file.txt" /> | |||
| <target name="init"> | |||
| <touch mkdirs="true"> | |||
| <filelist dir="${dir}/foo/a" files="x,y,z" /> | |||
| </touch> | |||
| <copy todir="${dir}/foo" enablemultiplemappings="true"> | |||
| <fileset dir="${dir}/foo" /> | |||
| <mapper> | |||
| <globmapper handledirsep="true" from="a/*" to="b/*" /> | |||
| <globmapper handledirsep="true" from="a/*" to="c/*" /> | |||
| </mapper> | |||
| </copy> | |||
| <copy todir="${dir}/bar"> | |||
| <fileset dir="${dir}/foo" /> | |||
| </copy> | |||
| <property name="foo" location="${dir}/foo" /> | |||
| <property name="foo.a" location="${dir}/foo/a" /> | |||
| <property name="foo.b" location="${dir}/foo/b" /> | |||
| <property name="foo.c" location="${dir}/foo/c" /> | |||
| <property name="bar" location="${dir}/bar" /> | |||
| <property name="bar.a" location="${dir}/bar/a" /> | |||
| <property name="bar.b" location="${dir}/bar/b" /> | |||
| <property name="bar.c" location="${dir}/bar/c" /> | |||
| </target> | |||
| <target name="tearDown"> | |||
| <delete dir="${dir}" /> | |||
| <delete file="${zip}" /> | |||
| <delete file="${jar}" deleteonexit="true" /> | |||
| <delete file="${file}" /> | |||
| </target> | |||
| <target name="testfiles1" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="26"> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| </files> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testfiles2" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="8"> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="dir" /> | |||
| </files> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testfiles3" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="18"> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="files" depends="testfiles1,testfiles2,testfiles3" /> | |||
| <target name="testnestedresources" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="27"><!-- include duplicates! --> | |||
| <resources> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| </resources> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testresourcesref" depends="init"> | |||
| <files id="files"> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="18"> | |||
| <resources refid="files" /> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="resources" depends="testnestedresources,testresourcesref" /> | |||
| <target name="testfileset" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="9"> | |||
| <fileset dir="${dir}/foo" /> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testdirset" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="4"> | |||
| <dirset dir="${dir}/foo" /> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testfilelist"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="5"> | |||
| <filelist dir="${dir}/foo" files="1,2,3,4,5" /> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testpath" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="24"> | |||
| <path> | |||
| <path id="p"> | |||
| <fileset id="fs" dir="${foo.a}" /> <!-- 3 --> | |||
| <dirset id="ds" dir="${foo}" /> <!-- 4 --> | |||
| </path> | |||
| <pathelement id="pe" location="${dir}" /> <!-- 1 --> | |||
| <filelist id="fl" dir="${bar}" files="1,2,3,a,b,c" /> <!-- 6 --> | |||
| <files id="f" includes="${bar}/" /> <!-- 13; 3 overlap fl --> | |||
| </path> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="createzip" depends="init"> | |||
| <zip destfile="${zip}" basedir="${dir}" /> | |||
| </target> | |||
| <target name="testzipfileset" depends="createzip"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="9"> | |||
| <zipfileset src="${zip}" includes="foo/" /> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testpropertyset"> | |||
| <property name="testpropertyset.a" value="a" /> | |||
| <property name="testpropertyset.aa" value="aa" /> | |||
| <property name="testpropertyset.aaa" value="aaa" /> | |||
| <propertyset id="testpropertyset"> | |||
| <propertyref prefix="testpropertyset." /> | |||
| </propertyset> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <and> | |||
| <resourcecount refid="testpropertyset" count="3" /> | |||
| <length length="12"> | |||
| <resources> | |||
| <resources refid="testpropertyset" /> | |||
| <propertyset refid="testpropertyset" /> | |||
| </resources> | |||
| </length> | |||
| </and> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="legacy" | |||
| depends="testfileset,testdirset,testfilelist,testpath,testzipfileset,testpropertyset" /> | |||
| <target name="testunion" depends="init"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="4"> | |||
| <union> | |||
| <files includes="${foo.a}/w,${foo.a}/x" /> <!-- 1 --> | |||
| <fileset dir="${foo.a}" includes="x,y" /> <!-- 2; net 1 --> | |||
| <filelist dir="${foo.a}" files="v" /> <!-- 1 --> | |||
| <files includes="${foo.a}/y,${foo.a}/z" /> <!-- 2; net 1 --> | |||
| </union> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testintersect"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="3"> | |||
| <intersect> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| <filelist dir="${dir}" files="2,3,4,5,6" /> | |||
| <filelist dir="${dir}" files="3,4,5,6,7" /> | |||
| </intersect> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testdifference"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="2"> | |||
| <difference id="diff"> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| <filelist dir="${dir}" files="2,3,4,5,6" /> | |||
| <filelist dir="${dir}" files="3,4,5,6,7" /> | |||
| </difference> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="setlogic" depends="testunion,testintersect,testdifference" /> | |||
| <target name="testfileurl"> | |||
| <condition property="blah"> | |||
| <length when="less" length="1"> | |||
| <url file="${ant.file}" /> | |||
| </length> | |||
| </condition> | |||
| <fail if="blah" /> | |||
| </target> | |||
| <target name="testfileurlref"> | |||
| <url id="fileurl" file="${ant.file}" /> | |||
| <condition property="blah"> | |||
| <length when="less" length="1"> | |||
| <url refid="fileurl" /> | |||
| </length> | |||
| </condition> | |||
| <fail if="blah" /> | |||
| </target> | |||
| <target name="testhttpurl1" unless="offline"> | |||
| <fail> | |||
| <condition> | |||
| <length when="less" length="1"> | |||
| <url url="http://ant.apache.org/index.html" /> | |||
| </length> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testhttpurl2" unless="offline"> | |||
| <concat destfile="${file}" force="true" append="false"> | |||
| <url id="httpurl" url="http://ant.apache.org/index.html" /> | |||
| <url refid="httpurl" /> | |||
| </concat> | |||
| <length property="httpurl.length"> | |||
| <url refid="httpurl" /> | |||
| </length> | |||
| <length property="file.length"> | |||
| <file file="${file}"/> | |||
| </length> | |||
| <fail message="length of url ${httpurl.length} length of file ${file.length} file should be twice as big"> | |||
| <condition> | |||
| <not> | |||
| <length file="${file}" when="greater" length="${httpurl.length}" /> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="createjar" depends="init"> | |||
| <jar destfile="${jar}" basedir="${dir}" /> | |||
| </target> | |||
| <target name="testjarurl" depends="createjar"> | |||
| <pathconvert property="jarurl"> | |||
| <url file="${jar}" /> | |||
| </pathconvert> | |||
| <fail> | |||
| <condition> | |||
| <length when="less" length="1"> | |||
| <url url="jar:${jarurl}!/META-INF/MANIFEST.MF" /> | |||
| </length> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="url" | |||
| depends="testfileurl,testfileurlref,testhttpurl1,testhttpurl2,testjarurl" /> | |||
| <target name="testfile" depends="init"> | |||
| <echo file="${file}">This is a test.</echo> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <length length="15"> | |||
| <file file="${file}" /> | |||
| </length> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testzipentry" depends="createjar"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <length when="greater" length="0"> | |||
| <zipentry zipfile="${jar}" name="META-INF/MANIFEST.MF" /> | |||
| </length> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="teststring1"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <length length="15"> | |||
| <string value="This is a test." /> | |||
| </length> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="teststring2"> | |||
| <property name="test" value="foo" /> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <length length="14"> | |||
| <string value="This is a ${test}." /> | |||
| </length> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="string" depends="teststring1,teststring2" /> | |||
| <target name="testresource"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <length length="4096"> | |||
| <resource size="4096" /> | |||
| </length> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testproperty"> | |||
| <property name="testproperty" value="abcdefghij" /> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <length length="10"> | |||
| <propertyresource name="testproperty" /> | |||
| </length> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="single" | |||
| depends="testresource,url,testfile,string,testzipentry,testproperty" /> | |||
| <target name="testfirst0"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="0"> | |||
| <first count="0"> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| </first> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testfirst1"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="1"> | |||
| <first> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| </first> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="testfirst2"> | |||
| <fail> | |||
| <condition> | |||
| <not> | |||
| <resourcecount count="2"> | |||
| <first count="2"> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| </first> | |||
| </resourcecount> | |||
| </not> | |||
| </condition> | |||
| </fail> | |||
| </target> | |||
| <target name="first" depends="testfirst0,testfirst1,testfirst2" /> | |||
| <target name="all" depends="legacy,files,resources,setlogic,single,first" /> | |||
| </project> | |||
| @@ -0,0 +1,358 @@ | |||
| <project default="all" xmlns:au="antlib:org.apache.ant.antunit" | |||
| xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors"> | |||
| <property name="dirname" value="work" /> | |||
| <property name="dir" location="${dirname}" /> | |||
| <property name="zip" location="${dirname}.zip" /> | |||
| <property name="jar" location="${dirname}.jar" /> | |||
| <property name="file" location="${dirname}/file.txt" /> | |||
| <target name="setUp"> | |||
| <touch mkdirs="true"> | |||
| <filelist dir="${dir}/foo/a" files="x,y,z" /> | |||
| </touch> | |||
| <copy todir="${dir}/foo" enablemultiplemappings="true"> | |||
| <fileset dir="${dir}/foo" /> | |||
| <mapper> | |||
| <globmapper handledirsep="true" from="a/*" to="b/*" /> | |||
| <globmapper handledirsep="true" from="a/*" to="c/*" /> | |||
| </mapper> | |||
| </copy> | |||
| <copy todir="${dir}/bar"> | |||
| <fileset dir="${dir}/foo" /> | |||
| </copy> | |||
| <property name="foo" location="${dir}/foo" /> | |||
| <property name="foo.a" location="${dir}/foo/a" /> | |||
| <property name="foo.b" location="${dir}/foo/b" /> | |||
| <property name="foo.c" location="${dir}/foo/c" /> | |||
| <property name="bar" location="${dir}/bar" /> | |||
| <property name="bar.a" location="${dir}/bar/a" /> | |||
| <property name="bar.b" location="${dir}/bar/b" /> | |||
| <property name="bar.c" location="${dir}/bar/c" /> | |||
| </target> | |||
| <target name="tearDown"> | |||
| <delete dir="${dir}" /> | |||
| <delete file="${zip}" /> | |||
| <delete file="${jar}" deleteonexit="true" /> | |||
| <delete file="${file}" /> | |||
| </target> | |||
| <target name="testfiles1" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="26"> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| </files> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfiles2" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="8"> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="dir" /> | |||
| </files> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfiles3" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="18"> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testnestedresources" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="27"><!-- include duplicates! --> | |||
| <resources> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| <files> | |||
| <include name="${dir}/foo/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| </resources> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testresourcesref" depends="setUp"> | |||
| <files id="files"> | |||
| <include name="${dir}/foo/" /> | |||
| <include name="${dir}/bar/" /> | |||
| <type type="file" /> | |||
| </files> | |||
| <au:assertTrue> | |||
| <resourcecount count="18"> | |||
| <resources refid="files" /> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfileset" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="9"> | |||
| <fileset dir="${dir}/foo" /> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testdirset" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="4"> | |||
| <dirset dir="${dir}/foo" /> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfilelist"> | |||
| <au:assertTrue> | |||
| <resourcecount count="5"> | |||
| <filelist dir="${dir}/foo" files="1,2,3,4,5" /> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testpath" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="24"> | |||
| <path> | |||
| <path id="p"> | |||
| <fileset id="fs" dir="${foo.a}" /> <!-- 3 --> | |||
| <dirset id="ds" dir="${foo}" /> <!-- 4 --> | |||
| </path> | |||
| <pathelement id="pe" location="${dir}" /> <!-- 1 --> | |||
| <filelist id="fl" dir="${bar}" files="1,2,3,a,b,c" /> <!-- 6 --> | |||
| <files id="f" includes="${bar}/" /> <!-- 13; 3 overlap fl --> | |||
| </path> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="createzip" depends="setUp"> | |||
| <zip destfile="${zip}" basedir="${dir}" /> | |||
| </target> | |||
| <target name="testzipfileset" depends="createzip"> | |||
| <au:assertTrue> | |||
| <resourcecount count="9"> | |||
| <zipfileset src="${zip}" includes="foo/" /> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testpropertyset"> | |||
| <property name="testpropertyset.a" value="a" /> | |||
| <property name="testpropertyset.aa" value="aa" /> | |||
| <property name="testpropertyset.aaa" value="aaa" /> | |||
| <propertyset id="testpropertyset"> | |||
| <propertyref prefix="testpropertyset." /> | |||
| </propertyset> | |||
| <au:assertTrue> | |||
| <and> | |||
| <resourcecount refid="testpropertyset" count="3" /> | |||
| <length length="12"> | |||
| <resources> | |||
| <resources refid="testpropertyset" /> | |||
| <propertyset refid="testpropertyset" /> | |||
| </resources> | |||
| </length> | |||
| </and> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testunion" depends="setUp"> | |||
| <au:assertTrue> | |||
| <resourcecount count="4"> | |||
| <union> | |||
| <files includes="${foo.a}/w,${foo.a}/x" /> <!-- 1 --> | |||
| <fileset dir="${foo.a}" includes="x,y" /> <!-- 2; net 1 --> | |||
| <filelist dir="${foo.a}" files="v" /> <!-- 1 --> | |||
| <files includes="${foo.a}/y,${foo.a}/z" /> <!-- 2; net 1 --> | |||
| </union> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testintersect"> | |||
| <au:assertTrue> | |||
| <resourcecount count="3"> | |||
| <intersect> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| <filelist dir="${dir}" files="2,3,4,5,6" /> | |||
| <filelist dir="${dir}" files="3,4,5,6,7" /> | |||
| </intersect> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testdifference"> | |||
| <au:assertTrue> | |||
| <resourcecount count="2"> | |||
| <difference id="diff"> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| <filelist dir="${dir}" files="2,3,4,5,6" /> | |||
| <filelist dir="${dir}" files="3,4,5,6,7" /> | |||
| </difference> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfileurl"> | |||
| <au:assertTrue> | |||
| <length when="greater" length="0"> | |||
| <url file="${ant.file}" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfileurlref"> | |||
| <url id="fileurl" file="${ant.file}" /> | |||
| <au:assertTrue> | |||
| <length when="greater" length="0"> | |||
| <url refid="fileurl" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testhttpurl1" unless="offline"> | |||
| <au:assertTrue> | |||
| <length when="greater" length="0"> | |||
| <url url="http://ant.apache.org/index.html" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testhttpurl2" unless="offline"> | |||
| <concat destfile="${file}" force="true" append="false"> | |||
| <url id="httpurl" url="http://ant.apache.org/index.html" /> | |||
| <url refid="httpurl" /> | |||
| </concat> | |||
| <length property="httpurl.length"> | |||
| <url refid="httpurl" /> | |||
| </length> | |||
| <length property="file.length"> | |||
| <file file="${file}"/> | |||
| </length> | |||
| <au:assertTrue message="length of url ${httpurl.length} length of file ${file.length} file should be twice as big"> | |||
| <length file="${file}" when="greater" length="${httpurl.length}" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="createjar" depends="setUp"> | |||
| <jar destfile="${jar}" basedir="${dir}" /> | |||
| </target> | |||
| <target name="testjarurl" depends="createjar"> | |||
| <pathconvert property="jarurl"> | |||
| <url file="${jar}" /> | |||
| </pathconvert> | |||
| <au:assertTrue> | |||
| <length when="greater" length="0"> | |||
| <url url="jar:${jarurl}!/META-INF/MANIFEST.MF" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfile" depends="setUp"> | |||
| <echo file="${file}">This is a test.</echo> | |||
| <au:assertTrue> | |||
| <length length="15"> | |||
| <file file="${file}" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testzipentry" depends="createjar"> | |||
| <au:assertTrue> | |||
| <length when="greater" length="0"> | |||
| <zipentry zipfile="${jar}" name="META-INF/MANIFEST.MF" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="teststring1"> | |||
| <au:assertTrue> | |||
| <length length="15"> | |||
| <string value="This is a test." /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="teststring2"> | |||
| <property name="test" value="foo" /> | |||
| <au:assertTrue> | |||
| <length length="14"> | |||
| <string value="This is a ${test}." /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testresource"> | |||
| <au:assertTrue> | |||
| <length length="4096"> | |||
| <resource size="4096" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testproperty"> | |||
| <property name="testproperty" value="abcdefghij" /> | |||
| <au:assertTrue> | |||
| <length length="10"> | |||
| <propertyresource name="testproperty" /> | |||
| </length> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfirst0"> | |||
| <au:assertTrue> | |||
| <resourcecount count="0"> | |||
| <first count="0"> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| </first> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfirst1"> | |||
| <au:assertTrue> | |||
| <resourcecount count="1"> | |||
| <first> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| </first> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testfirst2"> | |||
| <au:assertTrue> | |||
| <resourcecount count="2"> | |||
| <first count="2"> | |||
| <filelist dir="${dir}" files="1,2,3,4,5" /> | |||
| </first> | |||
| </resourcecount> | |||
| </au:assertTrue> | |||
| </target> | |||
| </project> | |||
| @@ -1,141 +0,0 @@ | |||
| /* | |||
| * Licensed to the Apache Software Foundation (ASF) under one or more | |||
| * contributor license agreements. See the NOTICE file distributed with | |||
| * this work for additional information regarding copyright ownership. | |||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | |||
| * (the "License"); you may not use this file except in compliance with | |||
| * the License. You may obtain a copy of the License at | |||
| * | |||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||
| * | |||
| * Unless required by applicable law or agreed to in writing, software | |||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
| * See the License for the specific language governing permissions and | |||
| * limitations under the License. | |||
| * | |||
| */ | |||
| package org.apache.tools.ant.types; | |||
| import org.apache.tools.ant.BuildFileTest; | |||
| public class ResourceCollectionsTest extends BuildFileTest { | |||
| public ResourceCollectionsTest(String name) { | |||
| super(name); | |||
| } | |||
| public void setUp() { | |||
| configureProject("src/etc/testcases/types/resources/build.xml"); | |||
| } | |||
| public void tearDown() { | |||
| executeTarget("tearDown"); | |||
| } | |||
| public void testdifference() { | |||
| executeTarget("testdifference"); | |||
| } | |||
| public void testdirset() { | |||
| executeTarget("testdirset"); | |||
| } | |||
| public void testfile() { | |||
| executeTarget("testfile"); | |||
| } | |||
| public void testfilelist() { | |||
| executeTarget("testfilelist"); | |||
| } | |||
| public void testfiles1() { | |||
| executeTarget("testfiles1"); | |||
| } | |||
| public void testfiles2() { | |||
| executeTarget("testfiles2"); | |||
| } | |||
| public void testfiles3() { | |||
| executeTarget("testfiles3"); | |||
| } | |||
| public void testfileset() { | |||
| executeTarget("testfileset"); | |||
| } | |||
| public void testfileurl() { | |||
| executeTarget("testfileurl"); | |||
| } | |||
| public void testfileurlref() { | |||
| executeTarget("testfileurlref"); | |||
| } | |||
| public void testfirst1() { | |||
| executeTarget("testfirst1"); | |||
| } | |||
| public void testfirst2() { | |||
| executeTarget("testfirst2"); | |||
| } | |||
| public void testhttpurl1() { | |||
| executeTarget("testhttpurl1"); | |||
| } | |||
| public void testhttpurl2() { | |||
| executeTarget("testhttpurl2"); | |||
| } | |||
| public void testintersect() { | |||
| executeTarget("testintersect"); | |||
| } | |||
| public void testjarurl() { | |||
| executeTarget("testjarurl"); | |||
| } | |||
| public void testnestedresources() { | |||
| executeTarget("testnestedresources"); | |||
| } | |||
| public void testpath() { | |||
| executeTarget("testpath"); | |||
| } | |||
| public void testpropertyset() { | |||
| executeTarget("testpropertyset"); | |||
| } | |||
| public void testresource() { | |||
| executeTarget("testresource"); | |||
| } | |||
| public void testresourcesref() { | |||
| executeTarget("testresourcesref"); | |||
| } | |||
| public void teststring1() { | |||
| executeTarget("teststring1"); | |||
| } | |||
| public void teststring2() { | |||
| executeTarget("teststring2"); | |||
| } | |||
| public void testunion() { | |||
| executeTarget("testunion"); | |||
| } | |||
| public void testzipentry() { | |||
| executeTarget("testzipentry"); | |||
| } | |||
| public void testzipfileset() { | |||
| executeTarget("testzipfileset"); | |||
| } | |||
| } | |||