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