git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1583223 13f79535-47bb-0310-9956-ffa450edef68master
@@ -147,6 +147,11 @@ Other changes: | |||||
* <junit> has now a threads attribute allowing to run the tests in several threads. | * <junit> has now a threads attribute allowing to run the tests in several threads. | ||||
Bugzilla Report 55925 | Bugzilla Report 55925 | ||||
* addition of a new ProcessUtil class providing the process id of the current process | |||||
* changes to allow to run the JUnit testcases of Ant in parallel, | |||||
by making them use unique temporary directories | |||||
Changes from Ant 1.9.2 TO Ant 1.9.3 | Changes from Ant 1.9.2 TO Ant 1.9.3 | ||||
=================================== | =================================== | ||||
@@ -0,0 +1,9 @@ | |||||
<project name="buildfiletest-base"> | |||||
<property name="buildfiletest.tmpdir" location="${java.io.tmpdir}"/> | |||||
<property name="output" location="${buildfiletest.tmpdir}/testoutput_${ant.processid}_${ant.threadname}"/> | |||||
<target name="tearDown"> | |||||
<delete dir="${output}"/> | |||||
</target> | |||||
</project> |
@@ -16,10 +16,10 @@ | |||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project name="antclassloader-test" basedir="."> | <project name="antclassloader-test" basedir="."> | ||||
<property name="tmp.dir" location="${java.io.tmpdir}/tmp space"/> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<property name="tmp.dir" location="${output}/tmp space"/> | |||||
<!-- ant for germans --> | <!-- ant for germans --> | ||||
<property name="tmp.dir.nonascii" value="${java.io.tmpdir}/ãnt"/> | |||||
<property name="tmp.dir.nonascii" value="${output}/ãnt"/> | |||||
<property name="ext.dir.relative" value="ext"/> | <property name="ext.dir.relative" value="ext"/> | ||||
<property name="main.jar" location="${tmp.dir}/main.jar"/> | <property name="main.jar" location="${tmp.dir}/main.jar"/> | ||||
<property name="ext.jar.relative" value="${ext.dir.relative}/ext.jar"/> | <property name="ext.jar.relative" value="${ext.dir.relative}/ext.jar"/> | ||||
@@ -27,7 +27,7 @@ | |||||
<property name="build.sysclasspath" value="first"/> | <property name="build.sysclasspath" value="first"/> | ||||
<property name="main.jar.nonascii" location="${tmp.dir.nonascii}/main.jar"/> | <property name="main.jar.nonascii" location="${tmp.dir.nonascii}/main.jar"/> | ||||
<property name="ext.jar.nonascii" location="${tmp.dir.nonascii}/${ext.jar.relative}"/> | <property name="ext.jar.nonascii" location="${tmp.dir.nonascii}/${ext.jar.relative}"/> | ||||
<target name="setup" depends="setup.withspace,setup.nonascii"/> | |||||
<target name="setUp" depends="setup.withspace,setup.nonascii"/> | |||||
<target name="setup.withspace"> | <target name="setup.withspace"> | ||||
<mkdir dir="${tmp.dir}/${ext.dir.relative}"/> | <mkdir dir="${tmp.dir}/${ext.dir.relative}"/> | ||||
@@ -49,12 +49,8 @@ | |||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete dir="${tmp.dir}" quiet="true"/> | |||||
<delete dir="${tmp.dir.nonascii}" quiet="true"/> | |||||
</target> | |||||
<target name="prepareGetPackageTest" depends="setup"> | |||||
<target name="prepareGetPackageTest" depends="setUp"> | |||||
<mkdir dir="${tmp.dir.nonascii}/org/example"/> | <mkdir dir="${tmp.dir.nonascii}/org/example"/> | ||||
<echo file="${tmp.dir.nonascii}/org/example/Foo.java"><![CDATA[ | <echo file="${tmp.dir.nonascii}/org/example/Foo.java"><![CDATA[ | ||||
package org.example; | package org.example; | ||||
@@ -16,31 +16,26 @@ | |||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project name="directoryscanner-test" basedir="."> | <project name="directoryscanner-test" basedir="."> | ||||
<import file="../buildfiletest-base.xml"/> | |||||
<property name="tmp.dir" location="tmp"/> | |||||
<target name="setup"> | |||||
<mkdir dir="${tmp.dir}/alpha/beta/gamma"/> | |||||
<touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/> | |||||
<touch file="${tmp.dir}/alpha/beta/beta.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}/alpha/beta/gamma"/> | |||||
<touch file="${output}/alpha/beta/gamma/gamma.xml"/> | |||||
<touch file="${output}/alpha/beta/beta.xml"/> | |||||
</target> | </target> | ||||
<target name="extended-setup" depends="setup"> | |||||
<mkdir dir="${tmp.dir}/delta"/> | |||||
<touch file="${tmp.dir}/delta/delta.xml"/> | |||||
<target name="extended-setup" depends="setUp"> | |||||
<mkdir dir="${output}/delta"/> | |||||
<touch file="${output}/delta/delta.xml"/> | |||||
</target> | </target> | ||||
<target name="children-of-excluded-dir-setup" depends="extended-setup" /> | <target name="children-of-excluded-dir-setup" depends="extended-setup" /> | ||||
<target name="cleanup"> | |||||
<delete dir="${tmp.dir}" quiet="true"/> | |||||
</target> | |||||
<target name="symlink-setup" depends="setup"> | |||||
<mkdir dir="${tmp.dir}/epsilon/gamma"/> | |||||
<delete dir="${tmp.dir}/alpha/beta"/> | |||||
<symlink link="${tmp.dir}/alpha/beta" resource="${tmp.dir}/epsilon"/> | |||||
<touch file="${tmp.dir}/alpha/beta/gamma/gamma.xml"/> | |||||
<target name="symlink-setup" depends="setUp"> | |||||
<mkdir dir="${output}/epsilon/gamma"/> | |||||
<delete dir="${output}/alpha/beta"/> | |||||
<symlink link="${output}/alpha/beta" resource="${output}/epsilon"/> | |||||
<touch file="${output}/alpha/beta/gamma/gamma.xml"/> | |||||
</target> | </target> | ||||
</project> | </project> |
@@ -19,7 +19,13 @@ | |||||
<project name="loaderref-test" default="help"> | <project name="loaderref-test" default="help"> | ||||
<property name="src.dir" value="src"/> | <property name="src.dir" value="src"/> | ||||
<property name="classes.dir" value="classes"/> | |||||
<import file="../../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<echo message="output=${output}" file="/Users/antoine/debug.txt"/> | |||||
<mkdir dir="${output}"/> | |||||
</target> | |||||
<target name="help"> | <target name="help"> | ||||
<echo> | <echo> | ||||
@@ -27,20 +33,15 @@ This build file is intended to be used for testing Ant | |||||
</echo> | </echo> | ||||
</target> | </target> | ||||
<target name="clean"> | |||||
<delete dir="${classes.dir}"/> | |||||
</target> | |||||
<target name="compile"> | <target name="compile"> | ||||
<mkdir dir="${classes.dir}"/> | |||||
<javac srcdir="${src.dir}" destdir="${classes.dir}"/> | |||||
<javac srcdir="${src.dir}" destdir="${output}"/> | |||||
</target> | </target> | ||||
<target name="testbadref" depends="compile" > | <target name="testbadref" depends="compile" > | ||||
<taskdef loaderref="loaderref-test" | <taskdef loaderref="loaderref-test" | ||||
name="test1" | name="test1" | ||||
classname="Test1" | classname="Test1" | ||||
classpath="${classes.dir}"/> | |||||
classpath="${output}"/> | |||||
</target> | </target> | ||||
</project> | </project> |
@@ -17,7 +17,7 @@ | |||||
--> | --> | ||||
<project default="dont-run-this"> | <project default="dont-run-this"> | ||||
<property name="build.dir" value="build"/> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="dont-run-this"> | <target name="dont-run-this"> | ||||
<fail>This build file is supposed to be run by a Unit test</fail> | <fail>This build file is supposed to be run by a Unit test</fail> | ||||
@@ -33,11 +33,11 @@ | |||||
</target> | </target> | ||||
<target name="testTaskdef"> | <target name="testTaskdef"> | ||||
<mkdir dir="${build.dir}"/> | |||||
<javac srcdir="containersrc" destdir="${build.dir}" debug="on"/> | |||||
<mkdir dir="${output}"/> | |||||
<javac srcdir="containersrc" destdir="${output}" debug="on"/> | |||||
<sequential> | <sequential> | ||||
<taskdef name="sseq" classpath="${build.dir}" classname="test.SpecialSeq"/> | |||||
<taskdef name="sseq" classpath="${output}" classname="test.SpecialSeq"/> | |||||
<sseq> | <sseq> | ||||
<fileset dir="."/> | <fileset dir="."/> | ||||
<property name="foo" value="it worked"/> | <property name="foo" value="it worked"/> | ||||
@@ -58,8 +58,5 @@ | |||||
</Seq> | </Seq> | ||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete dir="${build.dir}"/> | |||||
</target> | |||||
</project> | </project> |
@@ -15,18 +15,15 @@ | |||||
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and | ||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project default="cleanup" basedir="."> | |||||
<target name="init"> | |||||
<mkdir dir="result" /> | |||||
<project default="tearDown" basedir="."> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}" /> | |||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete dir="result"/> | |||||
</target> | |||||
<target name="testLineContains" depends="init"> | |||||
<copy todir="result"> | |||||
<target name="testLineContains" depends="setUp"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="input"> | <fileset dir="input"> | ||||
<include name="linecontains.test"/> | <include name="linecontains.test"/> | ||||
</fileset> | </fileset> | ||||
@@ -36,14 +33,11 @@ | |||||
</filterreader> | </filterreader> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
<!--<fixcrlf srcdir="result" eol="lf"> | |||||
<include name="linecontains.test"/> | |||||
</fixcrlf>--> | |||||
</target> | </target> | ||||
<target name="testNegateLineContains" depends="init"> | |||||
<target name="testNegateLineContains" depends="setUp"> | |||||
<copy file="input/linecontains.test" | <copy file="input/linecontains.test" | ||||
tofile="result/negatelinecontains.test"> | |||||
tofile="${output}/negatelinecontains.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.LineContains"> | <filterreader classname="org.apache.tools.ant.filters.LineContains"> | ||||
<param type="negate" value="true"/> | <param type="negate" value="true"/> | ||||
@@ -54,15 +48,15 @@ | |||||
<fail> | <fail> | ||||
<condition> | <condition> | ||||
<not> | <not> | ||||
<filesmatch file1="result/negatelinecontains.test" | |||||
<filesmatch file1="${output}/negatelinecontains.test" | |||||
file2="expected/negatelinecontains.test" /> | file2="expected/negatelinecontains.test" /> | ||||
</not> | </not> | ||||
</condition> | </condition> | ||||
</fail> | </fail> | ||||
</target> | </target> | ||||
<target name="testEscapeUnicode" depends="init"> | |||||
<copy todir="result" encoding="UTF-8"> | |||||
<target name="testEscapeUnicode" depends="setUp"> | |||||
<copy todir="${output}" encoding="UTF-8"> | |||||
<fileset dir="input"> | <fileset dir="input"> | ||||
<include name="escapeunicode.test"/> | <include name="escapeunicode.test"/> | ||||
</fileset> | </fileset> | ||||
@@ -70,13 +64,13 @@ | |||||
<escapeunicode/> | <escapeunicode/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
<fixcrlf srcdir="result" eol="crlf"> | |||||
<fixcrlf srcdir="${output}" eol="crlf"> | |||||
<include name="escapeunicode.test"/> | <include name="escapeunicode.test"/> | ||||
</fixcrlf> | </fixcrlf> | ||||
</target> | </target> | ||||
<target name="testStripJavaComments" depends="init"> | |||||
<copy todir="result"> | |||||
<target name="testStripJavaComments" depends="setUp"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="input" includes="stripjavacomments.test" /> | <fileset dir="input" includes="stripjavacomments.test" /> | ||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.StripJavaComments" /> | <filterreader classname="org.apache.tools.ant.filters.StripJavaComments" /> | ||||
@@ -84,8 +78,8 @@ | |||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testReplaceTokens" depends="init"> | |||||
<copy todir="result"> | |||||
<target name="testReplaceTokens" depends="setUp"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="input" includes="replacetokens.test" /> | <fileset dir="input" includes="replacetokens.test" /> | ||||
<filterchain> | <filterchain> | ||||
<replacetokens> | <replacetokens> | ||||
@@ -95,24 +89,24 @@ | |||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testReplaceTokensPropertyFile" depends="init"> | |||||
<copy tofile="result/replacetokensPropertyFile.test"> | |||||
<target name="testReplaceTokensPropertyFile" depends="setUp"> | |||||
<copy tofile="${output}/replacetokensPropertyFile.test"> | |||||
<fileset dir="input" includes="replacetokens.test" /> | <fileset dir="input" includes="replacetokens.test" /> | ||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> | |||||
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens"> | |||||
<param type="propertiesfile" value="${basedir}/input/sample.properties"/> | <param type="propertiesfile" value="${basedir}/input/sample.properties"/> | ||||
</filterreader> | |||||
</filterreader> | |||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testNoAddNewLine" depends="init"> | |||||
<concat destfile="result/nonl">This has no new lines</concat> | |||||
<copy file="result/nonl" tofile="result/nonl-copyfilter"> | |||||
<target name="testNoAddNewLine" depends="setUp"> | |||||
<concat destfile="${output}/nonl">This has no new lines</concat> | |||||
<copy file="${output}/nonl" tofile="${output}/nonl-copyfilter"> | |||||
<filterchain><tokenfilter/></filterchain> | <filterchain><tokenfilter/></filterchain> | ||||
</copy> | </copy> | ||||
<condition property="filterchain.files.are.same"> | <condition property="filterchain.files.are.same"> | ||||
<filesmatch file1="result/nonl" file2="result/nonl-copyfilter"/> | |||||
<filesmatch file1="${output}/nonl" file2="${output}/nonl-copyfilter"/> | |||||
</condition> | </condition> | ||||
<fail unless="filterchain.files.are.same">File was modified</fail> | <fail unless="filterchain.files.are.same">File was modified</fail> | ||||
</target> | </target> | ||||
@@ -17,103 +17,99 @@ | |||||
--> | --> | ||||
<project default="cleanup" basedir="."> | <project default="cleanup" basedir="."> | ||||
<target name="init"> | |||||
<mkdir dir="result" /> | |||||
<echo file="result/prepend.txt" message="this-should-be-the-first-line${line.separator}"/> | |||||
<echo file="result/append.txt" message="this-should-be-the-last-line${line.separator}"/> | |||||
<copy file="input/head-tail.test" tofile="input/concatfilter.test"/> | |||||
<fixcrlf srcDir="input" includes="concatfilter.test"/> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}" /> | |||||
<echo file="${output}/prepend.txt" message="this-should-be-the-first-line${line.separator}"/> | |||||
<echo file="${output}/append.txt" message="this-should-be-the-last-line${line.separator}"/> | |||||
<copy file="input/head-tail.test" tofile="${output}/concatfilter.test"/> | |||||
<fixcrlf srcDir="${output}" includes="concatfilter.test"/> | |||||
<!-- to be consistent on MacOS X. fixcrlf uses CR while line.sep is LF --> | <!-- to be consistent on MacOS X. fixcrlf uses CR while line.sep is LF --> | ||||
<fixcrlf srcDir="result" includes="append.txt,prepend.txt"/> | |||||
<fixcrlf srcDir="${output}" includes="append.txt,prepend.txt"/> | |||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete dir="result"/> | |||||
<delete> | |||||
<fileset dir="input" includes="concatfilter.test"/> | |||||
</delete> | |||||
</target> | |||||
<target name="testFilterReaderNoArgs" depends="init"> | |||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.FilterReaderNoArgs.test"> | |||||
<target name="testFilterReaderNoArgs" depends="setUp"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.FilterReaderNoArgs.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.ConcatFilter"/> | <filterreader classname="org.apache.tools.ant.filters.ConcatFilter"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testFilterReaderPrepend" depends="init"> | |||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.FilterReaderPrepend.test"> | |||||
<target name="testFilterReaderPrepend" depends="setUp"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.FilterReaderPrepend.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.ConcatFilter"> | <filterreader classname="org.apache.tools.ant.filters.ConcatFilter"> | ||||
<param name="prepend" value="result/prepend.txt"/> | |||||
<param name="prepend" value="${output}/prepend.txt"/> | |||||
</filterreader> | </filterreader> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testFilterReaderAppend" depends="init"> | |||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.FilterReaderAppend.test"> | |||||
<target name="testFilterReaderAppend" depends="setUp"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.FilterReaderAppend.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.ConcatFilter"> | <filterreader classname="org.apache.tools.ant.filters.ConcatFilter"> | ||||
<param name="append" value="result/append.txt"/> | |||||
<param name="append" value="${output}/append.txt"/> | |||||
</filterreader> | </filterreader> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testFilterReaderPrependAppend" depends="init"> | |||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.FilterReaderPrependAppend.test"> | |||||
<target name="testFilterReaderPrependAppend" depends="setUp"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.FilterReaderPrependAppend.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.ConcatFilter"> | <filterreader classname="org.apache.tools.ant.filters.ConcatFilter"> | ||||
<param name="prepend" value="result/prepend.txt"/> | |||||
<param name="append" value="result/append.txt"/> | |||||
<param name="prepend" value="${output}/prepend.txt"/> | |||||
<param name="append" value="${output}/append.txt"/> | |||||
</filterreader> | </filterreader> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testConcatFilter" depends="init"> | |||||
<target name="testConcatFilter" depends="setUp"> | |||||
<typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | ||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.ConcatFilter.test"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.ConcatFilter.test"> | |||||
<filterchain> | <filterchain> | ||||
<concatfilter/> | <concatfilter/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testConcatFilterPrepend" depends="init"> | |||||
<target name="testConcatFilterPrepend" depends="setUp"> | |||||
<typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | ||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.ConcatFilterPrepend.test"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.ConcatFilterPrepend.test"> | |||||
<filterchain> | <filterchain> | ||||
<concatfilter prepend="result/prepend.txt"/> | |||||
<concatfilter prepend="${output}/prepend.txt"/> | |||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testConcatFilterAppend" depends="init"> | |||||
<target name="testConcatFilterAppend" depends="setUp"> | |||||
<typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | ||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.ConcatFilterAppend.test"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.ConcatFilterAppend.test"> | |||||
<filterchain> | <filterchain> | ||||
<concatfilter append="result/append.txt"/> | |||||
<concatfilter append="${output}/append.txt"/> | |||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testConcatFilterPrependAppend" depends="init"> | |||||
<target name="testConcatFilterPrependAppend" depends="setUp"> | |||||
<typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | <typedef name="concatfilter" classname="org.apache.tools.ant.filters.ConcatFilter"/> | ||||
<copy file="input/concatfilter.test" | |||||
tofile="result/concat.ConcatFilterPrependAppend.test"> | |||||
<copy file="${output}/concatfilter.test" | |||||
tofile="${output}/concat.ConcatFilterPrependAppend.test"> | |||||
<filterchain> | <filterchain> | ||||
<concatfilter prepend="result/prepend.txt" append="result/append.txt"/> | |||||
<concatfilter prepend="${output}/prepend.txt" append="${output}/append.txt"/> | |||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
@@ -15,14 +15,12 @@ | |||||
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and | ||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project default="cleanup" basedir="."> | |||||
<project default="tearDown" basedir="."> | |||||
<target name="init"> | |||||
<mkdir dir="result" /> | |||||
</target> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="cleanup"> | |||||
<delete dir="result"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}" /> | |||||
</target> | </target> | ||||
<target name="dynamicfilter"> | <target name="dynamicfilter"> | ||||
@@ -36,11 +34,11 @@ | |||||
<classpath refid="test-classes"/> | <classpath refid="test-classes"/> | ||||
</typedef> | </typedef> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
hello world | hello world | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/dynamicfilter"> | |||||
<copy file="${output}/input" tofile="${output}/dynamicfilter"> | |||||
<filterchain> | <filterchain> | ||||
<customfilter replace="o" with="O"/> | <customfilter replace="o" with="O"/> | ||||
</filterchain> | </filterchain> | ||||
@@ -15,53 +15,52 @@ | |||||
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and | ||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project default="cleanup" basedir="."> | |||||
<project default="tearDown" basedir="."> | |||||
<target name="init"> | |||||
<mkdir dir="result" /> | |||||
</target> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="cleanup"> | |||||
<delete dir="result"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}" /> | |||||
</target> | </target> | ||||
<!-- Testcases for HeadFilter --> | <!-- Testcases for HeadFilter --> | ||||
<target name="testHead" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.head.test"> | |||||
<target name="testHead" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.head.test"> | |||||
<filterchain> | <filterchain> | ||||
<headfilter/> | <headfilter/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testHeadLines" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.headLines.test"> | |||||
<target name="testHeadLines" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.headLines.test"> | |||||
<filterchain> | <filterchain> | ||||
<headfilter lines="2"/> | <headfilter lines="2"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testHeadSkip" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.headSkip.test"> | |||||
<target name="testHeadSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.headSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<headfilter skip="2"/> | <headfilter skip="2"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testHeadLinesSkip" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.headLinesSkip.test"> | |||||
<target name="testHeadLinesSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.headLinesSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<headfilter lines="2" skip="2"/> | <headfilter lines="2" skip="2"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testFilterReaderHeadLinesSkip" depends="init"> | |||||
<target name="testFilterReaderHeadLinesSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" | <copy file="input/head-tail.test" | ||||
tofile="result/head-tail.filterReaderHeadLinesSkip.test"> | |||||
tofile="${output}/head-tail.filterReaderHeadLinesSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.HeadFilter"> | <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> | ||||
<param name="lines" value="2"/> | <param name="lines" value="2"/> | ||||
@@ -71,8 +70,8 @@ | |||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testHeadAllSkip" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.headAllSkip.test"> | |||||
<target name="testHeadAllSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.headAllSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<headfilter lines="-1" skip="2"/> | <headfilter lines="-1" skip="2"/> | ||||
</filterchain> | </filterchain> | ||||
@@ -81,41 +80,41 @@ | |||||
<!-- Testcases for TailFilter --> | <!-- Testcases for TailFilter --> | ||||
<target name="testTail" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.tail.test"> | |||||
<target name="testTail" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.tail.test"> | |||||
<filterchain> | <filterchain> | ||||
<tailfilter/> | <tailfilter/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testTailLines" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.tailLines.test"> | |||||
<target name="testTailLines" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.tailLines.test"> | |||||
<filterchain> | <filterchain> | ||||
<tailfilter lines="2"/> | <tailfilter lines="2"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testTailSkip" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.tailSkip.test"> | |||||
<target name="testTailSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.tailSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<tailfilter skip="2"/> | <tailfilter skip="2"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testTailLinesSkip" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.tailLinesSkip.test"> | |||||
<target name="testTailLinesSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.tailLinesSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<tailfilter lines="2" skip="2"/> | <tailfilter lines="2" skip="2"/> | ||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testFilterReaderTailLinesSkip" depends="init"> | |||||
<target name="testFilterReaderTailLinesSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" | <copy file="input/head-tail.test" | ||||
tofile="result/head-tail.filterReaderTailLinesSkip.test"> | |||||
tofile="${output}/head-tail.filterReaderTailLinesSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<filterreader classname="org.apache.tools.ant.filters.TailFilter"> | <filterreader classname="org.apache.tools.ant.filters.TailFilter"> | ||||
<param name="lines" value="2"/> | <param name="lines" value="2"/> | ||||
@@ -125,8 +124,8 @@ | |||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="testTailAllSkip" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.tailAllSkip.test"> | |||||
<target name="testTailAllSkip" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.tailAllSkip.test"> | |||||
<filterchain> | <filterchain> | ||||
<tailfilter lines="-1" skip="2"/> | <tailfilter lines="-1" skip="2"/> | ||||
</filterchain> | </filterchain> | ||||
@@ -135,8 +134,8 @@ | |||||
<!-- Testcases for combined scenarios --> | <!-- Testcases for combined scenarios --> | ||||
<target name="testHeadTail" depends="init"> | |||||
<copy file="input/head-tail.test" tofile="result/head-tail.headtail.test"> | |||||
<target name="testHeadTail" depends="setUp"> | |||||
<copy file="input/head-tail.test" tofile="${output}/head-tail.headtail.test"> | |||||
<filterchain> | <filterchain> | ||||
<headfilter lines="4"/> | <headfilter lines="4"/> | ||||
<tailfilter lines="2"/> | <tailfilter lines="2"/> | ||||
@@ -15,18 +15,16 @@ | |||||
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and | ||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project default="cleanup" basedir="."> | |||||
<project default="tearDown" basedir="."> | |||||
<target name="init"> | |||||
<mkdir dir="result" /> | |||||
</target> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="cleanup"> | |||||
<delete dir="result"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}" /> | |||||
</target> | </target> | ||||
<target name="tokenfilter"> | <target name="tokenfilter"> | ||||
<copy file="input/linecontains.test" tofile="result/file1"> | |||||
<copy file="input/linecontains.test" tofile="${output}/file1"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter/> | <tokenfilter/> | ||||
</filterchain> | </filterchain> | ||||
@@ -34,12 +32,12 @@ | |||||
</target> | </target> | ||||
<target name="trimignore"> | <target name="trimignore"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
Hello | Hello | ||||
World | World | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/output" overwrite="yes"> | |||||
<copy file="${output}/input" tofile="${output}/output" overwrite="yes"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter delimoutput="-"> | <tokenfilter delimoutput="-"> | ||||
<trim/> | <trim/> | ||||
@@ -48,12 +46,12 @@ | |||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
<concat> | <concat> | ||||
<filelist dir="." files="result/output"/> | |||||
<filelist dir="." files="${output}/output"/> | |||||
</concat> | </concat> | ||||
</target> | </target> | ||||
<target name="trimfile"> | <target name="trimfile"> | ||||
<concat destfile="result/trimfile"> | |||||
<concat destfile="${output}/trimfile"> | |||||
This is the contents of the trimmed file. | This is the contents of the trimmed file. | ||||
This is the second line. | This is the second line. | ||||
<filterchain> | <filterchain> | ||||
@@ -63,7 +61,7 @@ | |||||
</target> | </target> | ||||
<target name="trimfilebyline"> | <target name="trimfilebyline"> | ||||
<concat destfile="result/trimfilebyline"> | |||||
<concat destfile="${output}/trimfilebyline"> | |||||
This is the contents of the trimmed file. | This is the contents of the trimmed file. | ||||
This is the second line. | This is the second line. | ||||
<filterchain> | <filterchain> | ||||
@@ -74,7 +72,7 @@ | |||||
</target> | </target> | ||||
<target name="filterreplacestring"> | <target name="filterreplacestring"> | ||||
<concat destfile="result/filterreplacestring"> | |||||
<concat destfile="${output}/filterreplacestring"> | |||||
This is foo bar | This is foo bar | ||||
<filterchain> | <filterchain> | ||||
<replacestring from="foo" to="the"/> | <replacestring from="foo" to="the"/> | ||||
@@ -93,11 +91,11 @@ | |||||
</target> | </target> | ||||
<target name="stringtokenizer"> | <target name="stringtokenizer"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
This is a number | This is a number | ||||
of words | of words | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/output" overwrite="yes"> | |||||
<copy file="${output}/input" tofile="${output}/output" overwrite="yes"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter delimoutput="#"> | <tokenfilter delimoutput="#"> | ||||
<stringtokenizer/> | <stringtokenizer/> | ||||
@@ -105,12 +103,12 @@ | |||||
</filterchain> | </filterchain> | ||||
</copy> | </copy> | ||||
<concat> | <concat> | ||||
<filelist dir="." files="result/output"/> | |||||
<filelist dir="." files="${output}/output"/> | |||||
</concat> | </concat> | ||||
</target> | </target> | ||||
<target name="unixlineoutput"> | <target name="unixlineoutput"> | ||||
<concat destfile="result/unixlineoutput"> | |||||
<concat destfile="${output}/unixlineoutput"> | |||||
This is a number | This is a number | ||||
of words | of words | ||||
<filterchain> | <filterchain> | ||||
@@ -122,7 +120,7 @@ | |||||
</target> | </target> | ||||
<target name="doslineoutput"> | <target name="doslineoutput"> | ||||
<concat destfile="result/doslineoutput"> | |||||
<concat destfile="${output}/doslineoutput"> | |||||
This is a number | This is a number | ||||
of words | of words | ||||
<filterchain> | <filterchain> | ||||
@@ -134,11 +132,11 @@ | |||||
</target> | </target> | ||||
<target name="filetokenizer"> | <target name="filetokenizer"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
This is a number | This is a number | ||||
of words | of words | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/filetokenizer"> | |||||
<copy file="${output}/input" tofile="${output}/filetokenizer"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<filetokenizer/> | <filetokenizer/> | ||||
@@ -149,7 +147,7 @@ | |||||
</target> | </target> | ||||
<target name="replacestring"> | <target name="replacestring"> | ||||
<concat destfile="result/replacestring"> | |||||
<concat destfile="${output}/replacestring"> | |||||
this is the sun | this is the sun | ||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
@@ -171,11 +169,11 @@ | |||||
</target> | </target> | ||||
<target name="containsstring"> | <target name="containsstring"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
this is a line contains foo | this is a line contains foo | ||||
this line does not | this line does not | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/containsstring"> | |||||
<copy file="${output}/input" tofile="${output}/containsstring"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<containsstring contains="foo"/> | <containsstring contains="foo"/> | ||||
@@ -186,14 +184,14 @@ | |||||
<!-- need to check for existence of regex --> | <!-- need to check for existence of regex --> | ||||
<target name="replaceregex"> | <target name="replaceregex"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
hello Hello HELLO hello | hello Hello HELLO hello | ||||
cat Cat cat | cat Cat cat | ||||
Sun Sun Sun | Sun Sun Sun | ||||
WhiteSpace tab | WhiteSpace tab | ||||
This is a line with digits - 1234 -- there | This is a line with digits - 1234 -- there | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/replaceregex"> | |||||
<copy file="${output}/input" tofile="${output}/replaceregex"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<replaceregex pattern="hello" replace="world" flags="gi"/> | <replaceregex pattern="hello" replace="world" flags="gi"/> | ||||
@@ -209,7 +207,7 @@ | |||||
</target> | </target> | ||||
<target name="filterreplaceregex"> | <target name="filterreplaceregex"> | ||||
<concat destfile="result/filterreplaceregex"> | |||||
<concat destfile="${output}/filterreplaceregex"> | |||||
hello Hello HELLO hello | hello Hello HELLO hello | ||||
<filterchain> | <filterchain> | ||||
<replaceregex pattern="hello" replace="world" flags="gi"/> | <replaceregex pattern="hello" replace="world" flags="gi"/> | ||||
@@ -228,12 +226,12 @@ | |||||
<!-- need to check for existence of regex --> | <!-- need to check for existence of regex --> | ||||
<target name="containsregex"> | <target name="containsregex"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
hello world | hello world | ||||
this is the moon | this is the moon | ||||
World here | World here | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/containsregex"> | |||||
<copy file="${output}/input" tofile="${output}/containsregex"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<containsregex pattern="(hello|world)" flags="i"/> | <containsregex pattern="(hello|world)" flags="i"/> | ||||
@@ -243,7 +241,7 @@ | |||||
</target> | </target> | ||||
<target name="filtercontainsregex"> | <target name="filtercontainsregex"> | ||||
<concat destfile="result/filtercontainsregex"> | |||||
<concat destfile="${output}/filtercontainsregex"> | |||||
hello world | hello world | ||||
this is the moon | this is the moon | ||||
World here | World here | ||||
@@ -258,11 +256,11 @@ | |||||
<!-- need to check for existence of regex --> | <!-- need to check for existence of regex --> | ||||
<target name="containsregex2"> | <target name="containsregex2"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
SUITE(TestSuite, bits); | SUITE(TestSuite, bits); | ||||
here | here | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/containsregex2"> | |||||
<copy file="${output}/input" tofile="${output}/containsregex2"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<containsregex | <containsregex | ||||
@@ -274,7 +272,7 @@ | |||||
</target> | </target> | ||||
<target name="deletecharacters"> | <target name="deletecharacters"> | ||||
<concat destfile="result/deletechars"> | |||||
<concat destfile="${output}/deletechars"> | |||||
This is some ### s | This is some ### s | ||||
some **** | some **** | ||||
<filterchain> | <filterchain> | ||||
@@ -287,10 +285,10 @@ | |||||
</target> | </target> | ||||
<target name="scriptfilter"> | <target name="scriptfilter"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
hello world | hello world | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/scriptfilter"> | |||||
<copy file="${output}/input" tofile="${output}/scriptfilter"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<scriptfilter language="javascript"> | <scriptfilter language="javascript"> | ||||
@@ -302,10 +300,10 @@ | |||||
</target> | </target> | ||||
<target name="scriptfilter2"> | <target name="scriptfilter2"> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
hello moon | hello moon | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/scriptfilter2"> | |||||
<copy file="${output}/input" tofile="${output}/scriptfilter2"> | |||||
<filterchain> | <filterchain> | ||||
<scriptfilter language="javascript"> | <scriptfilter language="javascript"> | ||||
self.setToken(self.getToken().toUpperCase()); | self.setToken(self.getToken().toUpperCase()); | ||||
@@ -327,11 +325,11 @@ | |||||
<classpath refid="test-classes"/> | <classpath refid="test-classes"/> | ||||
</typedef> | </typedef> | ||||
<concat destfile="result/input"> | |||||
<concat destfile="${output}/input"> | |||||
hello world | hello world | ||||
</concat> | </concat> | ||||
<copy file="result/input" tofile="result/custom"> | |||||
<copy file="${output}/input" tofile="${output}/custom"> | |||||
<filterchain> | <filterchain> | ||||
<tokenfilter> | <tokenfilter> | ||||
<stringtokenizer/> | <stringtokenizer/> | ||||
@@ -348,10 +346,10 @@ | |||||
</target> | </target> | ||||
<target name="hasregex"> | <target name="hasregex"> | ||||
<concat destfile="result/replaceregexp"> | |||||
<concat destfile="${output}/replaceregexp"> | |||||
hello world | hello world | ||||
</concat> | </concat> | ||||
<replaceregexp file="result/replaceregexp" | |||||
<replaceregexp file="${output}/replaceregexp" | |||||
match="hello( )world" | match="hello( )world" | ||||
replace="bye\1world"/> | replace="bye\1world"/> | ||||
</target> | </target> | ||||
@@ -17,50 +17,31 @@ | |||||
--> | --> | ||||
<project name="abstractcvstask-test" basedir="../../../../" | <project name="abstractcvstask-test" basedir="../../../../" | ||||
default="all"> | |||||
default="tearDown"> | |||||
<property name="file" value="ant.properties.sample" /> | |||||
<target name="all"> | |||||
<cvs failonerror="true" command="status ${file}"/> | |||||
<cvs failonerror="true"> | |||||
<commandline> | |||||
<argument value="up"/> | |||||
<argument value="-r"/> | |||||
<argument value="1.1"/> | |||||
<argument value="${file}"/> | |||||
</commandline> | |||||
</cvs> | |||||
<cvs failonerror="true" command="status ${file}"/> | |||||
<cvs failonerror="true"> | |||||
<commandline> | |||||
<argument line="up -r HEAD ${file}" /> | |||||
</commandline> | |||||
</cvs> | |||||
<cvs failonerror="true" command="status ${file}"/> | |||||
<import file="../buildfiletest-base.xml" optional="false"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
</target> | </target> | ||||
<target name="package-attribute"> | <target name="package-attribute"> | ||||
<mkdir dir="tmpdir" /> | |||||
<cvs cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" | |||||
package="ant/build.xml" | |||||
dest="tmpdir" | |||||
<cvs cvsroot="anoncvs@anoncvs.ca.openbsd.org:/cvs" | |||||
package="src/Makefile" | |||||
dest="${output}" | |||||
quiet="true" /> | quiet="true" /> | ||||
</target> | </target> | ||||
<target name="tag-attribute"> | <target name="tag-attribute"> | ||||
<mkdir dir="tmpdir" /> | |||||
<cvs cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" | |||||
package="ant/build.xml" | |||||
dest="tmpdir" | |||||
<cvs cvsroot="anoncvs@anoncvs.ca.openbsd.org:/cvs" | |||||
package="src/Makefile" | |||||
dest="${output}" | |||||
quiet="true" | quiet="true" | ||||
tag="ANT_141" /> | |||||
<cvs cvsroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" | |||||
package="ant/build.xml" | |||||
dest="tmpdir" | |||||
tag="OPENBSD_5_3" /> | |||||
<cvs cvsroot="anoncvs@anoncvs.ca.openbsd.org:/cvs" | |||||
package="src/Makefile" | |||||
dest="${output}" | |||||
command="status"/> | command="status"/> | ||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete dir="tmpdir" /> | |||||
</target> | |||||
</project> | </project> |
@@ -17,25 +17,27 @@ | |||||
* | * | ||||
--> | --> | ||||
<project name="javadoc" basedir="."> | <project name="javadoc" basedir="."> | ||||
<import file="../../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
</target> | |||||
<path id="path.dirset"> | <path id="path.dirset"> | ||||
<dirset dir="." /> | <dirset dir="." /> | ||||
</path> | </path> | ||||
<property name="javadoc" location="javadoc"/> | |||||
<target name="tearDown"> | |||||
<delete dir="${javadoc}" quiet="true"/> | |||||
</target> | |||||
<target name="dirsetPath"> | <target name="dirsetPath"> | ||||
<javadoc sourcepathref="path.dirset" packagenames="*" destdir="${javadoc}" /> | |||||
<javadoc sourcepathref="path.dirset" packagenames="*" destdir="${output}" /> | |||||
</target> | </target> | ||||
<target name="dirsetPathWithoutPackagenames"> | <target name="dirsetPathWithoutPackagenames"> | ||||
<javadoc sourcepathref="path.dirset" destdir="${javadoc}" /> | |||||
<javadoc sourcepathref="path.dirset" destdir="${output}" /> | |||||
</target> | </target> | ||||
<target name="nestedDirsetPath"> | <target name="nestedDirsetPath"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<sourcepath refid="path.dirset" /> | <sourcepath refid="path.dirset" /> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
@@ -48,29 +50,29 @@ | |||||
</path> | </path> | ||||
<target name="filesetPath"> | <target name="filesetPath"> | ||||
<javadoc sourcepathref="path.fileset" packagenames="*" destdir="${javadoc}" /> | |||||
<javadoc sourcepathref="path.fileset" packagenames="*" destdir="${output}" /> | |||||
</target> | </target> | ||||
<target name="nestedFilesetPath"> | <target name="nestedFilesetPath"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<sourcepath refid="path.fileset" /> | <sourcepath refid="path.fileset" /> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
<target name="nestedFilesetRefInPath"> | <target name="nestedFilesetRefInPath"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<fileset refid="fileset.inpath" /> | <fileset refid="fileset.inpath" /> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
<target name="nestedFilesetNoPatterns"> | <target name="nestedFilesetNoPatterns"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<fileset dir="java/"/> | <fileset dir="java/"/> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
<target name="doublyNestedFileset"> | <target name="doublyNestedFileset"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<sourcefiles> | <sourcefiles> | ||||
<fileset dir="java/" includes="**/*.java"/> | <fileset dir="java/" includes="**/*.java"/> | ||||
</sourcefiles> | </sourcefiles> | ||||
@@ -78,7 +80,7 @@ | |||||
</target> | </target> | ||||
<target name="doublyNestedFilesetNoPatterns"> | <target name="doublyNestedFilesetNoPatterns"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<sourcefiles> | <sourcefiles> | ||||
<fileset dir="java/"/> | <fileset dir="java/"/> | ||||
</sourcefiles> | </sourcefiles> | ||||
@@ -94,11 +96,11 @@ | |||||
<target name="filelistPath"> | <target name="filelistPath"> | ||||
<javadoc sourcepathref="path.filelist" packagenames="*" | <javadoc sourcepathref="path.filelist" packagenames="*" | ||||
destdir="${javadoc}" /> | |||||
destdir="${output}" /> | |||||
</target> | </target> | ||||
<target name="nestedFilelistPath"> | <target name="nestedFilelistPath"> | ||||
<javadoc packagenames="*" destdir="${javadoc}"> | |||||
<javadoc packagenames="*" destdir="${output}"> | |||||
<sourcepath refid="path.filelist" /> | <sourcepath refid="path.filelist" /> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
@@ -112,7 +114,7 @@ | |||||
<target name="pathelementPath"> | <target name="pathelementPath"> | ||||
<javadoc sourcepathref="path.pathelement.path" | <javadoc sourcepathref="path.pathelement.path" | ||||
packagenames="etc.testcases.taskdefs.javadoc.*" destdir="${javadoc}" /> | |||||
packagenames="etc.testcases.taskdefs.javadoc.*" destdir="${output}" /> | |||||
</target> | </target> | ||||
<path id="path.pathelement.location"> | <path id="path.pathelement.location"> | ||||
@@ -122,11 +124,11 @@ | |||||
<target name="pathelementLocationPath"> | <target name="pathelementLocationPath"> | ||||
<javadoc sourcepathref="path.pathelement.location" | <javadoc sourcepathref="path.pathelement.location" | ||||
packagenames="*" destdir="${javadoc}" /> | |||||
packagenames="*" destdir="${output}" /> | |||||
</target> | </target> | ||||
<target name="nestedSource"> | <target name="nestedSource"> | ||||
<javadoc destdir="${javadoc}"> | |||||
<javadoc destdir="${output}"> | |||||
<source file="java/ClassToJavadoc.java" /> | <source file="java/ClassToJavadoc.java" /> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
@@ -136,19 +138,17 @@ | |||||
</fileset> | </fileset> | ||||
<target name="nestedFilesetRef"> | <target name="nestedFilesetRef"> | ||||
<javadoc destdir="${javadoc}"> | |||||
<javadoc destdir="${output}"> | |||||
<fileset refid="fileset.simple" /> | <fileset refid="fileset.simple" /> | ||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
<target name="nonJavaIncludes"> | <target name="nonJavaIncludes"> | ||||
<delete dir="${javadoc}"/> | |||||
<mkdir dir="${javadoc}"/> | |||||
<echo file="${javadoc}/stuff1.java">public class stuff1 {}</echo> | |||||
<echo file="${javadoc}/stuff2.java">public class stuff2 {}</echo> | |||||
<echo file="${javadoc}/stuff.properties">x=4</echo> | |||||
<javadoc destdir="${javadoc}" failonerror="true"> | |||||
<fileset dir="${javadoc}"/> | |||||
<echo file="${output}/stuff1.java">public class stuff1 {}</echo> | |||||
<echo file="${output}/stuff2.java">public class stuff2 {}</echo> | |||||
<echo file="${output}/stuff.properties">x=4</echo> | |||||
<javadoc destdir="${output}" failonerror="true"> | |||||
<fileset dir="${output}"/> | |||||
</javadoc> | </javadoc> | ||||
</target> | </target> | ||||
@@ -16,6 +16,9 @@ | |||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project name="test" basedir="."> | <project name="test" basedir="."> | ||||
<import file="../buildfiletest-base.xml"/> | |||||
<path id="testclasses"> | <path id="testclasses"> | ||||
<pathelement location="../../../../build/testcases" /> | <pathelement location="../../../../build/testcases" /> | ||||
<pathelement path="${java.class.path}" /> | <pathelement path="${java.class.path}" /> | ||||
@@ -26,11 +29,11 @@ | |||||
classpathref="testclasses"/> | classpathref="testclasses"/> | ||||
<property name="map.ext" value=".copy2"/> | <property name="map.ext" value=".copy2"/> | ||||
<property name="rootScratchDir" value="test_multi_mapper_scratch_area"/> | |||||
<property name="rootScratchDir" value="${output}/test_multi_mapper_scratch_area"/> | |||||
<property name="baseScratchSrc" value="${rootScratchDir}/src"/> | <property name="baseScratchSrc" value="${rootScratchDir}/src"/> | ||||
<property name="baseScratchDest" value="${rootScratchDir}/dest"/> | <property name="baseScratchDest" value="${rootScratchDir}/dest"/> | ||||
<target name="setup"> | |||||
<target name="setUp"> | |||||
<delete dir="${baseScratchSrc}"/> | <delete dir="${baseScratchSrc}"/> | ||||
<mkdir dir="${baseScratchSrc}"/> | <mkdir dir="${baseScratchSrc}"/> | ||||
<delete dir="${baseScratchDest}"/> | <delete dir="${baseScratchDest}"/> | ||||
@@ -39,7 +42,7 @@ | |||||
</target> | </target> | ||||
<!-- test simple single file to multiple file move --> | <!-- test simple single file to multiple file move --> | ||||
<target name="multicopy" depends="setup"> | |||||
<target name="multicopy" depends="setUp"> | |||||
<copy todir="${baseScratchDest}" enablemultiplemappings="true"> | <copy todir="${baseScratchDest}" enablemultiplemappings="true"> | ||||
<fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | <fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | ||||
<mapper refid="testmapper"/> | <mapper refid="testmapper"/> | ||||
@@ -53,7 +56,7 @@ | |||||
<fail unless="multicopy.outcome">multicopy failed</fail> | <fail unless="multicopy.outcome">multicopy failed</fail> | ||||
</target> | </target> | ||||
<target name="multimove" depends="setup"> | |||||
<target name="multimove" depends="setUp"> | |||||
<move todir="${baseScratchDest}" enablemultiplemappings="true"> | <move todir="${baseScratchDest}" enablemultiplemappings="true"> | ||||
<fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | <fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | ||||
<mapper refid="testmapper"/> | <mapper refid="testmapper"/> | ||||
@@ -78,7 +81,7 @@ | |||||
task to ignore multiple mappings | task to ignore multiple mappings | ||||
--> | --> | ||||
<target name="singlecopy" depends="setup"> | |||||
<target name="singlecopy" depends="setUp"> | |||||
<copy todir="${baseScratchDest}" enablemultiplemappings="false"> | <copy todir="${baseScratchDest}" enablemultiplemappings="false"> | ||||
<fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | <fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | ||||
<mapper refid="testmapper"/> | <mapper refid="testmapper"/> | ||||
@@ -95,7 +98,7 @@ | |||||
<fail unless="singlecopy.outcome">singlecopy failed</fail> | <fail unless="singlecopy.outcome">singlecopy failed</fail> | ||||
</target> | </target> | ||||
<target name="singlemove" depends="setup"> | |||||
<target name="singlemove" depends="setUp"> | |||||
<move todir="${baseScratchDest}" enablemultiplemappings="false"> | <move todir="${baseScratchDest}" enablemultiplemappings="false"> | ||||
<fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | <fileset dir="${baseScratchSrc}" includes="somefile.txt"/> | ||||
<mapper refid="testmapper"/> | <mapper refid="testmapper"/> | ||||
@@ -185,8 +188,5 @@ | |||||
<fail unless="movewithempty.outcome">movewithempty failed</fail> | <fail unless="movewithempty.outcome">movewithempty failed</fail> | ||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete dir="${rootScratchDir}"/> | |||||
</target> | |||||
</project> | </project> |
@@ -18,41 +18,38 @@ | |||||
--> | --> | ||||
<project default="no"> | <project default="no"> | ||||
<property name="out" location="output"/> | |||||
<property name="in" location="input"/> | |||||
<target name="no"> | |||||
<fail>For tests only</fail> | |||||
</target> | |||||
<import file="../../../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | <target name="setUp"> | ||||
<mkdir dir="${out}"/> | |||||
<mkdir dir="${output}"/> | |||||
</target> | </target> | ||||
<target name="tearDown"> | |||||
<delete dir="${out}"/> | |||||
<property name="in" location="input"/> | |||||
<target name="no"> | |||||
<fail>For tests only</fail> | |||||
</target> | </target> | ||||
<target name="compile" depends="setUp"> | <target name="compile" depends="setUp"> | ||||
<javac srcdir="${in}" destdir="${out}"/> | |||||
<javac srcdir="${in}" destdir="${output}"/> | |||||
</target> | </target> | ||||
<target name="simple-compile" depends="compile"> | <target name="simple-compile" depends="compile"> | ||||
<javah destdir="${out}"> | |||||
<javah destdir="${output}"> | |||||
<class name="org.example.Foo"/> | <class name="org.example.Foo"/> | ||||
<classpath> | <classpath> | ||||
<pathelement location="${out}"/> | |||||
<pathelement location="${output}"/> | |||||
</classpath> | </classpath> | ||||
</javah> | </javah> | ||||
</target> | </target> | ||||
<target name="test-fileset" depends="compile"> | <target name="test-fileset" depends="compile"> | ||||
<javah destdir="${out}"> | |||||
<fileset dir="${out}"> | |||||
<javah destdir="${output}"> | |||||
<fileset dir="${output}"> | |||||
<include name="**/*.class"/> | <include name="**/*.class"/> | ||||
</fileset> | </fileset> | ||||
<classpath> | <classpath> | ||||
<pathelement location="${out}"/> | |||||
<pathelement location="${output}"/> | |||||
</classpath> | </classpath> | ||||
</javah> | </javah> | ||||
</target> | </target> | ||||
@@ -18,23 +18,20 @@ | |||||
--> | --> | ||||
<project default="no"> | <project default="no"> | ||||
<property name="out" location="output"/> | |||||
<property name="in" location="input"/> | |||||
<target name="no"> | |||||
<fail>For tests only</fail> | |||||
</target> | |||||
<import file="../../../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | <target name="setUp"> | ||||
<mkdir dir="${out}"/> | |||||
<mkdir dir="${output}"/> | |||||
</target> | </target> | ||||
<target name="tearDown"> | |||||
<delete dir="${out}"/> | |||||
<property name="in" location="input"/> | |||||
<target name="no"> | |||||
<fail>For tests only</fail> | |||||
</target> | </target> | ||||
<target name="testIso8859-1" depends="setUp"> | <target name="testIso8859-1" depends="setUp"> | ||||
<native2ascii encoding="ISO8859-1" dest="${out}" | |||||
<native2ascii encoding="ISO8859-1" dest="${output}" | |||||
src="${in}" includes="iso8859-1.*"/> | src="${in}" includes="iso8859-1.*"/> | ||||
</target> | </target> | ||||
</project> | </project> |
@@ -18,6 +18,13 @@ | |||||
<project name="tar-test" basedir="." default="test1"> | <project name="tar-test" basedir="." default="test1"> | ||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
<mkdir dir="${output}/untar"/> | |||||
</target> | |||||
<target name="test1"> | <target name="test1"> | ||||
<tar/> | <tar/> | ||||
</target> | </target> | ||||
@@ -31,172 +38,163 @@ | |||||
</target> | </target> | ||||
<target name="test4"> | <target name="test4"> | ||||
<touch file="test4.tar"/> | |||||
<tar destfile="test4.tar" | |||||
basedir="."/> | |||||
<touch file="${output}/test4.tar"/> | |||||
<tar destfile="${output}/test4.tar" | |||||
basedir="${output}"/> | |||||
</target> | </target> | ||||
<target name="test5"> | <target name="test5"> | ||||
<mkdir dir="test5dir"/> | |||||
<tar destfile="test5.tar" | |||||
basedir="." | |||||
<mkdir dir="${output}/test5dir"/> | |||||
<tar destfile="${output}/test5.tar" | |||||
basedir="${output}" | |||||
includes="test5dir"/> | includes="test5dir"/> | ||||
</target> | </target> | ||||
<target name="test6"> | <target name="test6"> | ||||
<tar destfile="blah" longfile="Foo"/> | |||||
<tar destfile="${output}/blah" longfile="Foo"/> | |||||
</target> | </target> | ||||
<target name="test7"> | <target name="test7"> | ||||
<mkdir dir="test7dir"/> | |||||
<tar destfile="test7.tar"> | |||||
<tarfileset dir="." prefix="test7-prefix/"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="."/> | |||||
</copy> | |||||
<mkdir dir="${output}/test7dir"/> | |||||
<tar destfile="${output}/test7.tar"> | |||||
<tarfileset dir="${output}" prefix="test7-prefix/"> | |||||
<include name="test7dir"/> | <include name="test7dir"/> | ||||
</tarfileset> | </tarfileset> | ||||
<tarfileset dir="." prefix=""> | |||||
<tarfileset dir="${output}" prefix=""> | |||||
<include name="test7dir"/> | <include name="test7dir"/> | ||||
</tarfileset> | </tarfileset> | ||||
</tar> | </tar> | ||||
<untar src="test7.tar" dest="."/> | |||||
<untar src="${output}/test7.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test7UsingPlainFileSet"> | <target name="test7UsingPlainFileSet"> | ||||
<mkdir dir="test7dir"/> | |||||
<tar destfile="test7.tar"> | |||||
<tarfileset dir="." prefix="test7-prefix/"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="."/> | |||||
</copy> | |||||
<mkdir dir="${output}/test7dir"/> | |||||
<tar destfile="${output}/test7.tar"> | |||||
<tarfileset dir="${output}" prefix="test7-prefix/"> | |||||
<include name="test7dir"/> | <include name="test7dir"/> | ||||
</tarfileset> | </tarfileset> | ||||
<fileset dir="."> | |||||
<fileset dir="${output}"> | |||||
<include name="test7dir"/> | <include name="test7dir"/> | ||||
</fileset> | </fileset> | ||||
</tar> | </tar> | ||||
<untar src="test7.tar" dest="."/> | |||||
<untar src="${output}/test7.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test7UsingFileList"> | <target name="test7UsingFileList"> | ||||
<mkdir dir="test7dir"/> | |||||
<tar destfile="test7.tar"> | |||||
<tarfileset dir="." prefix="test7-prefix/"> | |||||
<copy todir="${output}"> | |||||
<fileset dir="."/> | |||||
</copy> | |||||
<mkdir dir="${output}/test7dir"/> | |||||
<tar destfile="${output}/test7.tar"> | |||||
<tarfileset dir="${output}" prefix="test7-prefix/"> | |||||
<include name="test7dir"/> | <include name="test7dir"/> | ||||
</tarfileset> | </tarfileset> | ||||
<filelist dir="."> | |||||
<filelist dir="${output}"> | |||||
<file name="test7dir"/> | <file name="test7dir"/> | ||||
</filelist> | </filelist> | ||||
</tar> | </tar> | ||||
<untar src="test7.tar" dest="."/> | |||||
<untar src="${output}/test7.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test8"> | <target name="test8"> | ||||
<tar destfile="test8.tar"> | |||||
<tar destfile="${output}/test8.tar"> | |||||
<tarfileset dir="." fullpath="/test8.xml"> | <tarfileset dir="." fullpath="/test8.xml"> | ||||
<include name="tar.xml"/> | <include name="tar.xml"/> | ||||
</tarfileset> | </tarfileset> | ||||
</tar> | </tar> | ||||
<untar src="test8.tar" dest="."/> | |||||
<untar src="${output}/test8.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test8UsingZipFileset"> | <target name="test8UsingZipFileset"> | ||||
<tar destfile="test8.tar"> | |||||
<tar destfile="${output}/test8.tar"> | |||||
<zipfileset dir="." fullpath="/test8.xml"> | <zipfileset dir="." fullpath="/test8.xml"> | ||||
<include name="tar.xml"/> | <include name="tar.xml"/> | ||||
</zipfileset> | </zipfileset> | ||||
</tar> | </tar> | ||||
<untar src="test8.tar" dest="."/> | |||||
<untar src="${output}/test8.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test8UsingZipFilesetSrc"> | <target name="test8UsingZipFilesetSrc"> | ||||
<zip destfile="test7.tar" basedir="." includes="tar.xml"/> | |||||
<tar destfile="test8.tar"> | |||||
<zipfileset src="test7.tar" fullpath="/test8.xml"> | |||||
<zip destfile="${output}/test7.tar" basedir="." includes="tar.xml"/> | |||||
<tar destfile="${output}/test8.tar"> | |||||
<zipfileset src="${output}/test7.tar" fullpath="/test8.xml"> | |||||
<include name="tar.xml"/> | <include name="tar.xml"/> | ||||
</zipfileset> | </zipfileset> | ||||
</tar> | </tar> | ||||
<untar src="test8.tar" dest="."/> | |||||
<untar src="${output}/test8.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test8UsingTarFilesetSrc"> | <target name="test8UsingTarFilesetSrc"> | ||||
<tar destfile="test7.tar" basedir="." includes="tar.xml"/> | |||||
<tar destfile="test8.tar"> | |||||
<tarfileset src="test7.tar" fullpath="/test8.xml"> | |||||
<tar destfile="${output}/test7.tar" basedir="." includes="tar.xml"/> | |||||
<tar destfile="${output}/test8.tar"> | |||||
<tarfileset src="${output}/test7.tar" fullpath="/test8.xml"> | |||||
<include name="tar.xml"/> | <include name="tar.xml"/> | ||||
</tarfileset> | </tarfileset> | ||||
</tar> | </tar> | ||||
<untar src="test8.tar" dest="."/> | |||||
<untar src="${output}/test8.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test8UsingZipEntry"> | <target name="test8UsingZipEntry"> | ||||
<zip destfile="test7.tar"> | |||||
<zip destfile="${output}/test7.tar"> | |||||
<zipfileset dir="." includes="tar.xml" fullpath="/test8.xml"/> | <zipfileset dir="." includes="tar.xml" fullpath="/test8.xml"/> | ||||
</zip> | </zip> | ||||
<tar destfile="test8.tar"> | |||||
<zipentry archive="test7.tar" name="/test8.xml"/> | |||||
<tar destfile="${output}/test8.tar"> | |||||
<zipentry archive="${output}/test7.tar" name="/test8.xml"/> | |||||
</tar> | </tar> | ||||
<untar src="test8.tar" dest="."/> | |||||
<untar src="${output}/test8.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="test9"> | <target name="test9"> | ||||
<tar destfile="blah" compression="Foo"/> | |||||
<tar destfile="${output}/blah" compression="Foo"/> | |||||
</target> | </target> | ||||
<target name="test10"> | <target name="test10"> | ||||
<tar destfile="test10.tar.gz" compression="gzip"> | |||||
<tar destfile="${output}/test10.tar.gz" compression="gzip"> | |||||
<tarfileset dir="." fullpath="/test10.xml"> | <tarfileset dir="." fullpath="/test10.xml"> | ||||
<include name="tar.xml"/> | <include name="tar.xml"/> | ||||
</tarfileset> | </tarfileset> | ||||
</tar> | </tar> | ||||
<untar src="test10.tar.gz" dest="." compression="gzip"/> | |||||
<untar src="${output}/test10.tar.gz" dest="${output}/untar" compression="gzip"/> | |||||
</target> | </target> | ||||
<target name="test11"> | <target name="test11"> | ||||
<tar destfile="test11.tar.bz2" compression="bzip2"> | |||||
<tar destfile="${output}/test11.tar.bz2" compression="bzip2"> | |||||
<tarfileset dir="." fullpath="/test11.xml"> | <tarfileset dir="." fullpath="/test11.xml"> | ||||
<include name="tar.xml"/> | <include name="tar.xml"/> | ||||
</tarfileset> | </tarfileset> | ||||
</tar> | </tar> | ||||
<untar src="test11.tar.bz2" dest="." compression="bzip2"/> | |||||
</target> | |||||
<target name="cleanup"> | |||||
<delete file="test4.tar"/> | |||||
<delete file="test5.tar"/> | |||||
<delete file="asf-logo.gif.tar"/> | |||||
<delete dir="testout"/> | |||||
<delete dir="test5dir"/> | |||||
<delete dir="test7dir"/> | |||||
<delete dir="test7-prefix"/> | |||||
<delete file="test7.tar"/> | |||||
<delete file="test8.tar"/> | |||||
<delete file="test8.xml"/> | |||||
<delete file="test10.tar.gz"/> | |||||
<delete file="test10.xml"/> | |||||
<delete file="test11.tar.bz2"/> | |||||
<delete file="test11.xml"/> | |||||
<delete file="asf-logo.gif.tar.gz"/> | |||||
<delete file="asf-logo.gif.tar.bz2"/> | |||||
<untar src="${output}/test11.tar.bz2" dest="${output}/untar" compression="bzip2"/> | |||||
</target> | </target> | ||||
<target name="feather"> | <target name="feather"> | ||||
<tar destfile="asf-logo.gif.tar" | |||||
<tar destfile="${output}/asf-logo.gif.tar" | |||||
basedir=".." | basedir=".." | ||||
includes="asf-logo.gif" /> | includes="asf-logo.gif" /> | ||||
<tar destfile="asf-logo.gif.tar.gz" | |||||
<tar destfile="${output}/asf-logo.gif.tar.gz" | |||||
basedir=".." | basedir=".." | ||||
includes="asf-logo.gif" | includes="asf-logo.gif" | ||||
compression="gzip"/> | compression="gzip"/> | ||||
<tar destfile="asf-logo.gif.tar.bz2" | |||||
<tar destfile="${output}/asf-logo.gif.tar.bz2" | |||||
basedir=".." | basedir=".." | ||||
includes="asf-logo.gif" | includes="asf-logo.gif" | ||||
compression="bzip2" /> | compression="bzip2" /> | ||||
</target> | </target> | ||||
<target name="testGZipResource"> | <target name="testGZipResource"> | ||||
<mkdir dir="testout"/> | |||||
<tar destfile="testout/test.tar"> | |||||
<mkdir dir="${output}/testout"/> | |||||
<tar destfile="${output}/testout/test.tar"> | |||||
<gzipresource> | <gzipresource> | ||||
<file file="expected/asf-logo.gif.gz"/> | <file file="expected/asf-logo.gif.gz"/> | ||||
</gzipresource> | </gzipresource> | ||||
</tar> | </tar> | ||||
<untar src="testout/test.tar" dest="testout"/> | |||||
<untar src="${output}/testout/test.tar" dest="${output}/untar"/> | |||||
</target> | </target> | ||||
</project> | </project> |
@@ -16,82 +16,79 @@ | |||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project basedir="." default="cleanup"> | |||||
<project basedir="." default="tearDown"> | |||||
<target name="cleanup"> | |||||
<delete file="asf-logo.gif" /> | |||||
<delete file="untartest.tar" /> | |||||
<delete dir="untartestin"/> | |||||
<delete dir="untartestout"/> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
<mkdir dir="${output}/untar"/> | |||||
</target> | </target> | ||||
<target name="testTarTask"> | <target name="testTarTask"> | ||||
<ant antfile="tar.xml" target="feather" /> | <ant antfile="tar.xml" target="feather" /> | ||||
<untar src="asf-logo.gif.tar" dest="." /> | |||||
<ant antfile="tar.xml" target="cleanup" /> | |||||
<untar src="${output}/asf-logo.gif.tar" dest="${output}/untar" /> | |||||
</target> | </target> | ||||
<target name="testGzipTarTask"> | <target name="testGzipTarTask"> | ||||
<ant antfile="tar.xml" target="feather" /> | <ant antfile="tar.xml" target="feather" /> | ||||
<untar src="asf-logo.gif.tar.gz" dest="." compression="gzip" /> | |||||
<ant antfile="tar.xml" target="cleanup" /> | |||||
<untar src="${output}/asf-logo.gif.tar.gz" dest="${output}/untar" compression="gzip" /> | |||||
</target> | </target> | ||||
<target name="testBzip2TarTask"> | <target name="testBzip2TarTask"> | ||||
<ant antfile="tar.xml" target="feather" /> | <ant antfile="tar.xml" target="feather" /> | ||||
<untar src="asf-logo.gif.tar.bz2" dest="." compression="bzip2"/> | |||||
<ant antfile="tar.xml" target="cleanup" /> | |||||
<untar src="${output}/asf-logo.gif.tar.bz2" dest="${output}/untar" compression="bzip2"/> | |||||
</target> | </target> | ||||
<target name="realTest"> | <target name="realTest"> | ||||
<untar src="expected/asf-logo.gif.tar" dest="." /> | |||||
<untar src="expected/asf-logo.gif.tar" dest="${output}/untar" /> | |||||
</target> | </target> | ||||
<target name="realGzipTest"> | <target name="realGzipTest"> | ||||
<untar src="expected/asf-logo.gif.tar.gz" dest="." compression="gzip" /> | |||||
<untar src="expected/asf-logo.gif.tar.gz" dest="${output}/untar" compression="gzip" /> | |||||
</target> | </target> | ||||
<target name="realBzip2Test"> | <target name="realBzip2Test"> | ||||
<untar src="expected/asf-logo.gif.tar.bz2" dest="." compression="bzip2"/> | |||||
<untar src="expected/asf-logo.gif.tar.bz2" dest="${output}/untar" compression="bzip2"/> | |||||
</target> | </target> | ||||
<target name="srcDirTest"> | <target name="srcDirTest"> | ||||
<untar src="." dest="." /> | |||||
<untar src="." dest="${output}/untar" /> | |||||
</target> | </target> | ||||
<target name="encoding"> | <target name="encoding"> | ||||
<untar src="expected/asf-logo.gif.tar" dest="." encoding="foo"/> | |||||
<untar src="expected/asf-logo.gif.tar" dest="${output}/untar" encoding="foo"/> | |||||
</target> | </target> | ||||
<target name="resourceCollection"> | <target name="resourceCollection"> | ||||
<mkdir dir="untartestout"/> | |||||
<zip destfile="untartestout/test.zip"> | |||||
<mkdir dir="${output}/untartestout"/> | |||||
<zip destfile="${output}/untartestout/test.zip"> | |||||
<fileset dir="expected"> | <fileset dir="expected"> | ||||
<include name="asf-logo.gif.tar"/> | <include name="asf-logo.gif.tar"/> | ||||
</fileset> | </fileset> | ||||
</zip> | </zip> | ||||
<untar dest="."> | |||||
<zipfileset src="untartestout/test.zip"> | |||||
<untar dest="${output}/untar"> | |||||
<zipfileset src="${output}/untartestout/test.zip"> | |||||
<include name="*.tar"/> | <include name="*.tar"/> | ||||
</zipfileset> | </zipfileset> | ||||
</untar> | </untar> | ||||
</target> | </target> | ||||
<target name="prepareTestTar"> | <target name="prepareTestTar"> | ||||
<mkdir dir="untartestin/1"/> | |||||
<mkdir dir="untartestin/2"/> | |||||
<touch file="untartestin/1/foo"/> | |||||
<touch file="untartestin/2/bar"/> | |||||
<copy todir="untartestin/2"> | |||||
<mkdir dir="${output}/untartestin/1"/> | |||||
<mkdir dir="${output}/untartestin/2"/> | |||||
<touch file="${output}/untartestin/1/foo"/> | |||||
<touch file="${output}/untartestin/2/bar"/> | |||||
<copy todir="${output}/untartestin/2"> | |||||
<fileset dir="expected" includes="*md5*"/> | <fileset dir="expected" includes="*md5*"/> | ||||
</copy> | </copy> | ||||
<tar destfile="untartest.tar" basedir="untartestin"/> | |||||
<tar destfile="${output}/untartest.tar" basedir="${output}/untartestin"/> | |||||
</target> | </target> | ||||
<target name="testDocumentationClaimsOnCopy" depends="prepareTestTar"> | <target name="testDocumentationClaimsOnCopy" depends="prepareTestTar"> | ||||
<copy todir="untartestout" preservelastmodified="true"> | |||||
<tarfileset src="untartest.tar"> | |||||
<copy todir="${output}/untar" preservelastmodified="true"> | |||||
<tarfileset src="${output}/untartest.tar"> | |||||
<patternset> | <patternset> | ||||
<include name="2/"/> | <include name="2/"/> | ||||
</patternset> | </patternset> | ||||
@@ -18,13 +18,13 @@ | |||||
<project name="xxx-test" basedir="." default="test1"> | <project name="xxx-test" basedir="." default="test1"> | ||||
<target name="cleanup"> | |||||
<delete file="asf-logo.gif" /> | |||||
<delete file="unziptest.zip"/> | |||||
<delete dir="unziptestin"/> | |||||
<delete dir="unziptestout"/> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
</target> | </target> | ||||
<target name="test1"> | <target name="test1"> | ||||
<unzip/> | <unzip/> | ||||
</target> | </target> | ||||
@@ -39,30 +39,28 @@ | |||||
<target name="testZipTask"> | <target name="testZipTask"> | ||||
<ant antfile="zip.xml" target="feather" /> | <ant antfile="zip.xml" target="feather" /> | ||||
<unzip src="asf-logo.gif.zip" dest="." /> | |||||
<ant antfile="zip.xml" target="cleanup" /> | |||||
<unzip src="${output}/asf-logo.gif.zip" dest="${output}" /> | |||||
</target> | </target> | ||||
<target name="testUncompressedZipTask"> | <target name="testUncompressedZipTask"> | ||||
<ant antfile="zip.xml" target="uncompressed-feather" /> | <ant antfile="zip.xml" target="uncompressed-feather" /> | ||||
<unzip src="asf-logo.gif.zip" dest="." /> | |||||
<ant antfile="zip.xml" target="cleanup" /> | |||||
<unzip src="${output}/asf-logo.gif.zip" dest="${output}" /> | |||||
</target> | </target> | ||||
<target name="realTest"> | <target name="realTest"> | ||||
<unzip src="expected/asf-logo.gif.zip" dest="." /> | |||||
<unzip src="expected/asf-logo.gif.zip" dest="${output}" /> | |||||
</target> | </target> | ||||
<target name="prepareTestZip"> | <target name="prepareTestZip"> | ||||
<mkdir dir="unziptestin/1"/> | |||||
<mkdir dir="unziptestin/2"/> | |||||
<touch file="unziptestin/1/foo"/> | |||||
<touch file="unziptestin/2/bar"/> | |||||
<zip destfile="unziptest.zip" basedir="unziptestin"/> | |||||
<mkdir dir="${output}/unziptestin/1"/> | |||||
<mkdir dir="${output}/unziptestin/2"/> | |||||
<touch file="${output}/unziptestin/1/foo"/> | |||||
<touch file="${output}/unziptestin/2/bar"/> | |||||
<zip destfile="${output}/unziptest.zip" basedir="${output}/unziptestin"/> | |||||
</target> | </target> | ||||
<target name="testPatternSetExcludeOnly" depends="prepareTestZip"> | <target name="testPatternSetExcludeOnly" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<exclude name="1/**"/> | <exclude name="1/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -70,7 +68,7 @@ | |||||
</target> | </target> | ||||
<target name="testPatternSetIncludeOnly" depends="prepareTestZip"> | <target name="testPatternSetIncludeOnly" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="2/**"/> | <include name="2/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -78,7 +76,7 @@ | |||||
</target> | </target> | ||||
<target name="testPatternSetIncludeAndExclude" depends="prepareTestZip"> | <target name="testPatternSetIncludeAndExclude" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="2/**"/> | <include name="2/**"/> | ||||
<exclude name="2/**"/> | <exclude name="2/**"/> | ||||
@@ -87,7 +85,7 @@ | |||||
</target> | </target> | ||||
<target name="testTwoPatternSets" depends="prepareTestZip"> | <target name="testTwoPatternSets" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="2/**"/> | <include name="2/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -98,7 +96,7 @@ | |||||
</target> | </target> | ||||
<target name="testTwoPatternSetsWithExcludes" depends="prepareTestZip"> | <target name="testTwoPatternSetsWithExcludes" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="2/**"/> | <include name="2/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -110,13 +108,13 @@ | |||||
</target> | </target> | ||||
<target name="selfExtractingArchive"> | <target name="selfExtractingArchive"> | ||||
<mkdir dir="unziptestout"/> | |||||
<unzip dest="unziptestout" src="zip/test.exe"/> | |||||
<mkdir dir="${output}/unziptestout"/> | |||||
<unzip dest="${output}/unziptestout" src="zip/test.exe"/> | |||||
</target> | </target> | ||||
<!-- Bugzilla Report 20969 --> | <!-- Bugzilla Report 20969 --> | ||||
<target name="testPatternSetSlashOnly" depends="prepareTestZip"> | <target name="testPatternSetSlashOnly" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="2/"/> | <include name="2/"/> | ||||
</patternset> | </patternset> | ||||
@@ -125,16 +123,16 @@ | |||||
<!-- Bugzilla Report 10504 --> | <!-- Bugzilla Report 10504 --> | ||||
<target name="encodingTest"> | <target name="encodingTest"> | ||||
<mkdir dir="unziptestin"/> | |||||
<touch file="unziptestin/foo"/> | |||||
<zip zipfile="unziptest.zip" basedir="unziptestin" encoding="UnicodeBig"/> | |||||
<mkdir dir="unziptestout"/> | |||||
<unzip src="unziptest.zip" dest="unziptestout" encoding="UnicodeBig"/> | |||||
<mkdir dir="${output}/unziptestin"/> | |||||
<touch file="${output}/unziptestin/foo"/> | |||||
<zip zipfile="${output}/unziptest.zip" basedir="${output}/unziptestin" encoding="UnicodeBig"/> | |||||
<mkdir dir="${output}/unziptestout"/> | |||||
<unzip src="${output}/unziptest.zip" dest="${output}/unziptestout" encoding="UnicodeBig"/> | |||||
</target> | </target> | ||||
<!-- Bugzilla Report 21996 --> | <!-- Bugzilla Report 21996 --> | ||||
<target name="testFlattenMapper" depends="prepareTestZip"> | <target name="testFlattenMapper" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="1/**"/> | <include name="1/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -144,7 +142,7 @@ | |||||
<!-- Bugzilla Report 21996 --> | <!-- Bugzilla Report 21996 --> | ||||
<target name="testGlobMapper" depends="prepareTestZip"> | <target name="testGlobMapper" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="1/**"/> | <include name="1/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -153,7 +151,7 @@ | |||||
</target> | </target> | ||||
<target name="testTwoMappers" depends="prepareTestZip"> | <target name="testTwoMappers" depends="prepareTestZip"> | ||||
<unzip dest="unziptestout" src="unziptest.zip"> | |||||
<unzip dest="${output}/unziptestout" src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="1/**"/> | <include name="1/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -163,7 +161,7 @@ | |||||
</target> | </target> | ||||
<target name="testResourceCollection"> | <target name="testResourceCollection"> | ||||
<unzip dest="unziptestout"> | |||||
<unzip dest="${output}/unziptestout"> | |||||
<patternset> | <patternset> | ||||
<include name="junit/**"/> | <include name="junit/**"/> | ||||
</patternset> | </patternset> | ||||
@@ -175,8 +173,8 @@ | |||||
</target> | </target> | ||||
<target name="testDocumentationClaimsOnCopy" depends="prepareTestZip"> | <target name="testDocumentationClaimsOnCopy" depends="prepareTestZip"> | ||||
<copy todir="unziptestout" preservelastmodified="true"> | |||||
<zipfileset src="unziptest.zip"> | |||||
<copy todir="${output}/unziptestout" preservelastmodified="true"> | |||||
<zipfileset src="${output}/unziptest.zip"> | |||||
<patternset> | <patternset> | ||||
<include name="2/"/> | <include name="2/"/> | ||||
</patternset> | </patternset> | ||||
@@ -18,26 +18,32 @@ | |||||
<project name="zip-test" basedir="." default="test1"> | <project name="zip-test" basedir="." default="test1"> | ||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
</target> | |||||
<target name="test1"> | <target name="test1"> | ||||
<zip/> | <zip/> | ||||
</target> | </target> | ||||
<target name="test2"> | <target name="test2"> | ||||
<zip destFile="zip.tmp"/> | |||||
<zip destFile="${output}/zip.tmp"/> | |||||
</target> | </target> | ||||
<!-- Test when the zip file includes itself | <!-- Test when the zip file includes itself | ||||
when target file exists before the zip task is run --> | when target file exists before the zip task is run --> | ||||
<target name="test3"> | <target name="test3"> | ||||
<touch file="test3.zip"/> | |||||
<zip destFile="test3.zip" | |||||
basedir="."/> | |||||
<touch file="${output}/test3.zip"/> | |||||
<zip destFile="${output}/test3.zip" | |||||
basedir="${output}/"/> | |||||
</target> | </target> | ||||
<!-- Test when the zip file includes itself | <!-- Test when the zip file includes itself | ||||
when target file does not exist before the zip task is run | when target file does not exist before the zip task is run | ||||
<target name="test4"> | <target name="test4"> | ||||
<zip destFile="test4.zip" | |||||
<zip destFile="${output}/test4.zip" | |||||
basedir="."/> | basedir="."/> | ||||
</target> | </target> | ||||
--> | --> | ||||
@@ -49,44 +55,47 @@ | |||||
</target> | </target> | ||||
<target name="test6"> | <target name="test6"> | ||||
<zip destFile="test6.zip" basedir="."> | |||||
<zip destFile="${output}/test6.zip" basedir="."> | |||||
<include name="*.xml" /> | <include name="*.xml" /> | ||||
<exclude name="zip.*" /> | <exclude name="zip.*" /> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="test7"> | <target name="test7"> | ||||
<zip destFile="inner7.zip" basedir="." > | |||||
<copy todir="${output}"> | |||||
<fileset dir="."/> | |||||
</copy> | |||||
<zip destFile="${output}/inner7.zip" basedir="${output}" > | |||||
<exclude name="inner7.zip" /> | <exclude name="inner7.zip" /> | ||||
</zip> | </zip> | ||||
<zip destFile="test7.zip" basedir="."> | |||||
<zip destFile="${output}/test7.zip" basedir="."> | |||||
<exclude name="**/*.*" /> | <exclude name="**/*.*" /> | ||||
<zipfileset src="inner7.zip" /> | |||||
<zipfileset src="${output}/inner7.zip" /> | |||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="feather"> | <target name="feather"> | ||||
<zip destFile="asf-logo.gif.zip" | |||||
<zip destFile="${output}/asf-logo.gif.zip" | |||||
basedir=".." | basedir=".." | ||||
includes="asf-logo.gif" /> | includes="asf-logo.gif" /> | ||||
</target> | </target> | ||||
<target name="uncompressed-feather"> | <target name="uncompressed-feather"> | ||||
<zip destFile="asf-logo.gif.zip" | |||||
<zip destFile="${output}/asf-logo.gif.zip" | |||||
basedir=".." | basedir=".." | ||||
includes="asf-logo.gif" compress="false"/> | includes="asf-logo.gif" compress="false"/> | ||||
</target> | </target> | ||||
<!-- legacy attribute support --> | <!-- legacy attribute support --> | ||||
<target name="test8"> | <target name="test8"> | ||||
<zip zipfile="test8.zip" basedir="." > | |||||
<zip zipfile="${output}/test8.zip" basedir="." > | |||||
<exclude name="test8.zip" /> | <exclude name="test8.zip" /> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="testZipgroupfileset"> | <target name="testZipgroupfileset"> | ||||
<zip zipfile="zipgroupfileset.zip" basedir="."> | |||||
<zip zipfile="${output}/zipgroupfileset.zip" basedir="."> | |||||
<zipgroupfileset dir="zip" | <zipgroupfileset dir="zip" | ||||
includes="zipgroupfileset*.zip" | includes="zipgroupfileset*.zip" | ||||
excludes="zipgroupfileset3.zip" /> | excludes="zipgroupfileset3.zip" /> | ||||
@@ -96,13 +105,13 @@ | |||||
<target name="testDuplicateFail"> | <target name="testDuplicateFail"> | ||||
<zip zipfile="duplicateFail.zip" basedir="." duplicate="fail"> | |||||
<zip zipfile="${output}/duplicateFail.zip" basedir="." duplicate="fail"> | |||||
<zipgroupfileset dir="duplicate" includes="duplicate*.zip" /> | <zipgroupfileset dir="duplicate" includes="duplicate*.zip" /> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="testUpdateNotNecessary" depends="feather"> | <target name="testUpdateNotNecessary" depends="feather"> | ||||
<zip destFile="asf-logo.gif.zip" | |||||
<zip destFile="${output}/asf-logo.gif.zip" | |||||
basedir=".." | basedir=".." | ||||
includes="asf-logo.gif" | includes="asf-logo.gif" | ||||
update="true" /> | update="true" /> | ||||
@@ -110,16 +119,17 @@ | |||||
<target name="testUpdateIsNecessary" depends="feather"> | <target name="testUpdateIsNecessary" depends="feather"> | ||||
<sleep seconds="5" /> | <sleep seconds="5" /> | ||||
<touch file="../dummyfile" /> | |||||
<zip destFile="asf-logo.gif.zip" | |||||
basedir=".." | |||||
<touch file="${output}/dummyfile" /> | |||||
<copy file="../asf-logo.gif" todir="${output}"/> | |||||
<zip destFile="${output}/asf-logo.gif.zip" | |||||
basedir="${output}" | |||||
includes="asf-logo.gif,dummyfile" | includes="asf-logo.gif,dummyfile" | ||||
update="true" /> | update="true" /> | ||||
</target> | </target> | ||||
<!-- Bugzilla Report 18403 --> | <!-- Bugzilla Report 18403 --> | ||||
<target name="testPrefixAddsDir"> | <target name="testPrefixAddsDir"> | ||||
<zip destfile="test3.zip" filesonly="false"> | |||||
<zip destFile="${output}/test3.zip" filesonly="false"> | |||||
<zipfileset dir="." prefix="test" includes="zip.xml"/> | <zipfileset dir="." prefix="test" includes="zip.xml"/> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
@@ -128,23 +138,23 @@ | |||||
<target name="testFilesOnlyDoesntCauseRecreateSetup"> | <target name="testFilesOnlyDoesntCauseRecreateSetup"> | ||||
<mkdir dir="ziptest"/> | <mkdir dir="ziptest"/> | ||||
<touch file="ziptest/ziptest"/> | <touch file="ziptest/ziptest"/> | ||||
<zip destfile="test3.zip" basedir="." | |||||
<zip destFile="${output}/test3.zip" basedir="." | |||||
includes="ziptest/**" filesonly="true"/> | includes="ziptest/**" filesonly="true"/> | ||||
</target> | </target> | ||||
<!-- Bugzilla Report 19449 --> | <!-- Bugzilla Report 19449 --> | ||||
<target name="testFilesOnlyDoesntCauseRecreate"> | <target name="testFilesOnlyDoesntCauseRecreate"> | ||||
<zip destfile="test3.zip" basedir="." | |||||
<zip destFile="${output}/test3.zip" basedir="." | |||||
includes="ziptest/**" filesonly="true"/> | includes="ziptest/**" filesonly="true"/> | ||||
</target> | </target> | ||||
<!-- Bugzilla Report 22865 --> | <!-- Bugzilla Report 22865 --> | ||||
<target name="testEmptySkip"> | <target name="testEmptySkip"> | ||||
<mkdir dir="ziptest"/> | |||||
<zip destfile="test3.zip" basedir="ziptest" whenempty="skip"/> | |||||
<mkdir dir="${output}/ziptest"/> | |||||
<zip destFile="${output}/test3.zip" basedir="${output}/ziptest" whenempty="skip"/> | |||||
<fail message="archive should get skipped"> | <fail message="archive should get skipped"> | ||||
<condition> | <condition> | ||||
<available file="test3.zip" /> | |||||
<available file="${output}/test3.zip" /> | |||||
</condition> | </condition> | ||||
</fail> | </fail> | ||||
</target> | </target> | ||||
@@ -152,20 +162,20 @@ | |||||
<!-- Bugzilla Report 30365 --> | <!-- Bugzilla Report 30365 --> | ||||
<target name="zipEmptyDir"> | <target name="zipEmptyDir"> | ||||
<mkdir dir="empty/empty2"/> | <mkdir dir="empty/empty2"/> | ||||
<zip destfile="test3.zip" basedir="empty" update="true"/> | |||||
<zip destFile="${output}/test3.zip" basedir="empty" update="true"/> | |||||
<fail message="single-directory archive should be created"> | <fail message="single-directory archive should be created"> | ||||
<condition> | <condition> | ||||
<or> | <or> | ||||
<not> | <not> | ||||
<available file="test3.zip" /> | |||||
<available file="${output}/test3.zip" /> | |||||
</not> | </not> | ||||
<resourcecount when="gt" count="0"> | <resourcecount when="gt" count="0"> | ||||
<zipfileset src="test3.zip" /> | |||||
<zipfileset src="${output}/test3.zip" /> | |||||
</resourcecount> | </resourcecount> | ||||
<resourcecount when="ne" count="1"> | <resourcecount when="ne" count="1"> | ||||
<restrict> | <restrict> | ||||
<exists xmlns="antlib:org.apache.tools.ant.types.resources.selectors" /> | <exists xmlns="antlib:org.apache.tools.ant.types.resources.selectors" /> | ||||
<zipentry zipfile="test3.zip" name="empty2/" /> | |||||
<zipentry zipfile="${output}/test3.zip" name="empty2/" /> | |||||
</restrict> | </restrict> | ||||
</resourcecount> | </resourcecount> | ||||
</or> | </or> | ||||
@@ -176,25 +186,25 @@ | |||||
<!-- Bugzilla Report 40258 --> | <!-- Bugzilla Report 40258 --> | ||||
<target name="zipEmptyDirFilesOnly"> | <target name="zipEmptyDirFilesOnly"> | ||||
<mkdir dir="empty/empty2" /> | <mkdir dir="empty/empty2" /> | ||||
<zip destfile="test3.zip" basedir="empty" update="true" filesonly="true" /> | |||||
<zip destFile="${output}/test3.zip" basedir="empty" update="true" filesonly="true" /> | |||||
<fail message="archive should get skipped"> | <fail message="archive should get skipped"> | ||||
<condition> | <condition> | ||||
<available file="test3.zip" /> | |||||
<available file="${output}/test3.zip" /> | |||||
</condition> | </condition> | ||||
</fail> | </fail> | ||||
</target> | </target> | ||||
<target name="zipEmptyCreate"> | <target name="zipEmptyCreate"> | ||||
<mkdir dir="empty"/> | <mkdir dir="empty"/> | ||||
<zip destfile="test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/> | |||||
<zip destFile="${output}/test3.zip" basedir="empty" whenempty="create" includes="*.xyz"/> | |||||
<fail message="empty archive should be created"> | <fail message="empty archive should be created"> | ||||
<condition> | <condition> | ||||
<or> | <or> | ||||
<not> | <not> | ||||
<available file="test3.zip" /> | |||||
<available file="${output}/test3.zip" /> | |||||
</not> | </not> | ||||
<resourcecount when="gt" count="0"> | <resourcecount when="gt" count="0"> | ||||
<zipfileset src="test3.zip" /> | |||||
<zipfileset src="${output}/test3.zip" /> | |||||
</resourcecount> | </resourcecount> | ||||
</or> | </or> | ||||
</condition> | </condition> | ||||
@@ -202,15 +212,20 @@ | |||||
</target> | </target> | ||||
<target name="testCompressionLevel" depends="test6"> | <target name="testCompressionLevel" depends="test6"> | ||||
<length property="test6.length" file="test6.zip" /> | |||||
<zip destFile="testLevel.zip" basedir="." level="9"> | |||||
<length property="test6.length" file="${output}/test6.zip" /> | |||||
<copy todir="${output}"> | |||||
<fileset dir="."> | |||||
<include name="*.xml"/> | |||||
</fileset> | |||||
</copy> | |||||
<zip destFile="${output}/testLevel.zip" basedir="${output}" level="9"> | |||||
<include name="*.xml" /> | <include name="*.xml" /> | ||||
<exclude name="zip.*" /> | <exclude name="zip.*" /> | ||||
</zip> | </zip> | ||||
<fail> | <fail> | ||||
<condition> | <condition> | ||||
<not> | <not> | ||||
<isfileselected file="testLevel.zip"> | |||||
<isfileselected file="${output}/testLevel.zip"> | |||||
<size when="less" value="${test6.length}" /> | <size when="less" value="${test6.length}" /> | ||||
</isfileselected> | </isfileselected> | ||||
</not> | </not> | ||||
@@ -220,68 +235,53 @@ | |||||
<!-- Bugzilla Report 33412 --> | <!-- Bugzilla Report 33412 --> | ||||
<target name="testDefaultExcludesAndUpdate"> | <target name="testDefaultExcludesAndUpdate"> | ||||
<mkdir dir="ziptest"/> | |||||
<touch file="ziptest/ziptest~"/> | |||||
<zip destfile="test3.zip" basedir="ziptest" defaultexcludes="false"/> | |||||
<touch file="ziptest/ziptest2"/> | |||||
<zip destfile="test3.zip" basedir="ziptest" | |||||
<mkdir dir="${output}/ziptest"/> | |||||
<touch file="${output}/ziptest/ziptest~"/> | |||||
<zip destFile="${output}/test3.zip" basedir="ziptest" defaultexcludes="false"/> | |||||
<touch file="${output}/ziptest/ziptest2"/> | |||||
<zip destFile="${output}/test3.zip" basedir="${output}/ziptest" | |||||
defaultexcludes="false" | defaultexcludes="false" | ||||
update="true"/> | update="true"/> | ||||
</target> | </target> | ||||
<target name="testFileResource"> | <target name="testFileResource"> | ||||
<zip destfile="test3.zip"> | |||||
<zip destFile="${output}/test3.zip"> | |||||
<file file="zip.xml"/> | <file file="zip.xml"/> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="testNonFileResource"> | <target name="testNonFileResource"> | ||||
<zip destfile="test3.zip"> | |||||
<zip destFile="${output}/test3.zip"> | |||||
<javaresource name="META-INF/MANIFEST.MF"/> | <javaresource name="META-INF/MANIFEST.MF"/> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="testTarFileSet"> | <target name="testTarFileSet"> | ||||
<ant antfile="tar.xml" target="feather"/> | <ant antfile="tar.xml" target="feather"/> | ||||
<zip destfile="test3.zip"> | |||||
<tarfileset src="asf-logo.gif.tar" filemode="446"/> | |||||
<zip destFile="${output}/test3.zip"> | |||||
<tarfileset src="${output}/asf-logo.gif.tar" filemode="446"/> | |||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="rewriteZeroPermissions"> | <target name="rewriteZeroPermissions"> | ||||
<zip destfile="test3.zip"> | |||||
<zip destFile="${output}/test3.zip"> | |||||
<zipfileset src="nopermissions.zip"/> | <zipfileset src="nopermissions.zip"/> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="acceptZeroPermissions"> | <target name="acceptZeroPermissions"> | ||||
<zip destfile="test3.zip" preserve0permissions="true"> | |||||
<zip destFile="${output}/test3.zip" preserve0permissions="true"> | |||||
<zipfileset src="nopermissions.zip"/> | <zipfileset src="nopermissions.zip"/> | ||||
</zip> | </zip> | ||||
</target> | </target> | ||||
<target name="testForBugzilla34764"> | <target name="testForBugzilla34764"> | ||||
<mkdir dir="ziptest"/> | |||||
<touch file="ziptest/file1"/> | |||||
<zip destfile="test3.zip" basedir="ziptest"/> | |||||
<touch file="ziptest/file2"/> | |||||
<zip destfile="test3.zip" basedir="ziptest" update="true"/> | |||||
<mkdir dir="${output}/ziptest"/> | |||||
<touch file="${output}/ziptest/file1"/> | |||||
<zip destFile="${output}/test3.zip" basedir="${output}/ziptest"/> | |||||
<touch file="${output}/ziptest/file2"/> | |||||
<zip destFile="${output}/test3.zip" basedir="${output}/ziptest" update="true"/> | |||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete file="testLevel.zip"/> | |||||
<delete file="test3.zip"/> | |||||
<delete file="test4.zip"/> | |||||
<delete file="test5.zip"/> | |||||
<delete file="test6.zip"/> | |||||
<delete file="inner7.zip"/> | |||||
<delete file="test7.zip"/> | |||||
<delete file="test8.zip"/> | |||||
<delete file="asf-logo.gif.zip"/> | |||||
<delete file="zipgroupfileset.zip"/> | |||||
<delete file="../dummyfile" /> | |||||
<delete dir="ziptest"/> | |||||
<delete dir="empty"/> | |||||
<ant antfile="tar.xml" target="cleanup"/> | |||||
</target> | |||||
</project> | </project> |
@@ -16,33 +16,31 @@ | |||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project name="assertions" basedir="." default="init"> | |||||
<project name="assertions" basedir="." default="tearDown"> | |||||
<import file="../buildfiletest-base.xml"/> | |||||
<target name="setUp"> | |||||
<mkdir dir="${output}"/> | |||||
<javac srcdir="${src.dir}" | |||||
includes="*.java" | |||||
source="1.4" | |||||
debug="true" | |||||
destdir="${output}" | |||||
/> | |||||
</target> | |||||
<property name="build.dir" location="assertions/build"/> | |||||
<property name="src.dir" location="assertions"/> | <property name="src.dir" location="assertions"/> | ||||
<property name="classname" value="AssertionMain"/> | <property name="classname" value="AssertionMain"/> | ||||
<property name="test.classname" value="AssertionTest"/> | <property name="test.classname" value="AssertionTest"/> | ||||
<path id="assert.classpath"> | <path id="assert.classpath"> | ||||
<pathelement location="${build.dir}"/> | |||||
</path> | |||||
<pathelement location="${output}"/> | |||||
</path> | |||||
<target name="setup" > | |||||
<mkdir dir="${build.dir}"/> | |||||
<javac srcdir="${src.dir}" | |||||
includes="*.java" | |||||
source="1.4" | |||||
debug="true" | |||||
destdir="${build.dir}" | |||||
/> | |||||
</target> | |||||
<target name="teardown" > | |||||
<delete dir="${build.dir}"/> | |||||
</target> | |||||
<!-- if per-class assertions work, this run asserts --> | <!-- if per-class assertions work, this run asserts --> | ||||
<target name="test-classname" depends="setup"> | |||||
<target name="test-classname" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -53,7 +51,7 @@ | |||||
</target> | </target> | ||||
<!-- if package works, this run asserts --> | <!-- if package works, this run asserts --> | ||||
<target name="test-package" depends="setup"> | |||||
<target name="test-package" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -64,7 +62,7 @@ | |||||
</target> | </target> | ||||
<!-- this test should run the app successfully --> | <!-- this test should run the app successfully --> | ||||
<target name="test-empty-assertions" depends="setup"> | |||||
<target name="test-empty-assertions" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -73,7 +71,7 @@ | |||||
</target> | </target> | ||||
<!-- this test should run the app successfully --> | <!-- this test should run the app successfully --> | ||||
<target name="test-disable" depends="setup"> | |||||
<target name="test-disable" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -87,7 +85,7 @@ | |||||
<!-- repeated settigns result in the last declaration winning | <!-- repeated settigns result in the last declaration winning | ||||
except that the rule 'classes win over packages takes priority | except that the rule 'classes win over packages takes priority | ||||
this run will assert --> | this run will assert --> | ||||
<target name="test-override" depends="setup"> | |||||
<target name="test-override" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -102,7 +100,7 @@ | |||||
<!-- repeated settigns result in the last declaration winning; | <!-- repeated settigns result in the last declaration winning; | ||||
this run will not assert --> | this run will not assert --> | ||||
<target name="test-override2" depends="setup"> | |||||
<target name="test-override2" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -129,7 +127,7 @@ | |||||
</target> | </target> | ||||
<!-- when fork=false; we need to reject the construct --> | <!-- when fork=false; we need to reject the construct --> | ||||
<target name="test-nofork" depends="setup"> | |||||
<target name="test-nofork" depends="setUp"> | |||||
<java fork="false" failonerror="true" | <java fork="false" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -140,7 +138,7 @@ | |||||
</target> | </target> | ||||
<!-- this throws a build error --> | <!-- this throws a build error --> | ||||
<target name="test-multiple-assertions" depends="setup"> | |||||
<target name="test-multiple-assertions" depends="setUp"> | |||||
<java fork="true" failonerror="true" | <java fork="true" failonerror="true" | ||||
classname="${classname}" | classname="${classname}" | ||||
classpathref="assert.classpath"> | classpathref="assert.classpath"> | ||||
@@ -152,7 +150,7 @@ | |||||
</target> | </target> | ||||
<!-- should throw a build exception --> | <!-- should throw a build exception --> | ||||
<target name="test-reference-abuse" depends="setup"> | |||||
<target name="test-reference-abuse" depends="setUp"> | |||||
<assertions id="project.assertions2" > | <assertions id="project.assertions2" > | ||||
<enable package="org.apache.test" /> | <enable package="org.apache.test" /> | ||||
<disable package="org.apache.log4j"/> | <disable package="org.apache.log4j"/> | ||||
@@ -168,7 +166,7 @@ | |||||
</target> | </target> | ||||
<target name="test-junit" depends="setup"> | |||||
<target name="test-junit" depends="setUp"> | |||||
<junit fork="true" | <junit fork="true" | ||||
haltonerror="true" haltonfailure="true" | haltonerror="true" haltonfailure="true" | ||||
> | > | ||||
@@ -186,7 +184,7 @@ | |||||
<!-- This is here to show that setting it as a property works | <!-- This is here to show that setting it as a property works | ||||
so there is some defect in pass-on of assertions that | so there is some defect in pass-on of assertions that | ||||
is causing the problem --> | is causing the problem --> | ||||
<target name="test-junit-manual-setup" depends="setup"> | |||||
<target name="test-junit-manual-setup" depends="setUp"> | |||||
<junit fork="true" | <junit fork="true" | ||||
haltonerror="true" haltonfailure="true" | haltonerror="true" haltonfailure="true" | ||||
> | > | ||||
@@ -16,18 +16,19 @@ | |||||
limitations under the License. | limitations under the License. | ||||
--> | --> | ||||
<project default="not me"> | <project default="not me"> | ||||
<target name="not me"> | |||||
<fail>only use from within unit tests</fail> | |||||
</target> | |||||
<import file="../../buildfiletest-base.xml" optional="false"/> | |||||
<property name="testout" location="testout"/> | |||||
<target name="setUp"> | <target name="setUp"> | ||||
<mkdir dir="${testout}"/> | |||||
<mkdir dir="${output}"/> | |||||
</target> | |||||
<target name="not me"> | |||||
<fail>only use from within unit tests</fail> | |||||
</target> | </target> | ||||
<target name="uncompressSource" depends="setUp"> | <target name="uncompressSource" depends="setUp"> | ||||
<ant antfile="../../taskdefs/tar.xml" target="feather" /> | <ant antfile="../../taskdefs/tar.xml" target="feather" /> | ||||
<copy todir="${testout}"> | |||||
<copy todir="${output}"> | |||||
<tarentry name="asf-logo.gif"> | <tarentry name="asf-logo.gif"> | ||||
<gzipresource> | <gzipresource> | ||||
<file file="../../taskdefs/expected/asf-logo.gif.tar.gz"/> | <file file="../../taskdefs/expected/asf-logo.gif.tar.gz"/> | ||||
@@ -36,8 +37,4 @@ | |||||
</copy> | </copy> | ||||
</target> | </target> | ||||
<target name="tearDown"> | |||||
<delete dir="${testout}"/> | |||||
<ant antfile="../../taskdefs/tar.xml" target="cleanup" /> | |||||
</target> | |||||
</project> | </project> |
@@ -0,0 +1,57 @@ | |||||
/* | |||||
* 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.util; | |||||
import java.lang.management.ManagementFactory; | |||||
/** | |||||
* Process Utilities | |||||
*/ | |||||
public class ProcessUtil { | |||||
/** | |||||
* provide id of the current process | |||||
* @param fallback | |||||
* @return current process id | |||||
*/ | |||||
public static String getProcessId(final String fallback) { | |||||
// Note: may fail in some JVM implementations | |||||
// therefore fallback has to be provided | |||||
// something like '<pid>@<hostname>', at least in SUN / Oracle JVMs | |||||
final String jvmName = ManagementFactory.getRuntimeMXBean().getName(); | |||||
final int index = jvmName.indexOf('@'); | |||||
if (index < 1) { | |||||
// part before '@' empty (index = 0) / '@' not found (index = -1) | |||||
return fallback; | |||||
} | |||||
try { | |||||
return Long.toString(Long.parseLong(jvmName.substring(0, index))); | |||||
} catch (NumberFormatException e) { | |||||
// ignore | |||||
} | |||||
return fallback; | |||||
} | |||||
public static void main(String [] args) { | |||||
System.out.println(getProcessId("<PID>")); | |||||
try { | |||||
Thread.sleep(120000); | |||||
} catch (Exception exc) {} | |||||
} | |||||
} |
@@ -30,7 +30,6 @@ import org.apache.tools.ant.util.FileUtils; | |||||
*/ | */ | ||||
public class AntClassLoaderTest extends BuildFileTest { | public class AntClassLoaderTest extends BuildFileTest { | ||||
private Project p; | |||||
private AntClassLoader loader; | private AntClassLoader loader; | ||||
public AntClassLoaderTest(String name) { | public AntClassLoaderTest(String name) { | ||||
@@ -38,17 +37,19 @@ public class AntClassLoaderTest extends BuildFileTest { | |||||
} | } | ||||
public void setUp() { | public void setUp() { | ||||
p = new Project(); | |||||
p.init(); | |||||
configureProject("src/etc/testcases/core/antclassloader.xml"); | |||||
getProject().executeTarget("setup"); | |||||
super.configureProject("src/etc/testcases/core/antclassloader.xml"); | |||||
getProject().executeTarget("setUp"); | |||||
} | } | ||||
public void tearDown() { | public void tearDown() { | ||||
if (loader != null) { | if (loader != null) { | ||||
loader.cleanup(); | loader.cleanup(); | ||||
} | } | ||||
getProject().executeTarget("cleanup"); | |||||
try { | |||||
super.tearDown(); | |||||
} catch ( Exception e) { | |||||
System.err.println(e.getMessage()); | |||||
} | |||||
} | } | ||||
//test inspired by bug report 37085 | //test inspired by bug report 37085 | ||||
public void testJarWithManifestInDirWithSpace() { | public void testJarWithManifestInDirWithSpace() { | ||||
@@ -72,8 +73,8 @@ public class AntClassLoaderTest extends BuildFileTest { | |||||
assertEquals(mainjarstring + File.pathSeparator + extjarstring, path); | assertEquals(mainjarstring + File.pathSeparator + extjarstring, path); | ||||
} | } | ||||
public void testCleanup() throws BuildException { | public void testCleanup() throws BuildException { | ||||
Path path = new Path(p, "."); | |||||
loader = p.createClassLoader(path); | |||||
Path path = new Path(project, "."); | |||||
loader = project.createClassLoader(path); | |||||
try { | try { | ||||
// we don't expect to find this | // we don't expect to find this | ||||
loader.findClass("fubar"); | loader.findClass("fubar"); | ||||
@@ -94,7 +95,7 @@ public class AntClassLoaderTest extends BuildFileTest { | |||||
} | } | ||||
// tell the build it is finished | // tell the build it is finished | ||||
p.fireBuildFinished(null); | |||||
project.fireBuildFinished(null); | |||||
try { | try { | ||||
// we don't expect to find this | // we don't expect to find this | ||||
loader.findClass("fubar"); | loader.findClass("fubar"); | ||||
@@ -149,7 +150,9 @@ public class AntClassLoaderTest extends BuildFileTest { | |||||
} | } | ||||
/** | /** | ||||
* @see https://issues.apache.org/bugzilla/show_bug.cgi?id=47593 | |||||
* @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=47593"> | |||||
* bug 47593, request to log the name of corrupt zip files from which | |||||
* classes cannot be loaded</a> | |||||
*/ | */ | ||||
public void testInvalidZipException() throws Exception { | public void testInvalidZipException() throws Exception { | ||||
executeTarget("createNonJar"); | executeTarget("createNonJar"); | ||||
@@ -23,6 +23,7 @@ import java.io.PrintStream; | |||||
import java.net.URL; | import java.net.URL; | ||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
import org.apache.tools.ant.util.ProcessUtil; | |||||
/** | /** | ||||
* A BuildFileTest is a TestCase which executes targets from an Ant buildfile | * A BuildFileTest is a TestCase which executes targets from an Ant buildfile | ||||
@@ -296,6 +297,9 @@ public abstract class BuildFileTest extends TestCase { | |||||
project.init(); | project.init(); | ||||
File antFile = new File(System.getProperty("root"), filename); | File antFile = new File(System.getProperty("root"), filename); | ||||
project.setUserProperty("ant.file" , antFile.getAbsolutePath()); | project.setUserProperty("ant.file" , antFile.getAbsolutePath()); | ||||
// set two new properties to allow to build unique names when running multithreaded tests | |||||
project.setProperty("ant.processid", ProcessUtil.getProcessId("<Process>")); | |||||
project.setProperty("ant.threadname", Thread.currentThread().getName()); | |||||
project.addBuildListener(new AntTestListener(logLevel)); | project.addBuildListener(new AntTestListener(logLevel)); | ||||
ProjectHelper.configureProject(project, antFile); | ProjectHelper.configureProject(project, antFile); | ||||
} | } | ||||
@@ -43,16 +43,13 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/core/directoryscanner.xml"); | configureProject("src/etc/testcases/core/directoryscanner.xml"); | ||||
getProject().executeTarget("setup"); | |||||
getProject().executeTarget("setUp"); | |||||
} | } | ||||
public void tearDown() { | |||||
getProject().executeTarget("cleanup"); | |||||
} | |||||
public void test1() { | public void test1() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha"}); | ds.setIncludes(new String[] {"alpha"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {} ,new String[] {"alpha"}); | compareFiles(ds, new String[] {} ,new String[] {"alpha"}); | ||||
@@ -60,7 +57,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void test2() { | public void test2() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/"}); | ds.setIncludes(new String[] {"alpha/"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {"alpha/beta/beta.xml", | compareFiles(ds, new String[] {"alpha/beta/beta.xml", | ||||
@@ -70,7 +67,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void test3() { | public void test3() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {"alpha/beta/beta.xml", | compareFiles(ds, new String[] {"alpha/beta/beta.xml", | ||||
"alpha/beta/gamma/gamma.xml"}, | "alpha/beta/gamma/gamma.xml"}, | ||||
@@ -80,7 +77,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testFullPathMatchesCaseSensitive() { | public void testFullPathMatchesCaseSensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); | ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {}, new String[] {}); | compareFiles(ds, new String[] {}, new String[] {}); | ||||
@@ -89,7 +86,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testFullPathMatchesCaseInsensitive() { | public void testFullPathMatchesCaseInsensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setCaseSensitive(false); | ds.setCaseSensitive(false); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); | ds.setIncludes(new String[] {"alpha/beta/gamma/GAMMA.XML"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, | compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, | ||||
@@ -98,7 +95,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void test2ButCaseInsensitive() { | public void test2ButCaseInsensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"ALPHA/"}); | ds.setIncludes(new String[] {"ALPHA/"}); | ||||
ds.setCaseSensitive(false); | ds.setCaseSensitive(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -114,7 +111,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
getProject().executeTarget("symlink-setup"); | getProject().executeTarget("symlink-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/beta/gamma/"}); | ds.setIncludes(new String[] {"alpha/beta/gamma/"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, | compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"}, | ||||
@@ -128,7 +125,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
getProject().executeTarget("symlink-setup"); | getProject().executeTarget("symlink-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/beta/gamma/"}); | ds.setIncludes(new String[] {"alpha/beta/gamma/"}); | ||||
ds.setFollowSymlinks(false); | ds.setFollowSymlinks(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -141,13 +138,13 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
"alpha/beta/gamma/gamma.xml"}; | "alpha/beta/gamma/gamma.xml"}; | ||||
String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" }; | String [] expectedDirectories = {"alpha/beta", "alpha/beta/gamma" }; | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/be?a/**", "alpha/beta/gamma/"}); | ds.setIncludes(new String[] {"alpha/be?a/**", "alpha/beta/gamma/"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, expectedFiles, expectedDirectories); | compareFiles(ds, expectedFiles, expectedDirectories); | ||||
// redo the test, but the 2 include patterns are inverted | // redo the test, but the 2 include patterns are inverted | ||||
ds = new DirectoryScanner(); | ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/beta/gamma/", "alpha/be?a/**"}); | ds.setIncludes(new String[] {"alpha/beta/gamma/", "alpha/be?a/**"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, expectedFiles, expectedDirectories); | compareFiles(ds, expectedFiles, expectedDirectories); | ||||
@@ -155,7 +152,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testPatternsDifferInCaseScanningSensitive() { | public void testPatternsDifferInCaseScanningSensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); | ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {"alpha/beta/beta.xml", | compareFiles(ds, new String[] {"alpha/beta/beta.xml", | ||||
@@ -165,7 +162,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testPatternsDifferInCaseScanningInsensitive() { | public void testPatternsDifferInCaseScanningInsensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); | ds.setIncludes(new String[] {"alpha/", "ALPHA/"}); | ||||
ds.setCaseSensitive(false); | ds.setCaseSensitive(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -176,7 +173,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testFullpathDiffersInCaseScanningSensitive() { | public void testFullpathDiffersInCaseScanningSensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] { | ds.setIncludes(new String[] { | ||||
"alpha/beta/gamma/gamma.xml", | "alpha/beta/gamma/gamma.xml", | ||||
"alpha/beta/gamma/GAMMA.XML" | "alpha/beta/gamma/GAMMA.XML" | ||||
@@ -188,7 +185,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testFullpathDiffersInCaseScanningInsensitive() { | public void testFullpathDiffersInCaseScanningInsensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] { | ds.setIncludes(new String[] { | ||||
"alpha/beta/gamma/gamma.xml", | "alpha/beta/gamma/gamma.xml", | ||||
"alpha/beta/gamma/GAMMA.XML" | "alpha/beta/gamma/GAMMA.XML" | ||||
@@ -201,7 +198,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testParentDiffersInCaseScanningSensitive() { | public void testParentDiffersInCaseScanningSensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); | ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {"alpha/beta/beta.xml", | compareFiles(ds, new String[] {"alpha/beta/beta.xml", | ||||
@@ -211,7 +208,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testParentDiffersInCaseScanningInsensitive() { | public void testParentDiffersInCaseScanningInsensitive() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); | ds.setIncludes(new String[] {"alpha/", "ALPHA/beta/"}); | ||||
ds.setCaseSensitive(false); | ds.setCaseSensitive(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -318,7 +315,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testExcludeOneFile() { | public void testExcludeOneFile() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] { | ds.setIncludes(new String[] { | ||||
"**/*.xml" | "**/*.xml" | ||||
}); | }); | ||||
@@ -332,7 +329,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testExcludeHasPrecedence() { | public void testExcludeHasPrecedence() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] { | ds.setIncludes(new String[] { | ||||
"alpha/**" | "alpha/**" | ||||
}); | }); | ||||
@@ -347,7 +344,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testAlternateIncludeExclude() { | public void testAlternateIncludeExclude() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setIncludes(new String[] { | ds.setIncludes(new String[] { | ||||
"alpha/**", | "alpha/**", | ||||
"alpha/beta/gamma/**" | "alpha/beta/gamma/**" | ||||
@@ -363,7 +360,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testAlternateExcludeInclude() { | public void testAlternateExcludeInclude() { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setExcludes(new String[] { | ds.setExcludes(new String[] { | ||||
"alpha/**", | "alpha/**", | ||||
"alpha/beta/gamma/**" | "alpha/beta/gamma/**" | ||||
@@ -383,7 +380,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testChildrenOfExcludedDirectory() { | public void testChildrenOfExcludedDirectory() { | ||||
getProject().executeTarget("children-of-excluded-dir-setup"); | getProject().executeTarget("children-of-excluded-dir-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setExcludes(new String[] {"alpha/**"}); | ds.setExcludes(new String[] {"alpha/**"}); | ||||
ds.setFollowSymlinks(false); | ds.setFollowSymlinks(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -391,7 +388,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
new String[] {"", "delta"}); | new String[] {"", "delta"}); | ||||
ds = new DirectoryScanner(); | ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setExcludes(new String[] {"alpha"}); | ds.setExcludes(new String[] {"alpha"}); | ||||
ds.setFollowSymlinks(false); | ds.setFollowSymlinks(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -417,7 +414,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
} | } | ||||
getProject().executeTarget("children-of-excluded-dir-setup"); | getProject().executeTarget("children-of-excluded-dir-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setExcludes(new String[] {"**/gamma/**"}); | ds.setExcludes(new String[] {"**/gamma/**"}); | ||||
ds.setFollowSymlinks(false); | ds.setFollowSymlinks(false); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -430,8 +427,8 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testAbsolute1() { | public void testAbsolute1() { | ||||
getProject().executeTarget("extended-setup"); | getProject().executeTarget("extended-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
String tmpdir = getProject().getBaseDir().getAbsolutePath().replace( | |||||
File.separatorChar, '/') + "/tmp"; | |||||
String tmpdir = getProject().getProperty("output").replace( | |||||
File.separatorChar, '/'); | |||||
ds.setIncludes(new String[] {tmpdir + "/**/*"}); | ds.setIncludes(new String[] {tmpdir + "/**/*"}); | ||||
ds.scan(); | ds.scan(); | ||||
compareFiles(ds, new String[] {tmpdir + "/alpha/beta/beta.xml", | compareFiles(ds, new String[] {tmpdir + "/alpha/beta/beta.xml", | ||||
@@ -444,7 +441,6 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
} | } | ||||
public void testAbsolute2() { | public void testAbsolute2() { | ||||
getProject().executeTarget("setup"); | |||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); | ds.setIncludes(new String[] {"alpha/**", "alpha/beta/gamma/**"}); | ||||
ds.scan(); | ds.scan(); | ||||
@@ -455,8 +451,8 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testAbsolute3() { | public void testAbsolute3() { | ||||
getProject().executeTarget("extended-setup"); | getProject().executeTarget("extended-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
String tmpdir = getProject().getBaseDir().getAbsolutePath().replace( | |||||
File.separatorChar, '/') + "/tmp"; | |||||
String tmpdir = getProject().getProperty("output").replace( | |||||
File.separatorChar, '/'); | |||||
ds.setIncludes(new String[] {tmpdir + "/**/*"}); | ds.setIncludes(new String[] {tmpdir + "/**/*"}); | ||||
ds.setExcludes(new String[] {"**/alpha", | ds.setExcludes(new String[] {"**/alpha", | ||||
"**/delta/*"}); | "**/delta/*"}); | ||||
@@ -471,8 +467,8 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testAbsolute4() { | public void testAbsolute4() { | ||||
getProject().executeTarget("extended-setup"); | getProject().executeTarget("extended-setup"); | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
String tmpdir = getProject().getBaseDir().getAbsolutePath().replace( | |||||
File.separatorChar, '/') + "/tmp"; | |||||
String tmpdir = getProject().getProperty("output").replace( | |||||
File.separatorChar, '/') ; | |||||
ds.setIncludes(new String[] {tmpdir + "/alpha/beta/**/*", | ds.setIncludes(new String[] {tmpdir + "/alpha/beta/**/*", | ||||
tmpdir + "/delta/*"}); | tmpdir + "/delta/*"}); | ||||
ds.setExcludes(new String[] {"**/beta.xml"}); | ds.setExcludes(new String[] {"**/beta.xml"}); | ||||
@@ -535,7 +531,7 @@ public class DirectoryScannerTest extends BuildFileTest { | |||||
public void testRecursiveExcludes() throws Exception { | public void testRecursiveExcludes() throws Exception { | ||||
DirectoryScanner ds = new DirectoryScanner(); | DirectoryScanner ds = new DirectoryScanner(); | ||||
ds.setBasedir(new File(getProject().getBaseDir(), "tmp")); | |||||
ds.setBasedir(new File(getProject().getProperty("output"))); | |||||
ds.setExcludes(new String[] {"**/beta/**"}); | ds.setExcludes(new String[] {"**/beta/**"}); | ||||
ds.scan(); | ds.scan(); | ||||
List dirs = Arrays.asList(ds.getExcludedDirectories()); | List dirs = Arrays.asList(ds.getExcludedDirectories()); | ||||
@@ -30,10 +30,7 @@ public class LoaderRefTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/core/loaderref/loaderref.xml"); | configureProject("src/etc/testcases/core/loaderref/loaderref.xml"); | ||||
} | |||||
public void tearDown() { | |||||
executeTarget("clean"); | |||||
executeTarget("setUp"); | |||||
} | } | ||||
// override allowed on <available> | // override allowed on <available> | ||||
@@ -28,10 +28,6 @@ public class TaskContainerTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/core/taskcontainer.xml"); | configureProject("src/etc/testcases/core/taskcontainer.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testPropertyExpansion() { | public void testPropertyExpansion() { | ||||
executeTarget("testPropertyExpansion"); | executeTarget("testPropertyExpansion"); | ||||
assertTrue("attribute worked", | assertTrue("attribute worked", | ||||
@@ -74,14 +74,11 @@ public class ConcatFilterTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/concat.xml"); | configureProject("src/etc/testcases/filters/concat.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testFilterReaderNoArgs() throws IOException { | public void testFilterReaderNoArgs() throws IOException { | ||||
executeTarget("testFilterReaderNoArgs"); | executeTarget("testFilterReaderNoArgs"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"input/concatfilter.test"); | |||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/concat.FilterReaderNoArgs.test"); | |||||
File expected = new File(getProject().getProperty("output"), "concatfilter.test"); | |||||
File result = new File(getProject().getProperty("output"), "concat.FilterReaderNoArgs.test"); | |||||
assertTrue("testFilterReaderNoArgs: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testFilterReaderNoArgs: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -124,7 +121,7 @@ public class ConcatFilterTest extends BuildFileTest { | |||||
*/ | */ | ||||
protected void doTest(String target, String expectedStart, String expectedEnd) { | protected void doTest(String target, String expectedStart, String expectedEnd) { | ||||
executeTarget(target); | executeTarget(target); | ||||
String resultContent = read("result/concat." + target.substring(4) + ".test"); | |||||
String resultContent = read(getProject().getProperty("output") + "/concat." + target.substring(4) + ".test"); | |||||
assertTrue("First 5 lines differs.", resultContent.startsWith(expectedStart)); | assertTrue("First 5 lines differs.", resultContent.startsWith(expectedStart)); | ||||
assertTrue("Last 5 lines differs.", resultContent.endsWith(expectedEnd)); | assertTrue("Last 5 lines differs.", resultContent.endsWith(expectedEnd)); | ||||
} | } | ||||
@@ -37,14 +37,11 @@ public class DynamicFilterTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/filters/dynamicfilter.xml"); | configureProject("src/etc/testcases/filters/dynamicfilter.xml"); | ||||
executeTarget("init"); | |||||
executeTarget("setUp"); | |||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testCustomFilter() throws IOException { | public void testCustomFilter() throws IOException { | ||||
expectFileContains("dynamicfilter", "result/dynamicfilter", | |||||
expectFileContains("dynamicfilter", getProject().getProperty("output") + "/dynamicfilter", | |||||
"hellO wOrld"); | "hellO wOrld"); | ||||
} | } | ||||
@@ -38,14 +38,10 @@ public class EscapeUnicodeTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/build.xml"); | configureProject("src/etc/testcases/filters/build.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testEscapeUnicode() throws IOException { | public void testEscapeUnicode() throws IOException { | ||||
executeTarget("testEscapeUnicode"); | executeTarget("testEscapeUnicode"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/escapeunicode.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/escapeunicode.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/escapeunicode.test"); | |||||
File result = new File(getProject().getProperty("output"), "escapeunicode.test"); | |||||
assertTrue(FILE_UTILS.contentEquals(expected, result)); | assertTrue(FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -41,35 +41,31 @@ public class HeadTailTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/head-tail.xml"); | configureProject("src/etc/testcases/filters/head-tail.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testHead() throws IOException { | public void testHead() throws IOException { | ||||
executeTarget("testHead"); | executeTarget("testHead"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.head.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.head.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/head-tail.head.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.head.test"); | |||||
assertTrue("testHead: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testHead: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testHeadLines() throws IOException { | public void testHeadLines() throws IOException { | ||||
executeTarget("testHeadLines"); | executeTarget("testHeadLines"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.headLines.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), "expected/head-tail.headLines.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), "result/head-tail.headLines.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.headLines.test"); | |||||
assertTrue("testHeadLines: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testHeadLines: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testHeadSkip() throws IOException { | public void testHeadSkip() throws IOException { | ||||
executeTarget("testHeadSkip"); | executeTarget("testHeadSkip"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headSkip.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headSkip.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.headSkip.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.headSkip.test"); | |||||
assertTrue("testHeadSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testHeadSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testHeadLinesSkip() throws IOException { | public void testHeadLinesSkip() throws IOException { | ||||
executeTarget("testHeadLinesSkip"); | executeTarget("testHeadLinesSkip"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headLinesSkip.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headLinesSkip.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.headLinesSkip.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.headLinesSkip.test"); | |||||
assertTrue("testHeadLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testHeadLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -77,8 +73,7 @@ public class HeadTailTest extends BuildFileTest { | |||||
executeTarget("testFilterReaderHeadLinesSkip"); | executeTarget("testFilterReaderHeadLinesSkip"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), | ||||
"expected/head-tail.headLinesSkip.test"); | "expected/head-tail.headLinesSkip.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), | |||||
"result/head-tail.filterReaderHeadLinesSkip.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.filterReaderHeadLinesSkip.test"); | |||||
assertTrue("testFilterReaderHeadLinesSkip: Result not like expected", | assertTrue("testFilterReaderHeadLinesSkip: Result not like expected", | ||||
FILE_UTILS.contentEquals(expected, result)); | FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -86,28 +81,28 @@ public class HeadTailTest extends BuildFileTest { | |||||
public void testTail() throws IOException { | public void testTail() throws IOException { | ||||
executeTarget("testTail"); | executeTarget("testTail"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tail.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tail.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tail.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.tail.test"); | |||||
assertTrue("testTail: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testTail: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testTailLines() throws IOException { | public void testTailLines() throws IOException { | ||||
executeTarget("testTailLines"); | executeTarget("testTailLines"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailLines.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailLines.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tailLines.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.tailLines.test"); | |||||
assertTrue("testTailLines: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testTailLines: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testTailSkip() throws IOException { | public void testTailSkip() throws IOException { | ||||
executeTarget("testTailSkip"); | executeTarget("testTailSkip"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailSkip.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailSkip.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tailSkip.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.tailSkip.test"); | |||||
assertTrue("testTailSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testTailSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testTailLinesSkip() throws IOException { | public void testTailLinesSkip() throws IOException { | ||||
executeTarget("testTailLinesSkip"); | executeTarget("testTailLinesSkip"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailLinesSkip.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.tailLinesSkip.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.tailLinesSkip.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.tailLinesSkip.test"); | |||||
assertTrue("testTailLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testTailLinesSkip: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -115,8 +110,7 @@ public class HeadTailTest extends BuildFileTest { | |||||
executeTarget("testFilterReaderTailLinesSkip"); | executeTarget("testFilterReaderTailLinesSkip"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(), | ||||
"expected/head-tail.tailLinesSkip.test"); | "expected/head-tail.tailLinesSkip.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(), | |||||
"result/head-tail.filterReaderTailLinesSkip.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.filterReaderTailLinesSkip.test"); | |||||
assertTrue("testFilterReaderTailLinesSkip: Result not like expected", | assertTrue("testFilterReaderTailLinesSkip: Result not like expected", | ||||
FILE_UTILS.contentEquals(expected, result)); | FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -124,7 +118,7 @@ public class HeadTailTest extends BuildFileTest { | |||||
public void testHeadTail() throws IOException { | public void testHeadTail() throws IOException { | ||||
executeTarget("testHeadTail"); | executeTarget("testHeadTail"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headtail.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/head-tail.headtail.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/head-tail.headtail.test"); | |||||
File result = new File(getProject().getProperty("output") + "/head-tail.headtail.test"); | |||||
assertTrue("testHeadTail: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | assertTrue("testHeadTail: Result not like expected", FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -38,14 +38,10 @@ public class LineContainsTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/build.xml"); | configureProject("src/etc/testcases/filters/build.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testLineContains() throws IOException { | public void testLineContains() throws IOException { | ||||
executeTarget("testLineContains"); | executeTarget("testLineContains"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/linecontains.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/linecontains.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/linecontains.test"); | |||||
File result = new File(getProject().getProperty("output"),"linecontains.test"); | |||||
assertTrue(FILE_UTILS.contentEquals(expected, result)); | assertTrue(FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -36,10 +36,6 @@ public class NoNewLineTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/build.xml"); | configureProject("src/etc/testcases/filters/build.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testNoAddNewLine() throws IOException { | public void testNoAddNewLine() throws IOException { | ||||
executeTarget("testNoAddNewLine"); | executeTarget("testNoAddNewLine"); | ||||
} | } | ||||
@@ -38,21 +38,17 @@ public class ReplaceTokensTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/build.xml"); | configureProject("src/etc/testcases/filters/build.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testReplaceTokens() throws IOException { | public void testReplaceTokens() throws IOException { | ||||
executeTarget("testReplaceTokens"); | executeTarget("testReplaceTokens"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/replacetokens.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/replacetokens.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/replacetokens.test"); | |||||
File result = new File(getProject().getProperty("output"), "replacetokens.test"); | |||||
assertTrue(FILE_UTILS.contentEquals(expected, result)); | assertTrue(FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
public void testReplaceTokensPropertyFile() throws IOException { | public void testReplaceTokensPropertyFile() throws IOException { | ||||
executeTarget("testReplaceTokensPropertyFile"); | executeTarget("testReplaceTokensPropertyFile"); | ||||
File expected = FILE_UTILS.resolveFile(getProjectDir(), "expected/replacetokens.test"); | File expected = FILE_UTILS.resolveFile(getProjectDir(), "expected/replacetokens.test"); | ||||
File result = FILE_UTILS.resolveFile(getProjectDir(), "result/replacetokensPropertyFile.test"); | |||||
File result = new File(getProject().getProperty("output"), "replacetokensPropertyFile.test"); | |||||
assertTrue(FILE_UTILS.contentEquals(expected, result)); | assertTrue(FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -38,14 +38,10 @@ public class StripJavaCommentsTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/filters/build.xml"); | configureProject("src/etc/testcases/filters/build.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testStripJavaComments() throws IOException { | public void testStripJavaComments() throws IOException { | ||||
executeTarget("testStripJavaComments"); | executeTarget("testStripJavaComments"); | ||||
File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/stripjavacomments.test"); | File expected = FILE_UTILS.resolveFile(getProject().getBaseDir(),"expected/stripjavacomments.test"); | ||||
File result = FILE_UTILS.resolveFile(getProject().getBaseDir(),"result/stripjavacomments.test"); | |||||
File result = new File(getProject().getProperty("output"), "stripjavacomments.test"); | |||||
assertTrue(FILE_UTILS.contentEquals(expected, result)); | assertTrue(FILE_UTILS.contentEquals(expected, result)); | ||||
} | } | ||||
@@ -37,11 +37,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/filters/tokenfilter.xml"); | configureProject("src/etc/testcases/filters/tokenfilter.xml"); | ||||
executeTarget("init"); | |||||
} | |||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
executeTarget("setUp"); | |||||
} | } | ||||
/** make sure tokenfilter exists */ | /** make sure tokenfilter exists */ | ||||
@@ -60,26 +56,26 @@ public class TokenFilterTest extends BuildFileTest { | |||||
public void testUnixLineOutput() throws IOException { | public void testUnixLineOutput() throws IOException { | ||||
expectFileContains( | expectFileContains( | ||||
"unixlineoutput", "result/unixlineoutput", | |||||
"unixlineoutput", getProject().getProperty("output") + "/unixlineoutput", | |||||
"\nThis\nis\na\nnumber\nof\nwords\n"); | "\nThis\nis\na\nnumber\nof\nwords\n"); | ||||
} | } | ||||
public void testDosLineOutput() throws IOException { | public void testDosLineOutput() throws IOException { | ||||
expectFileContains( | expectFileContains( | ||||
"doslineoutput", "result/doslineoutput", | |||||
"doslineoutput", getProject().getProperty("output") + "/doslineoutput", | |||||
"\r\nThis\r\nis\r\na\r\nnumber\r\nof\r\nwords\r\n"); | "\r\nThis\r\nis\r\na\r\nnumber\r\nof\r\nwords\r\n"); | ||||
} | } | ||||
public void testFileTokenizer() throws IOException { | public void testFileTokenizer() throws IOException { | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"filetokenizer", "result/filetokenizer"); | |||||
"filetokenizer", getProject().getProperty("output") + "/filetokenizer"); | |||||
assertStringContains(contents, " of words"); | assertStringContains(contents, " of words"); | ||||
assertStringNotContains(contents, " This is"); | assertStringNotContains(contents, " This is"); | ||||
} | } | ||||
public void testReplaceString() throws IOException { | public void testReplaceString() throws IOException { | ||||
expectFileContains( | expectFileContains( | ||||
"replacestring", "result/replacestring", | |||||
"replacestring", getProject().getProperty("output") + "/replacestring", | |||||
"this is the moon"); | "this is the moon"); | ||||
} | } | ||||
@@ -89,7 +85,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
public void testContainsString() throws IOException { | public void testContainsString() throws IOException { | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"containsstring", "result/containsstring"); | |||||
"containsstring", getProject().getProperty("output") + "/containsstring"); | |||||
assertStringContains(contents, "this is a line contains foo"); | assertStringContains(contents, "this is a line contains foo"); | ||||
assertStringNotContains(contents, "this line does not"); | assertStringNotContains(contents, "this line does not"); | ||||
} | } | ||||
@@ -98,7 +94,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasRegex("testReplaceRegex")) | if (! hasRegex("testReplaceRegex")) | ||||
return; | return; | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"replaceregex", "result/replaceregex"); | |||||
"replaceregex", getProject().getProperty("output") + "/replaceregex"); | |||||
assertStringContains(contents, "world world world world"); | assertStringContains(contents, "world world world world"); | ||||
assertStringContains(contents, "dog Cat dog"); | assertStringContains(contents, "dog Cat dog"); | ||||
assertStringContains(contents, "moon Sun Sun"); | assertStringContains(contents, "moon Sun Sun"); | ||||
@@ -111,7 +107,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasRegex("testFilterReplaceRegex")) | if (! hasRegex("testFilterReplaceRegex")) | ||||
return; | return; | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"filterreplaceregex", "result/filterreplaceregex"); | |||||
"filterreplaceregex", getProject().getProperty("output") + "/filterreplaceregex"); | |||||
assertStringContains(contents, "world world world world"); | assertStringContains(contents, "world world world world"); | ||||
} | } | ||||
@@ -123,7 +119,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
public void testTrimFile() throws IOException { | public void testTrimFile() throws IOException { | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"trimfile", "result/trimfile"); | |||||
"trimfile", getProject().getProperty("output") + "/trimfile"); | |||||
assertTrue("no ws at start", contents.startsWith("This is th")); | assertTrue("no ws at start", contents.startsWith("This is th")); | ||||
assertTrue("no ws at end", contents.endsWith("second line.")); | assertTrue("no ws at end", contents.endsWith("second line.")); | ||||
assertStringContains(contents, " This is the second"); | assertStringContains(contents, " This is the second"); | ||||
@@ -131,7 +127,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
public void testTrimFileByLine() throws IOException { | public void testTrimFileByLine() throws IOException { | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"trimfilebyline", "result/trimfilebyline"); | |||||
"trimfilebyline", getProject().getProperty("output") + "/trimfilebyline"); | |||||
assertFalse("no ws at start", contents.startsWith("This is th")); | assertFalse("no ws at start", contents.startsWith("This is th")); | ||||
assertFalse("no ws at end", contents.endsWith("second line.")); | assertFalse("no ws at end", contents.endsWith("second line.")); | ||||
assertStringNotContains(contents, " This is the second"); | assertStringNotContains(contents, " This is the second"); | ||||
@@ -140,7 +136,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
public void testFilterReplaceString() throws IOException { | public void testFilterReplaceString() throws IOException { | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"filterreplacestring", "result/filterreplacestring"); | |||||
"filterreplacestring", getProject().getProperty("output") + "/filterreplacestring"); | |||||
assertStringContains(contents, "This is the moon"); | assertStringContains(contents, "This is the moon"); | ||||
} | } | ||||
@@ -152,7 +148,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasRegex("testContainsRegex")) | if (! hasRegex("testContainsRegex")) | ||||
return; | return; | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"containsregex", "result/containsregex"); | |||||
"containsregex", getProject().getProperty("output") + "/containsregex"); | |||||
assertStringContains(contents, "hello world"); | assertStringContains(contents, "hello world"); | ||||
assertStringNotContains(contents, "this is the moon"); | assertStringNotContains(contents, "this is the moon"); | ||||
assertStringContains(contents, "World here"); | assertStringContains(contents, "World here"); | ||||
@@ -162,7 +158,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasRegex("testFilterContainsRegex")) | if (! hasRegex("testFilterContainsRegex")) | ||||
return; | return; | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"filtercontainsregex", "result/filtercontainsregex"); | |||||
"filtercontainsregex", getProject().getProperty("output") + "/filtercontainsregex"); | |||||
assertStringContains(contents, "hello world"); | assertStringContains(contents, "hello world"); | ||||
assertStringNotContains(contents, "this is the moon"); | assertStringNotContains(contents, "this is the moon"); | ||||
assertStringContains(contents, "World here"); | assertStringContains(contents, "World here"); | ||||
@@ -172,13 +168,13 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasRegex("testContainsRegex2")) | if (! hasRegex("testContainsRegex2")) | ||||
return; | return; | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"containsregex2", "result/containsregex2"); | |||||
"containsregex2", getProject().getProperty("output") + "/containsregex2"); | |||||
assertStringContains(contents, "void register_bits();"); | assertStringContains(contents, "void register_bits();"); | ||||
} | } | ||||
public void testDeleteCharacters() throws IOException { | public void testDeleteCharacters() throws IOException { | ||||
String contents = getFileString( | String contents = getFileString( | ||||
"deletecharacters", "result/deletechars"); | |||||
"deletecharacters", getProject().getProperty("output") + "/deletechars"); | |||||
assertStringNotContains(contents, "#"); | assertStringNotContains(contents, "#"); | ||||
assertStringNotContains(contents, "*"); | assertStringNotContains(contents, "*"); | ||||
assertStringContains(contents, "This is some "); | assertStringContains(contents, "This is some "); | ||||
@@ -188,7 +184,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasScript("testScriptFilter")) | if (! hasScript("testScriptFilter")) | ||||
return; | return; | ||||
expectFileContains("scriptfilter", "result/scriptfilter", | |||||
expectFileContains("scriptfilter", getProject().getProperty("output") + "/scriptfilter", | |||||
"HELLO WORLD"); | "HELLO WORLD"); | ||||
} | } | ||||
@@ -197,12 +193,12 @@ public class TokenFilterTest extends BuildFileTest { | |||||
if (! hasScript("testScriptFilter")) | if (! hasScript("testScriptFilter")) | ||||
return; | return; | ||||
expectFileContains("scriptfilter2", "result/scriptfilter2", | |||||
expectFileContains("scriptfilter2", getProject().getProperty("output") + "/scriptfilter2", | |||||
"HELLO MOON"); | "HELLO MOON"); | ||||
} | } | ||||
public void testCustomTokenFilter() throws IOException { | public void testCustomTokenFilter() throws IOException { | ||||
expectFileContains("customtokenfilter", "result/custom", | |||||
expectFileContains("customtokenfilter", getProject().getProperty("output") + "/custom", | |||||
"Hello World"); | "Hello World"); | ||||
} | } | ||||
@@ -224,7 +220,7 @@ public class TokenFilterTest extends BuildFileTest { | |||||
private boolean hasRegex(String test) { | private boolean hasRegex(String test) { | ||||
try { | try { | ||||
executeTarget("hasregex"); | executeTarget("hasregex"); | ||||
expectFileContains("result/replaceregexp", "bye world"); | |||||
expectFileContains(getProject().getProperty("output") + "/replaceregexp", "bye world"); | |||||
} | } | ||||
catch (Throwable ex) { | catch (Throwable ex) { | ||||
System.out.println(test + ": skipped - regex not present " | System.out.println(test + ": skipped - regex not present " | ||||
@@ -35,27 +35,20 @@ public class AbstractCvsTaskTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/taskdefs/abstractcvstask.xml"); | configureProject("src/etc/testcases/taskdefs/abstractcvstask.xml"); | ||||
} | |||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testAbstractCvsTask() { | |||||
executeTarget( "all" ); | |||||
executeTarget("setUp"); | |||||
} | } | ||||
public void testPackageAttribute() { | public void testPackageAttribute() { | ||||
File f = getProject().resolveFile("tmpdir/ant/build.xml"); | |||||
File f = new File(getProject().getProperty("output") + "/src/Makefile"); | |||||
assertTrue("starting empty", !f.exists()); | assertTrue("starting empty", !f.exists()); | ||||
expectLogContaining("package-attribute", "U ant/build.xml"); | |||||
expectLogContaining("package-attribute", "U src/Makefile"); | |||||
assertTrue("now it is there", f.exists()); | assertTrue("now it is there", f.exists()); | ||||
} | } | ||||
public void testTagAttribute() { | public void testTagAttribute() { | ||||
File f = getProject().resolveFile("tmpdir/ant/build.xml"); | |||||
File f = new File(getProject().getProperty("output") + "/src/Makefile"); | |||||
assertTrue("starting empty", !f.exists()); | assertTrue("starting empty", !f.exists()); | ||||
expectLogContaining("tag-attribute", "ANT_141 (revision: 1.175.2.13)"); | |||||
expectLogContaining("tag-attribute", "OPENBSD_5_3"); | |||||
assertTrue("now it is there", f.exists()); | assertTrue("now it is there", f.exists()); | ||||
} | } | ||||
} | } |
@@ -34,10 +34,6 @@ public class MultiMapTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/taskdefs/multimap.xml"); | configureProject("src/etc/testcases/taskdefs/multimap.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testMultiCopy() { | public void testMultiCopy() { | ||||
executeTarget("multicopy"); | executeTarget("multicopy"); | ||||
} | } | ||||
@@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.File; | import java.io.File; | ||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
/** | /** | ||||
@@ -33,6 +34,7 @@ public class TarTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/taskdefs/tar.xml"); | configureProject("src/etc/testcases/taskdefs/tar.xml"); | ||||
executeTarget("setUp"); | |||||
} | } | ||||
public void test1() { | public void test1() { | ||||
@@ -54,7 +56,7 @@ public class TarTest extends BuildFileTest { | |||||
public void test5() { | public void test5() { | ||||
executeTarget("test5"); | executeTarget("test5"); | ||||
File f | File f | ||||
= new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test5.tar"); | |||||
= new File(getProject().getProperty("output"), "test5.tar"); | |||||
if (!f.exists()) { | if (!f.exists()) { | ||||
fail("Tarring a directory failed"); | fail("Tarring a directory failed"); | ||||
@@ -80,14 +82,14 @@ public class TarTest extends BuildFileTest { | |||||
private void test7(String target) { | private void test7(String target) { | ||||
executeTarget(target); | executeTarget(target); | ||||
File f1 | File f1 | ||||
= new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test7-prefix"); | |||||
= new File(getProject().getProperty("output"), "untar/test7-prefix"); | |||||
if (!(f1.exists() && f1.isDirectory())) { | if (!(f1.exists() && f1.isDirectory())) { | ||||
fail("The prefix attribute is not working properly."); | fail("The prefix attribute is not working properly."); | ||||
} | } | ||||
File f2 | File f2 | ||||
= new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test7dir"); | |||||
= new File(getProject().getProperty("output"), "untar/test7dir"); | |||||
if (!(f2.exists() && f2.isDirectory())) { | if (!(f2.exists() && f2.isDirectory())) { | ||||
fail("The prefix attribute is not working properly."); | fail("The prefix attribute is not working properly."); | ||||
@@ -117,7 +119,7 @@ public class TarTest extends BuildFileTest { | |||||
private void test8(String target) { | private void test8(String target) { | ||||
executeTarget(target); | executeTarget(target); | ||||
File f1 | File f1 | ||||
= new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test8.xml"); | |||||
= new File(getProject().getProperty("output"), "untar/test8.xml"); | |||||
if (! f1.exists()) { | if (! f1.exists()) { | ||||
fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); | fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); | ||||
} | } | ||||
@@ -130,7 +132,7 @@ public class TarTest extends BuildFileTest { | |||||
public void test10() { | public void test10() { | ||||
executeTarget("test10"); | executeTarget("test10"); | ||||
File f1 | File f1 | ||||
= new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test10.xml"); | |||||
= new File(getProject().getProperty("output"), "untar/test10.xml"); | |||||
if (! f1.exists()) { | if (! f1.exists()) { | ||||
fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); | fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); | ||||
} | } | ||||
@@ -139,7 +141,7 @@ public class TarTest extends BuildFileTest { | |||||
public void test11() { | public void test11() { | ||||
executeTarget("test11"); | executeTarget("test11"); | ||||
File f1 | File f1 | ||||
= new File(System.getProperty("root"), "src/etc/testcases/taskdefs/test11.xml"); | |||||
= new File(getProject().getProperty("output"), "untar/test11.xml"); | |||||
if (! f1.exists()) { | if (! f1.exists()) { | ||||
fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); | fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly"); | ||||
} | } | ||||
@@ -149,10 +151,8 @@ public class TarTest extends BuildFileTest { | |||||
executeTarget("testGZipResource"); | executeTarget("testGZipResource"); | ||||
assertTrue(FileUtils.getFileUtils() | assertTrue(FileUtils.getFileUtils() | ||||
.contentEquals(getProject().resolveFile("../asf-logo.gif"), | .contentEquals(getProject().resolveFile("../asf-logo.gif"), | ||||
getProject().resolveFile("testout/asf-logo.gif.gz"))); | |||||
new File(getProject().getProperty("output"), "untar/asf-logo.gif.gz"))); | |||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
} | } |
@@ -20,6 +20,8 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import java.io.File; | |||||
/** | /** | ||||
*/ | */ | ||||
public class UntarTest extends BuildFileTest { | public class UntarTest extends BuildFileTest { | ||||
@@ -35,10 +37,6 @@ public class UntarTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/taskdefs/untar.xml"); | configureProject("src/etc/testcases/taskdefs/untar.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void testRealTest() throws java.io.IOException { | public void testRealTest() throws java.io.IOException { | ||||
testLogoExtraction("realTest"); | testLogoExtraction("realTest"); | ||||
} | } | ||||
@@ -81,12 +79,13 @@ public class UntarTest extends BuildFileTest { | |||||
private void testLogoExtraction(String target) throws java.io.IOException { | private void testLogoExtraction(String target) throws java.io.IOException { | ||||
executeTarget(target); | executeTarget(target); | ||||
assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | ||||
project.resolveFile("asf-logo.gif"))); | |||||
new File(getProject().getProperty("output"), "untar/" + | |||||
"asf-logo.gif"))); | |||||
} | } | ||||
public void testDocumentationClaimsOnCopy() { | public void testDocumentationClaimsOnCopy() { | ||||
executeTarget("testDocumentationClaimsOnCopy"); | executeTarget("testDocumentationClaimsOnCopy"); | ||||
assertFalse(getProject().resolveFile("untartestout/1/foo").exists()); | |||||
assertTrue(getProject().resolveFile("untartestout/2/bar").exists()); | |||||
assertFalse(new File(getProject().getProperty("output"), "untar/1/foo").exists()); | |||||
assertTrue(new File(getProject().getProperty("output"), "untar/2/bar").exists()); | |||||
} | } | ||||
} | } |
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import java.io.File; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
/** | /** | ||||
@@ -37,10 +38,6 @@ public class UnzipTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/taskdefs/unzip.xml"); | configureProject("src/etc/testcases/taskdefs/unzip.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void test1() { | public void test1() { | ||||
expectBuildException("test1", "required argument not specified"); | expectBuildException("test1", "required argument not specified"); | ||||
} | } | ||||
@@ -65,7 +62,7 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
private void assertLogoUncorrupted() throws IOException { | private void assertLogoUncorrupted() throws IOException { | ||||
assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"), | ||||
project.resolveFile("asf-logo.gif"))); | |||||
new File(getProject().getProperty("output"), "asf-logo.gif"))); | |||||
} | } | ||||
public void testTestZipTask() throws java.io.IOException { | public void testTestZipTask() throws java.io.IOException { | ||||
@@ -83,8 +80,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testPatternSetExcludeOnly() { | public void testPatternSetExcludeOnly() { | ||||
executeTarget("testPatternSetExcludeOnly"); | executeTarget("testPatternSetExcludeOnly"); | ||||
assertFileMissing("1/foo is excluded", "unziptestout/1/foo"); | |||||
assertFileExists("2/bar is not excluded", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is excluded", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("2/bar is not excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
/* | /* | ||||
@@ -92,8 +89,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testPatternSetIncludeOnly() { | public void testPatternSetIncludeOnly() { | ||||
executeTarget("testPatternSetIncludeOnly"); | executeTarget("testPatternSetIncludeOnly"); | ||||
assertFileMissing("1/foo is not included", "unziptestout/1/foo"); | |||||
assertFileExists("2/bar is included", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("2/bar is included", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
/* | /* | ||||
@@ -101,8 +98,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testPatternSetIncludeAndExclude() { | public void testPatternSetIncludeAndExclude() { | ||||
executeTarget("testPatternSetIncludeAndExclude"); | executeTarget("testPatternSetIncludeAndExclude"); | ||||
assertFileMissing("1/foo is not included", "unziptestout/1/foo"); | |||||
assertFileMissing("2/bar is excluded", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileMissing("2/bar is excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
/* | /* | ||||
@@ -110,8 +107,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testTwoPatternSets() { | public void testTwoPatternSets() { | ||||
executeTarget("testTwoPatternSets"); | executeTarget("testTwoPatternSets"); | ||||
assertFileMissing("1/foo is not included", "unziptestout/1/foo"); | |||||
assertFileExists("2/bar is included", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("2/bar is included", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
/* | /* | ||||
@@ -119,8 +116,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testTwoPatternSetsWithExcludes() { | public void testTwoPatternSetsWithExcludes() { | ||||
executeTarget("testTwoPatternSetsWithExcludes"); | executeTarget("testTwoPatternSetsWithExcludes"); | ||||
assertFileMissing("1/foo is not included", "unziptestout/1/foo"); | |||||
assertFileMissing("2/bar is excluded", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileMissing("2/bar is excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
/* | /* | ||||
@@ -138,8 +135,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testPatternSetSlashOnly() { | public void testPatternSetSlashOnly() { | ||||
executeTarget("testPatternSetSlashOnly"); | executeTarget("testPatternSetSlashOnly"); | ||||
assertFileMissing("1/foo is not included", "unziptestout/1/foo"); | |||||
assertFileExists("\"2/bar is included", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is not included", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("\"2/bar is included", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
@@ -148,7 +145,7 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testEncoding() { | public void testEncoding() { | ||||
executeTarget("encodingTest"); | executeTarget("encodingTest"); | ||||
assertFileExists("foo has been properly named", "unziptestout/foo"); | |||||
assertFileExists("foo has been properly named", getProject().getProperty("output") + "/unziptestout/foo"); | |||||
} | } | ||||
/* | /* | ||||
@@ -156,8 +153,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testFlattenMapper() { | public void testFlattenMapper() { | ||||
executeTarget("testFlattenMapper"); | executeTarget("testFlattenMapper"); | ||||
assertFileMissing("1/foo is not flattened", "unziptestout/1/foo"); | |||||
assertFileExists("foo is flattened", "unziptestout/foo"); | |||||
assertFileMissing("1/foo is not flattened", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("foo is flattened", getProject().getProperty("output") + "/unziptestout/foo"); | |||||
} | } | ||||
/** | /** | ||||
@@ -186,8 +183,8 @@ public class UnzipTest extends BuildFileTest { | |||||
*/ | */ | ||||
public void testGlobMapper() { | public void testGlobMapper() { | ||||
executeTarget("testGlobMapper"); | executeTarget("testGlobMapper"); | ||||
assertFileMissing("1/foo is not mapped", "unziptestout/1/foo"); | |||||
assertFileExists("1/foo is mapped", "unziptestout/1/foo.txt"); | |||||
assertFileMissing("1/foo is not mapped", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("1/foo is mapped", getProject().getProperty("output") + "/unziptestout/1/foo.txt"); | |||||
} | } | ||||
public void testTwoMappers() { | public void testTwoMappers() { | ||||
@@ -197,12 +194,12 @@ public class UnzipTest extends BuildFileTest { | |||||
public void testResourceCollections() { | public void testResourceCollections() { | ||||
executeTarget("testResourceCollection"); | executeTarget("testResourceCollection"); | ||||
assertFileExists("junit.jar has been extracted", | assertFileExists("junit.jar has been extracted", | ||||
"unziptestout/junit/framework/Assert.class"); | |||||
getProject().getProperty("output") + "/unziptestout/junit/framework/Assert.class"); | |||||
} | } | ||||
public void testDocumentationClaimsOnCopy() { | public void testDocumentationClaimsOnCopy() { | ||||
executeTarget("testDocumentationClaimsOnCopy"); | executeTarget("testDocumentationClaimsOnCopy"); | ||||
assertFileMissing("1/foo is excluded", "unziptestout/1/foo"); | |||||
assertFileExists("2/bar is not excluded", "unziptestout/2/bar"); | |||||
assertFileMissing("1/foo is excluded", getProject().getProperty("output") + "/unziptestout/1/foo"); | |||||
assertFileExists("2/bar is not excluded", getProject().getProperty("output") + "/unziptestout/2/bar"); | |||||
} | } | ||||
} | } |
@@ -38,6 +38,7 @@ public class ZipTest extends BuildFileTest { | |||||
public void setUp() { | public void setUp() { | ||||
configureProject("src/etc/testcases/taskdefs/zip.xml"); | configureProject("src/etc/testcases/taskdefs/zip.xml"); | ||||
executeTarget("setUp"); | |||||
} | } | ||||
public void test1() { | public void test1() { | ||||
@@ -65,7 +66,11 @@ public class ZipTest extends BuildFileTest { | |||||
} catch (IOException e) { | } catch (IOException e) { | ||||
//ignored | //ignored | ||||
} | } | ||||
executeTarget("cleanup"); | |||||
try { | |||||
super.tearDown(); | |||||
} catch (Exception exc) { | |||||
System.err.println(exc.getMessage()); | |||||
} | |||||
} | } | ||||
public void test5() { | public void test5() { | ||||
@@ -89,7 +94,7 @@ public class ZipTest extends BuildFileTest { | |||||
public void testZipgroupfileset() throws IOException { | public void testZipgroupfileset() throws IOException { | ||||
executeTarget("testZipgroupfileset"); | executeTarget("testZipgroupfileset"); | ||||
ZipFile zipFile = new ZipFile(new File(getProjectDir(), "zipgroupfileset.zip")); | |||||
ZipFile zipFile = new ZipFile(new File(getProject().getProperty("output"), "zipgroupfileset.zip")); | |||||
assertTrue(zipFile.getEntry("ant.xml") != null); | assertTrue(zipFile.getEntry("ant.xml") != null); | ||||
assertTrue(zipFile.getEntry("optional/jspc.xml") != null); | assertTrue(zipFile.getEntry("optional/jspc.xml") != null); | ||||
@@ -113,7 +118,7 @@ public class ZipTest extends BuildFileTest { | |||||
// Bugzilla Report 18403 | // Bugzilla Report 18403 | ||||
public void testPrefixAddsDir() throws IOException { | public void testPrefixAddsDir() throws IOException { | ||||
executeTarget("testPrefixAddsDir"); | executeTarget("testPrefixAddsDir"); | ||||
File archive = getProject().resolveFile("test3.zip"); | |||||
File archive = new File(getProject().getProperty("output"), "test3.zip"); | |||||
zfPrefixAddsDir = new ZipFile(archive); | zfPrefixAddsDir = new ZipFile(archive); | ||||
ZipEntry ze = zfPrefixAddsDir.getEntry("test/"); | ZipEntry ze = zfPrefixAddsDir.getEntry("test/"); | ||||
assertNotNull("test/ has been added", ze); | assertNotNull("test/ has been added", ze); | ||||
@@ -124,10 +129,10 @@ public class ZipTest extends BuildFileTest { | |||||
public void testFilesOnlyDoesntCauseRecreate() | public void testFilesOnlyDoesntCauseRecreate() | ||||
throws InterruptedException { | throws InterruptedException { | ||||
executeTarget("testFilesOnlyDoesntCauseRecreateSetup"); | executeTarget("testFilesOnlyDoesntCauseRecreateSetup"); | ||||
long l = getProject().resolveFile("test3.zip").lastModified(); | |||||
long l = new File(getProject().getProperty("output"), "test3.zip").lastModified(); | |||||
Thread.sleep(3000); | Thread.sleep(3000); | ||||
executeTarget("testFilesOnlyDoesntCauseRecreate"); | executeTarget("testFilesOnlyDoesntCauseRecreate"); | ||||
assertEquals(l, getProject().resolveFile("test3.zip").lastModified()); | |||||
assertEquals(l, new File(getProject().getProperty("output"), "test3.zip").lastModified()); | |||||
} | } | ||||
// Bugzilla Report 22865 | // Bugzilla Report 22865 | ||||
@@ -156,7 +161,7 @@ public class ZipTest extends BuildFileTest { | |||||
executeTarget("testDefaultExcludesAndUpdate"); | executeTarget("testDefaultExcludesAndUpdate"); | ||||
ZipFile f = null; | ZipFile f = null; | ||||
try { | try { | ||||
f = new ZipFile(getProject().resolveFile("test3.zip")); | |||||
f = new ZipFile(new File(getProject().getProperty("output"), "test3.zip")); | |||||
assertNotNull("ziptest~ should be included", | assertNotNull("ziptest~ should be included", | ||||
f.getEntry("ziptest~")); | f.getEntry("ziptest~")); | ||||
} finally { | } finally { | ||||
@@ -178,8 +183,7 @@ public class ZipTest extends BuildFileTest { | |||||
executeTarget("testTarFileSet"); | executeTarget("testTarFileSet"); | ||||
org.apache.tools.zip.ZipFile zf = null; | org.apache.tools.zip.ZipFile zf = null; | ||||
try { | try { | ||||
zf = new org.apache.tools.zip.ZipFile(getProject() | |||||
.resolveFile("test3.zip")); | |||||
zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); | |||||
org.apache.tools.zip.ZipEntry ze = zf.getEntry("asf-logo.gif"); | org.apache.tools.zip.ZipEntry ze = zf.getEntry("asf-logo.gif"); | ||||
assertEquals(UnixStat.FILE_FLAG | 0446, ze.getUnixMode()); | assertEquals(UnixStat.FILE_FLAG | 0446, ze.getUnixMode()); | ||||
} finally { | } finally { | ||||
@@ -193,8 +197,7 @@ public class ZipTest extends BuildFileTest { | |||||
executeTarget("rewriteZeroPermissions"); | executeTarget("rewriteZeroPermissions"); | ||||
org.apache.tools.zip.ZipFile zf = null; | org.apache.tools.zip.ZipFile zf = null; | ||||
try { | try { | ||||
zf = new org.apache.tools.zip.ZipFile(getProject() | |||||
.resolveFile("test3.zip")); | |||||
zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); | |||||
org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt"); | org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt"); | ||||
assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode()); | assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode()); | ||||
} finally { | } finally { | ||||
@@ -208,8 +211,7 @@ public class ZipTest extends BuildFileTest { | |||||
executeTarget("acceptZeroPermissions"); | executeTarget("acceptZeroPermissions"); | ||||
org.apache.tools.zip.ZipFile zf = null; | org.apache.tools.zip.ZipFile zf = null; | ||||
try { | try { | ||||
zf = new org.apache.tools.zip.ZipFile(getProject() | |||||
.resolveFile("test3.zip")); | |||||
zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); | |||||
org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt"); | org.apache.tools.zip.ZipEntry ze = zf.getEntry("testdir/test.txt"); | ||||
assertEquals(0000, ze.getUnixMode()); | assertEquals(0000, ze.getUnixMode()); | ||||
} finally { | } finally { | ||||
@@ -223,8 +225,7 @@ public class ZipTest extends BuildFileTest { | |||||
executeTarget("testForBugzilla34764"); | executeTarget("testForBugzilla34764"); | ||||
org.apache.tools.zip.ZipFile zf = null; | org.apache.tools.zip.ZipFile zf = null; | ||||
try { | try { | ||||
zf = new org.apache.tools.zip.ZipFile(getProject() | |||||
.resolveFile("test3.zip")); | |||||
zf = new org.apache.tools.zip.ZipFile(new File(getProject().getProperty("output"), "test3.zip")); | |||||
org.apache.tools.zip.ZipEntry ze = zf.getEntry("file1"); | org.apache.tools.zip.ZipEntry ze = zf.getEntry("file1"); | ||||
assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode()); | assertEquals(UnixStat.FILE_FLAG | 0644, ze.getUnixMode()); | ||||
} finally { | } finally { | ||||
@@ -19,6 +19,8 @@ package org.apache.tools.ant.taskdefs.optional; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import java.io.File; | |||||
public class JavahTest extends BuildFileTest { | public class JavahTest extends BuildFileTest { | ||||
private final static String BUILD_XML = | private final static String BUILD_XML = | ||||
@@ -32,19 +34,15 @@ public class JavahTest extends BuildFileTest { | |||||
configureProject(BUILD_XML); | configureProject(BUILD_XML); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("tearDown"); | |||||
} | |||||
public void testSimpleCompile() { | public void testSimpleCompile() { | ||||
executeTarget("simple-compile"); | executeTarget("simple-compile"); | ||||
assertTrue(getProject().resolveFile("output/org_example_Foo.h") | |||||
.exists()); | |||||
assertTrue(new File(getProject().getProperty("output"), "org_example_Foo.h") | |||||
.exists()); | |||||
} | } | ||||
public void testCompileFileset() { | public void testCompileFileset() { | ||||
executeTarget("test-fileset"); | executeTarget("test-fileset"); | ||||
assertTrue(getProject().resolveFile("output/org_example_Foo.h") | |||||
assertTrue(new File(getProject().getProperty("output"), "org_example_Foo.h") | |||||
.exists()); | .exists()); | ||||
} | } | ||||
} | } |
@@ -35,14 +35,10 @@ public class Native2AsciiTest extends BuildFileTest { | |||||
configureProject(BUILD_XML); | configureProject(BUILD_XML); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("tearDown"); | |||||
} | |||||
public void testIso8859_1() throws java.io.IOException { | public void testIso8859_1() throws java.io.IOException { | ||||
executeTarget("testIso8859-1"); | executeTarget("testIso8859-1"); | ||||
File in = getProject().resolveFile("expected/iso8859-1.test"); | File in = getProject().resolveFile("expected/iso8859-1.test"); | ||||
File out = getProject().resolveFile("output/iso8859-1.test"); | |||||
File out = new File(getProject().getProperty("output"), "iso8859-1.test"); | |||||
assertTrue(FileUtils.getFileUtils().contentEquals(in, out, true)); | assertTrue(FileUtils.getFileUtils().contentEquals(in, out, true)); | ||||
} | } | ||||
} | } |
@@ -32,10 +32,6 @@ public class AssertionsTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/types/assertions.xml"); | configureProject("src/etc/testcases/types/assertions.xml"); | ||||
} | } | ||||
protected void tearDown() throws Exception { | |||||
executeTarget("teardown"); | |||||
} | |||||
/** | /** | ||||
* runs a test and expects an assertion thrown in forked code | * runs a test and expects an assertion thrown in forked code | ||||
* @param target | * @param target | ||||
@@ -20,6 +20,8 @@ package org.apache.tools.ant.types.resources; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import java.io.File; | |||||
public class TarResourceTest extends BuildFileTest { | public class TarResourceTest extends BuildFileTest { | ||||
private static final FileUtils FU = FileUtils.getFileUtils(); | private static final FileUtils FU = FileUtils.getFileUtils(); | ||||
@@ -32,13 +34,9 @@ public class TarResourceTest extends BuildFileTest { | |||||
configureProject("src/etc/testcases/types/resources/tarentry.xml"); | configureProject("src/etc/testcases/types/resources/tarentry.xml"); | ||||
} | } | ||||
protected void tearDown() throws Exception { | |||||
executeTarget("tearDown"); | |||||
} | |||||
public void testUncompressSource() throws java.io.IOException { | public void testUncompressSource() throws java.io.IOException { | ||||
executeTarget("uncompressSource"); | executeTarget("uncompressSource"); | ||||
assertTrue(FU.contentEquals(project.resolveFile("../../asf-logo.gif"), | assertTrue(FU.contentEquals(project.resolveFile("../../asf-logo.gif"), | ||||
project.resolveFile("testout/asf-logo.gif"))); | |||||
new File(getProject().getProperty("output"), "asf-logo.gif"))); | |||||
} | } | ||||
} | } |