git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1075664 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -17,14 +17,32 @@ | |||
| --> | |||
| <project name="antunit-base"> | |||
| <property name="input" location="${java.io.tmpdir}/testinput"/> | |||
| <property name="input" location="${java.io.tmpdir}testinput"/> | |||
| <property name="output" location="${java.io.tmpdir}/testoutput"/> | |||
| <property name="resources" location="${java.io.tmpdir}/resources"/> | |||
| <property name="test.jar" location="${java.io.tmpdir}/test.jar"/> | |||
| <property name="test1.jar" location="${java.io.tmpdir}/test1.jar"/> | |||
| <property name="test2.jar" location="${java.io.tmpdir}/test2.jar"/> | |||
| <property name="test3.jar" location="${java.io.tmpdir}/test3.jar"/> | |||
| <property name="test4.jar" location="${java.io.tmpdir}/test4.jar"/> | |||
| <property name="test5.jar" location="${java.io.tmpdir}/test5.jar"/> | |||
| <available property="jdk1.6+" classname="java.util.ServiceLoader"/> | |||
| <available property="jdk1.5+" classname="java.net.Proxy"/> | |||
| <condition property="build.sysclasspath.only"> | |||
| <equals arg1="${build.sysclasspath}" arg2="only"/> | |||
| </condition> | |||
| <target name="tearDown"> | |||
| <delete dir="${input}"/> | |||
| <delete dir="${output}"/> | |||
| <delete dir="${resources}"/> | |||
| <delete file="${test.jar}" failonerror="false"/> | |||
| <delete file="${test.jar}" failonerror="false"/> | |||
| <delete file="${test1.jar}" failonerror="false"/> | |||
| <delete file="${test2.jar}" failonerror="false"/> | |||
| <delete file="${test3.jar}" failonerror="false"/> | |||
| <delete file="${test4.jar}" failonerror="false"/> | |||
| <delete file="${test5.jar}" failonerror="false"/> | |||
| </target> | |||
| <target name="antunit"> | |||
| @@ -22,11 +22,11 @@ | |||
| <delete file="concat.resources" /> | |||
| </target> | |||
| <property name="encodeStringDest" location="${output}/encodeStringDest"/> | |||
| <property name="encodeStringDest" location="${output}/encodeStringDest" /> | |||
| <target name="testBinaryAppend"> | |||
| <property name="binaryAppendDest" location="${output}/binaryAppendDest"/> | |||
| <mkdir dir="${output}"/> | |||
| <property name="binaryAppendDest" location="${output}/binaryAppendDest" /> | |||
| <mkdir dir="${output}" /> | |||
| <au:assertTrue message="prerequisite conditions unmet"> | |||
| <length length="0"> | |||
| <!-- allow for nonexistent OR zero-length: --> | |||
| @@ -47,8 +47,7 @@ | |||
| <target name="testStringEncoding" if="os.unix"> | |||
| <property name="br" value="${line.separator}" /> | |||
| <concat destfile="${encodeStringDest}" | |||
| outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
| <concat destfile="${encodeStringDest}" outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
| <au:assertTrue> | |||
| <resourcesmatch astext="true"> | |||
| <file file="utf-16.expected" /> | |||
| @@ -56,17 +55,16 @@ | |||
| </resourcesmatch> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testStringEncodingWindows" if="os.windows"> | |||
| <property name="br" value="${line.separator}" /> | |||
| <concat destfile="${encodeStringDest}" | |||
| outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
| <au:assertTrue> | |||
| <resourcesmatch astext="true"> | |||
| <file file="utf-16.expected.windows" /> | |||
| <file file="${encodeStringDest}" /> | |||
| </resourcesmatch> | |||
| </au:assertTrue> | |||
| <concat destfile="${encodeStringDest}" outputEncoding="utf-16">foo${br}bar${br}baz${br}</concat> | |||
| <au:assertTrue> | |||
| <resourcesmatch astext="true"> | |||
| <file file="utf-16.expected.windows" /> | |||
| <file file="${encodeStringDest}" /> | |||
| </resourcesmatch> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testDoNotFixNestedText" description="Bugzilla 42369"> | |||
| @@ -79,45 +77,45 @@ | |||
| </target> | |||
| <target name="testIgnoreEmptyFalseFileIsCreated"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <concat destfile="${output}/TESTDEST" append="true" ignoreEmpty="false"> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist"/> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist" /> | |||
| </concat> | |||
| <au:assertFileExists file="${output}/TESTDEST"/> | |||
| <au:assertFileExists file="${output}/TESTDEST" /> | |||
| </target> | |||
| <target name="testIgnoreEmptyTrueFileIsNotCreated"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <concat destfile="${output}/TESTDEST" append="true" ignoreEmpty="true"> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist"/> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist" /> | |||
| </concat> | |||
| <au:assertFileDoesntExist file="${output}/TESTDEST"/> | |||
| <au:assertFileDoesntExist file="${output}/TESTDEST" /> | |||
| </target> | |||
| <target name="testIgnoreEmptyFalseFileIsCreatedIncludesHeader"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <concat destfile="${output}/TESTDEST" ignoreEmpty="false"> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist"/> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist" /> | |||
| <header filtering="false" trim="yes"> | |||
| header | |||
| </header> | |||
| </concat> | |||
| <au:assertFileExists file="${output}/TESTDEST"/> | |||
| <au:assertResourceContains resource="${output}/TESTDEST" value="header"/> | |||
| <au:assertFileExists file="${output}/TESTDEST" /> | |||
| <au:assertResourceContains resource="${output}/TESTDEST" value="header" /> | |||
| </target> | |||
| <target name="testIgnoreEmptyFalseFileIsCreatedIncludesFooter"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <concat destfile="${output}/TESTDEST" ignoreEmpty="false"> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist"/> | |||
| <filelist dir="${input}" files="thisfiledoesnotexist" /> | |||
| <footer filtering="no">footer</footer> | |||
| </concat> | |||
| <au:assertFileExists file="${output}/TESTDEST"/> | |||
| <au:assertResourceContains resource="${output}/TESTDEST" value="footer"/> | |||
| <au:assertFileExists file="${output}/TESTDEST" /> | |||
| <au:assertResourceContains resource="${output}/TESTDEST" value="footer" /> | |||
| </target> | |||
| <target name="testResources"> | |||
| @@ -19,51 +19,51 @@ | |||
| <target name="test-atleast"> | |||
| <au:assertTrue message="Expected antversion of ${ant.version} to be at least 1.7.0"> | |||
| <!-- AntVersion was introduced like AntUnit in 1.7 - so this must be true --> | |||
| <antversion atleast="1.7.0"/> | |||
| </au:assertTrue> | |||
| <!-- AntVersion was introduced like AntUnit in 1.7 - so this must be true --> | |||
| <antversion atleast="1.7.0" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="test-exactly"> | |||
| <antversion property="ant.actual.version"/> | |||
| <antversion property="ant.actual.version" /> | |||
| <au:assertTrue message="Expected antversion of ${ant.actual.version}"> | |||
| <antversion exactly="${ant.actual.version}"/> | |||
| </au:assertTrue> | |||
| <antversion exactly="${ant.actual.version}" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="test-atleast-fail"> | |||
| <property name="version" value="1.8.9"/> | |||
| <property name="version" value="1.8.9" /> | |||
| <au:assertFalse> | |||
| <antversion atleast="1.9.0"/> | |||
| <antversion atleast="1.9.0" /> | |||
| </au:assertFalse> | |||
| </target> | |||
| <target name="test-task"> | |||
| <antversion property="antversion"/> | |||
| <au:assertPropertySet name="antversion" message="Property 'antversion' should be set."/> | |||
| <echo>AntVersion=${antversion}</echo> | |||
| </target> | |||
| <antversion property="antversion" /> | |||
| <au:assertPropertySet name="antversion" message="Property 'antversion' should be set." /> | |||
| <echo>AntVersion=${antversion}</echo> | |||
| </target> | |||
| <target name="test-property-conditional1"> | |||
| <antversion property="antversion" atleast="2.0.0"/> | |||
| <antversion property="antversion" atleast="2.0.0" /> | |||
| <au:assertTrue message="Property 'antversion' should not be set because this is not Ant 2.0.0+."> | |||
| <not> | |||
| <isset property="antversion"/> | |||
| </not> | |||
| </au:assertTrue> | |||
| <isset property="antversion" /> | |||
| </not> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="test-property-conditional2"> | |||
| <antversion property="antversion" atleast="1.7.0"/> | |||
| <antversion property="antversion" atleast="1.7.0" /> | |||
| <au:assertTrue message="Property 'antversion' should be set because we should have Ant 1.7.0+ (${ant.version})."> | |||
| <isset property="antversion"/> | |||
| </au:assertTrue> | |||
| <isset property="antversion" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="all"> | |||
| <au:antunit> | |||
| <fileset file="${ant.file}"/> | |||
| <au:plainlistener/> | |||
| <fileset file="${ant.file}" /> | |||
| <au:plainlistener /> | |||
| </au:antunit> | |||
| </target> | |||
| @@ -17,40 +17,40 @@ | |||
| --> | |||
| <project name="hasfreespace-test" default="all" basedir="." xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <available property="jdk6.available" classname="java.util.ServiceLoader"/> | |||
| <available property="jdk6.available" classname="java.util.ServiceLoader" /> | |||
| <property name="partition" value="${user.home}" /> | |||
| <target name="test-not-enough-space-human" if="jdk6.available"> | |||
| <au:assertFalse> | |||
| <hasfreespace partition="${partition}" needed="1P"/> | |||
| </au:assertFalse> | |||
| <hasfreespace partition="${partition}" needed="1P" /> | |||
| </au:assertFalse> | |||
| </target> | |||
| <target name="test-enough-space-human" if="jdk6.available"> | |||
| <au:assertTrue> | |||
| <hasfreespace partition="${partition}" needed="1K"/> | |||
| </au:assertTrue> | |||
| <hasfreespace partition="${partition}" needed="1K" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="test-not-enough-space" if="jdk6.available"> | |||
| <property name="long.max-value" value="9223372036854775807"/> | |||
| <property name="long.max-value" value="9223372036854775807" /> | |||
| <au:assertFalse> | |||
| <hasfreespace partition="${partition}" needed="${long.max-value}"/> | |||
| <hasfreespace partition="${partition}" needed="${long.max-value}" /> | |||
| </au:assertFalse> | |||
| </target> | |||
| <target name="test-enough-space" if="jdk6.available"> | |||
| <au:assertTrue> | |||
| <hasfreespace partition="${partition}" needed="1"/> | |||
| </au:assertTrue> | |||
| <hasfreespace partition="${partition}" needed="1" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="all"> | |||
| <au:antunit> | |||
| <fileset file="${ant.file}"/> | |||
| <au:plainlistener/> | |||
| <fileset file="${ant.file}" /> | |||
| <au:plainlistener /> | |||
| </au:antunit> | |||
| </target> | |||
| @@ -16,14 +16,13 @@ | |||
| limitations under the License. | |||
| --> | |||
| <project name="dependset-test" xmlns:au="antlib:org.apache.ant.antunit" | |||
| default="antunit"> | |||
| <project name="dependset-test" xmlns:au="antlib:org.apache.ant.antunit" default="antunit"> | |||
| <import file="../antunit-base.xml" /> | |||
| <target name="setUp"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| </target> | |||
| <target name="testNoSourcesOrTargets"> | |||
| @@ -54,8 +53,7 @@ | |||
| <srcfilelist dir="${input}" files="test4.tmp" /> | |||
| <targetfileset id="targetfs" dir="${output}" includes="i-do-not-exist" /> | |||
| </dependset> | |||
| <au:assertLogDoesntContain text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogDoesntContain text="Deleting all target files." level="verbose" /> | |||
| </target> | |||
| <target name="testMoreRecentSourceFile" depends="setUp"> | |||
| @@ -66,14 +64,11 @@ | |||
| <srcfilelist dir="${input}" files="newer.tmp" /> | |||
| <targetfilelist dir="${output}" files="older.tmp" /> | |||
| </dependset> | |||
| <au:assertLogContains text="older.tmp" is oldest target file" | |||
| level="verbose"/> | |||
| <au:assertLogContains text="newer.tmp" is newest source" | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogDoesntContain text="Deleting" level="info"/> | |||
| <au:assertFileDoesntExist file="${output}/older.tmp"/> | |||
| <au:assertLogContains text="older.tmp" is oldest target file" level="verbose" /> | |||
| <au:assertLogContains text="newer.tmp" is newest source" level="verbose" /> | |||
| <au:assertLogContains text="Deleting all target files." level="verbose" /> | |||
| <au:assertLogDoesntContain text="Deleting" level="info" /> | |||
| <au:assertFileDoesntExist file="${output}/older.tmp" /> | |||
| </target> | |||
| <target name="testMoreRecentSourceFileVerbose" depends="setUp"> | |||
| @@ -84,14 +79,11 @@ | |||
| <srcfilelist dir="${input}" files="newer.tmp" /> | |||
| <targetfilelist dir="${output}" files="older.tmp" /> | |||
| </dependset> | |||
| <au:assertLogContains text="older.tmp" is oldest target file" | |||
| level="info"/> | |||
| <au:assertLogContains text="newer.tmp" is newest source" | |||
| level="info"/> | |||
| <au:assertLogContains text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting" level="info"/> | |||
| <au:assertFileDoesntExist file="${output}/older.tmp"/> | |||
| <au:assertLogContains text="older.tmp" is oldest target file" level="info" /> | |||
| <au:assertLogContains text="newer.tmp" is newest source" level="info" /> | |||
| <au:assertLogContains text="Deleting all target files." level="verbose" /> | |||
| <au:assertLogContains text="Deleting" level="info" /> | |||
| <au:assertFileDoesntExist file="${output}/older.tmp" /> | |||
| </target> | |||
| <target name="testMultipleFiles" depends="setUp"> | |||
| @@ -100,7 +92,7 @@ | |||
| <sleep seconds="3" /> | |||
| <touch file="${input}/sourceset_2.tmp" /> | |||
| <touch file="${output}/targetset_2.tmp" /> | |||
| <sleep seconds="2" /> | |||
| <sleep seconds="2" /> | |||
| <dependset> | |||
| <sources> | |||
| <filelist dir="${input}" files="sourceset_1.tmp,sourceset_2.tmp" /> | |||
| @@ -109,13 +101,10 @@ | |||
| <filelist dir="${output}/" files="targetset_1.tmp,targetset_2.tmp" /> | |||
| </targets> | |||
| </dependset> | |||
| <au:assertLogContains text="targetset_1.tmp" is oldest target file" | |||
| level="verbose"/> | |||
| <au:assertLogContains text="sourceset_2.tmp" is newest source" | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogDoesntContain text="Deleting" level="info"/> | |||
| <au:assertLogContains text="targetset_1.tmp" is oldest target file" level="verbose" /> | |||
| <au:assertLogContains text="sourceset_2.tmp" is newest source" level="verbose" /> | |||
| <au:assertLogContains text="Deleting all target files." level="verbose" /> | |||
| <au:assertLogDoesntContain text="Deleting" level="info" /> | |||
| <au:assertFileDoesntExist file="${output}/targetset_1.tmp" /> | |||
| <au:assertFileDoesntExist file="${output}/targetset_2.tmp" /> | |||
| </target> | |||
| @@ -126,7 +115,7 @@ | |||
| <sleep seconds="3" /> | |||
| <touch file="${input}/sourceset_2.tmp" /> | |||
| <touch file="${output}/targetset_2.tmp" /> | |||
| <sleep seconds="2" /> | |||
| <sleep seconds="2" /> | |||
| <dependset verbose="true"> | |||
| <sources> | |||
| <filelist dir="${input}" files="sourceset_1.tmp,sourceset_2.tmp" /> | |||
| @@ -135,13 +124,10 @@ | |||
| <filelist dir="${output}/" files="targetset_1.tmp,targetset_2.tmp" /> | |||
| </targets> | |||
| </dependset> | |||
| <au:assertLogContains text="targetset_1.tmp" is oldest target file" | |||
| level="info"/> | |||
| <au:assertLogContains text="sourceset_2.tmp" is newest source" | |||
| level="info"/> | |||
| <au:assertLogContains text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting" level="info"/> | |||
| <au:assertLogContains text="targetset_1.tmp" is oldest target file" level="info" /> | |||
| <au:assertLogContains text="sourceset_2.tmp" is newest source" level="info" /> | |||
| <au:assertLogContains text="Deleting all target files." level="verbose" /> | |||
| <au:assertLogContains text="Deleting" level="info" /> | |||
| <au:assertFileDoesntExist file="${output}/targetset_1.tmp" /> | |||
| <au:assertFileDoesntExist file="${output}/targetset_2.tmp" /> | |||
| </target> | |||
| @@ -156,14 +142,10 @@ | |||
| <filelist dir="${output}" files="older.tmp" /> | |||
| </targets> | |||
| </dependset> | |||
| <au:assertLogContains text="1 nonexistent sources" | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogDoesntContain text="Deleting" level="info"/> | |||
| <au:assertLogDoesntContain | |||
| text="Expected source propertyresource "null" is missing." | |||
| level="info"/> | |||
| <au:assertLogContains text="1 nonexistent sources" level="verbose" /> | |||
| <au:assertLogContains text="Deleting all target files." level="verbose" /> | |||
| <au:assertLogDoesntContain text="Deleting" level="info" /> | |||
| <au:assertLogDoesntContain text="Expected source propertyresource "null" is missing." level="info" /> | |||
| <au:assertFileDoesntExist file="${output}/older.tmp" /> | |||
| </target> | |||
| @@ -177,14 +159,10 @@ | |||
| <filelist dir="${output}" files="older.tmp" /> | |||
| </targets> | |||
| </dependset> | |||
| <au:assertLogContains text="1 nonexistent sources" | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogContains text="Deleting" level="info"/> | |||
| <au:assertLogContains | |||
| text="Expected source propertyresource "null" is missing." | |||
| level="info"/> | |||
| <au:assertLogContains text="1 nonexistent sources" level="verbose" /> | |||
| <au:assertLogContains text="Deleting all target files." level="verbose" /> | |||
| <au:assertLogContains text="Deleting" level="info" /> | |||
| <au:assertLogContains text="Expected source propertyresource "null" is missing." level="info" /> | |||
| <au:assertFileDoesntExist file="${output}/older.tmp" /> | |||
| </target> | |||
| @@ -199,8 +177,7 @@ | |||
| <filelist dir="${output}" files="older.tmp" /> | |||
| </targets> | |||
| </dependset> | |||
| <au:assertLogDoesntContain text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogDoesntContain text="Deleting all target files." level="verbose" /> | |||
| <au:assertFileExists file="${output}/older.tmp" /> | |||
| </target> | |||
| @@ -213,8 +190,7 @@ | |||
| <srcfileset dir="." includes="test9.tmp" /> | |||
| <targetfileset dir="${output}/test9dir" /> | |||
| </dependset> | |||
| <au:assertLogDoesntContain text="Deleting all target files." | |||
| level="verbose"/> | |||
| <au:assertLogDoesntContain text="Deleting all target files." level="verbose" /> | |||
| </target> | |||
| </project> | |||
| @@ -18,112 +18,104 @@ | |||
| <project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <import file="../antunit-base.xml" /> | |||
| <property name="javac-dir" location="${output}/javac-dir"/> | |||
| <property name="build-dir" location="${javac-dir}/build"/> | |||
| <property name="javac-dir" location="${output}/javac-dir" /> | |||
| <property name="build-dir" location="${javac-dir}/build" /> | |||
| <target name="test-includeDestClasses"> | |||
| <property name="DATE" value="09/10/1999 4:30 pm"/> | |||
| <delete dir="${javac-dir}/src"/> | |||
| <mkdir dir="${javac-dir}/src"/> | |||
| <property name="DATE" value="09/10/1999 4:30 pm" /> | |||
| <delete dir="${javac-dir}/src" /> | |||
| <mkdir dir="${javac-dir}/src" /> | |||
| <echo file="${javac-dir}/src/A.java"> | |||
| public class A { B b;} | |||
| </echo> | |||
| <echo file="${javac-dir}/src/B.java"> | |||
| public class B { } | |||
| </echo> | |||
| <delete dir="${javac-dir}/classes" quiet="yes"/> | |||
| <mkdir dir="${javac-dir}/classes"/> | |||
| <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes"/> | |||
| <touch file="${javac-dir}/src/B.java" datetime="${DATE}"/> | |||
| <touch file="${javac-dir}/classes/B.class" datetime="${DATE}"/> | |||
| <delete dir="${javac-dir}/classes" quiet="yes" /> | |||
| <mkdir dir="${javac-dir}/classes" /> | |||
| <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" /> | |||
| <touch file="${javac-dir}/src/B.java" datetime="${DATE}" /> | |||
| <touch file="${javac-dir}/classes/B.class" datetime="${DATE}" /> | |||
| <!-- following should not update B.class --> | |||
| <delete quiet="yes" file="${javac-dir}/classes/A.class"/> | |||
| <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes"/> | |||
| <delete quiet="yes" file="${javac-dir}/classes/A.class" /> | |||
| <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" /> | |||
| <au:assertTrue> | |||
| <isfileselected file="${javac-dir}/classes/B.class"> | |||
| <date datetime="${DATE}" when="equal"/> | |||
| <date datetime="${DATE}" when="equal" /> | |||
| </isfileselected> | |||
| </au:assertTrue> | |||
| <!-- following should update B.class --> | |||
| <delete quiet="yes" file="${javac-dir}/classes/A.class"/> | |||
| <javac srcdir="${javac-dir}/src" | |||
| destdir="${javac-dir}/classes" includeDestClasses="no"/> | |||
| <delete quiet="yes" file="${javac-dir}/classes/A.class" /> | |||
| <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" includeDestClasses="no" /> | |||
| <au:assertFalse> | |||
| <isfileselected file="${javac-dir}/classes/B.class"> | |||
| <date datetime="${DATE}" when="equal"/> | |||
| <date datetime="${DATE}" when="equal" /> | |||
| </isfileselected> | |||
| </au:assertFalse> | |||
| </target> | |||
| <target name="test-updated-property"> | |||
| <delete quiet="yes" dir="${build-dir}"/> | |||
| <mkdir dir="${build-dir}"/> | |||
| <javac srcdir="javac-dir/good-src" destdir="${build-dir}" | |||
| updatedProperty="classes-updated"/> | |||
| <delete quiet="yes" dir="${build-dir}" /> | |||
| <mkdir dir="${build-dir}" /> | |||
| <javac srcdir="javac-dir/good-src" destdir="${build-dir}" updatedProperty="classes-updated" /> | |||
| <au:assertTrue> | |||
| <equals arg1="${classes-updated}" arg2="true"/> | |||
| <equals arg1="${classes-updated}" arg2="true" /> | |||
| </au:assertTrue> | |||
| <javac srcdir="javac-dir/good-src" destdir="${build-dir}" | |||
| updatedProperty="classes-updated-2"/> | |||
| <javac srcdir="javac-dir/good-src" destdir="${build-dir}" updatedProperty="classes-updated-2" /> | |||
| <au:assertFalse> | |||
| <isset property="classes-updated-2"/> | |||
| <isset property="classes-updated-2" /> | |||
| </au:assertFalse> | |||
| </target> | |||
| <target name="test-error-property"> | |||
| <delete quiet="yes" dir="${build-dir}"/> | |||
| <mkdir dir="${build-dir}"/> | |||
| <javac srcdir="javac-dir/good-src" destdir="${build-dir}" | |||
| failOnError="false" | |||
| errorProperty="compile-failed"/> | |||
| <delete quiet="yes" dir="${build-dir}" /> | |||
| <mkdir dir="${build-dir}" /> | |||
| <javac srcdir="javac-dir/good-src" destdir="${build-dir}" failOnError="false" errorProperty="compile-failed" /> | |||
| <au:assertTrue> | |||
| <equals arg1="${compile-failed}" arg2="${compile-failed}"/> | |||
| <equals arg1="${compile-failed}" arg2="${compile-failed}" /> | |||
| </au:assertTrue> | |||
| <javac srcdir="javac-dir/bad-src" destdir="${build-dir}" | |||
| failOnError="false" | |||
| errorProperty="compile-failed"/> | |||
| <javac srcdir="javac-dir/bad-src" destdir="${build-dir}" failOnError="false" errorProperty="compile-failed" /> | |||
| <au:assertTrue> | |||
| <equals arg1="${compile-failed}" arg2="true"/> | |||
| <equals arg1="${compile-failed}" arg2="true" /> | |||
| </au:assertTrue> | |||
| </target> | |||
| <target name="testPackageInfoJava" | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=43114"> | |||
| <mkdir dir="${javac-dir}/src/a"/> | |||
| <mkdir dir="${build-dir}"/> | |||
| <echo file="${javac-dir}/src/a/package-info.java"><![CDATA[ | |||
| <target name="testPackageInfoJava" description="https://issues.apache.org/bugzilla/show_bug.cgi?id=43114"> | |||
| <mkdir dir="${javac-dir}/src/a" /> | |||
| <mkdir dir="${build-dir}" /> | |||
| <echo file="${javac-dir}/src/a/package-info.java"> | |||
| <![CDATA[ | |||
| /** | |||
| * Some test javadocs at the package level. | |||
| */ | |||
| ]]></echo> | |||
| <javac srcdir="${javac-dir}/src" destdir="${build-dir}" | |||
| updatedProperty="first-pass"/> | |||
| <au:assertPropertyEquals name="first-pass" value="true"/> | |||
| ]]> | |||
| </echo> | |||
| <javac srcdir="${javac-dir}/src" destdir="${build-dir}" updatedProperty="first-pass" /> | |||
| <au:assertPropertyEquals name="first-pass" value="true" /> | |||
| <!-- no changes, shouldn't recompile, the initial bug --> | |||
| <javac srcdir="${javac-dir}/src" destdir="${build-dir}" | |||
| updatedProperty="second-pass"/> | |||
| <javac srcdir="${javac-dir}/src" destdir="${build-dir}" updatedProperty="second-pass" /> | |||
| <au:assertFalse> | |||
| <isset property="second-pass"/> | |||
| <isset property="second-pass" /> | |||
| </au:assertFalse> | |||
| <sleep seconds="2"/> | |||
| <sleep seconds="2" /> | |||
| <!-- change package-info.java but make containing target dir even | |||
| more recent - the regression in Ant 1.7.1 --> | |||
| <touch file="${javac-dir}/src/a/package-info.java"/> | |||
| <sleep seconds="2"/> | |||
| <touch file="${javac-dir}/src/a/package-info.java" /> | |||
| <sleep seconds="2" /> | |||
| <touch> | |||
| <file file="${build-dir}/a"/> | |||
| <file file="${build-dir}/a" /> | |||
| </touch> | |||
| <javac srcdir="${javac-dir}/src" destdir="${build-dir}" | |||
| updatedProperty="third-pass"/> | |||
| <au:assertPropertyEquals name="third-pass" value="true"/> | |||
| <javac srcdir="${javac-dir}/src" destdir="${build-dir}" updatedProperty="third-pass" /> | |||
| <au:assertPropertyEquals name="third-pass" value="true" /> | |||
| </target> | |||
| <target name="-create-javac-adapter"> | |||
| <property name="adapter.dir" location="${output}/adapter"/> | |||
| <mkdir dir="${input}/org/example"/> | |||
| <echo file="${input}/org/example/Adapter.java"><![CDATA[ | |||
| <property name="adapter.dir" location="${output}/adapter" /> | |||
| <mkdir dir="${input}/org/example" /> | |||
| <echo file="${input}/org/example/Adapter.java"> | |||
| <![CDATA[ | |||
| package org.example; | |||
| import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | |||
| import org.apache.tools.ant.taskdefs.Javac; | |||
| @@ -134,35 +126,35 @@ public class Adapter implements CompilerAdapter { | |||
| System.err.println("adapter called"); | |||
| return true; | |||
| } | |||
| }]]></echo> | |||
| <mkdir dir="${adapter.dir}"/> | |||
| <javac srcdir="${input}" destdir="${adapter.dir}"/> | |||
| }]]> | |||
| </echo> | |||
| <mkdir dir="${resources}" /> | |||
| <javac srcdir="${input}" destdir="${resources}" /> | |||
| </target> | |||
| <target name="testCompilerNotFound" depends="-create-javac-adapter"> | |||
| <au:expectfailure> | |||
| <javac srcdir="${input}" destdir="${output}" | |||
| compiler="org.example.Adapter"/> | |||
| <javac srcdir="${input}" destdir="${output}" compiler="org.example.Adapter" /> | |||
| </au:expectfailure> | |||
| <au:assertLogDoesntContain text="adapter called"/> | |||
| <au:assertLogDoesntContain text="adapter called" /> | |||
| </target> | |||
| <target name="testCompilerClasspath" depends="-create-javac-adapter" | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=11143"> | |||
| <javac srcdir="${input}" destdir="${output}" | |||
| compiler="org.example.Adapter"> | |||
| <compilerclasspath location="${adapter.dir}"/> | |||
| <target name="testCompilerClasspath" depends="-create-javac-adapter" description="https://issues.apache.org/bugzilla/show_bug.cgi?id=11143"> | |||
| <mkdir dir="${output}" /> | |||
| <javac srcdir="${input}" destdir="${output}" compiler="org.example.Adapter"> | |||
| <compilerclasspath location="${resources}" /> | |||
| </javac> | |||
| <au:assertLogContains text="adapter called"/> | |||
| <au:assertLogContains text="adapter called" /> | |||
| </target> | |||
| <target name="testCompilerAsNestedElement" depends="-create-javac-adapter"> | |||
| <componentdef classname="org.example.Adapter" name="myjavac"> | |||
| <classpath location="${adapter.dir}"/> | |||
| <classpath location="${resources}" /> | |||
| </componentdef> | |||
| <mkdir dir="${output}" /> | |||
| <javac srcdir="${input}" destdir="${output}"> | |||
| <myjavac/> | |||
| <myjavac /> | |||
| </javac> | |||
| <au:assertLogContains text="adapter called"/> | |||
| <au:assertLogContains text="adapter called" /> | |||
| </target> | |||
| </project> | |||
| @@ -86,31 +86,30 @@ public class Main { | |||
| } | |||
| ]]></echo> | |||
| <property name="dest1" location="${output}/dest1"/> | |||
| <property name="dest2" location="${output}/dest2"/> | |||
| <mkdir dir="${dest1}"/> | |||
| <mkdir dir="${resources}"/> | |||
| <mkdir dir="${dest2}"/> | |||
| <javac srcdir="${src1}" destdir="${dest1}"/> | |||
| <javac srcdir="${src2}" destdir="${dest2}" classpath="${dest1}"/> | |||
| <javac srcdir="${src1}" destdir="${resources}"/> | |||
| <javac srcdir="${src2}" destdir="${dest2}" classpath="${resources}"/> | |||
| <sleep seconds="3" /> | |||
| <touch file="${src1}/a/B.java" /> | |||
| <javac srcdir="${src1}" destdir="${dest1}"/> | |||
| <javac srcdir="${src1}" destdir="${resources}"/> | |||
| <au:assertFileExists file="${dest2}/b/Main.class"/> | |||
| </target> | |||
| <target name="testClasspathJar" depends="classpathTestSetUp"> | |||
| <jar destfile="${output}/dest1.jar" basedir="${dest1}"/> | |||
| <delete dir="${dest1}"/> | |||
| <path id="dest1-id"> | |||
| <pathelement location="${output}/dest1.jar"/> | |||
| <jar destfile="${test.jar}" basedir="${resources}"/> | |||
| <delete dir="${resources}"/> | |||
| <path id="resources-id"> | |||
| <pathelement location="${test.jar}"/> | |||
| </path> | |||
| <depend srcDir="${src2}" | |||
| destDir="${dest2}" cache="${output}" | |||
| classpathref="dest1-id" | |||
| classpathref="resources-id" | |||
| /> | |||
| <au:assertFileDoesntExist file="${dest2}/b/Main.class"/> | |||
| @@ -118,13 +117,13 @@ public class Main { | |||
| <target name="testClasspathDir" depends="classpathTestSetUp"> | |||
| <path id="dest1-id"> | |||
| <pathelement location="${dest1}"/> | |||
| <path id="resources-id"> | |||
| <pathelement location="${resources}"/> | |||
| </path> | |||
| <depend srcDir="${src2}" | |||
| destDir="${dest2}" cache="${output}" | |||
| classpathref="dest1-id" | |||
| classpathref="resources-id" | |||
| /> | |||
| <au:assertFileDoesntExist file="${dest2}/b/Main.class"/> | |||
| @@ -19,9 +19,9 @@ | |||
| <import file="../../antunit-base.xml" /> | |||
| <target name="-create-javah-adapter"> | |||
| <property name="adapter.dir" location="${output}/adapter"/> | |||
| <mkdir dir="${input}/org/example"/> | |||
| <echo file="${input}/org/example/Adapter.java"><![CDATA[ | |||
| <mkdir dir="${input}/org/example" /> | |||
| <echo file="${input}/org/example/Adapter.java"> | |||
| <![CDATA[ | |||
| package org.example; | |||
| import org.apache.tools.ant.taskdefs.optional.javah.JavahAdapter; | |||
| import org.apache.tools.ant.taskdefs.optional.Javah; | |||
| @@ -31,36 +31,35 @@ public class Adapter implements JavahAdapter { | |||
| System.err.println("adapter called"); | |||
| return true; | |||
| } | |||
| }]]></echo> | |||
| <mkdir dir="${adapter.dir}"/> | |||
| <javac srcdir="${input}" destdir="${adapter.dir}"/> | |||
| }]]> | |||
| </echo> | |||
| <mkdir dir="${resources}" /> | |||
| <javac srcdir="${input}" destdir="${resources}" /> | |||
| </target> | |||
| <target name="testAdapterNotFound" depends="-create-javah-adapter"> | |||
| <au:expectfailure> | |||
| <javah class="org.example.Adapter" destdir="${output}" | |||
| implementation="org.example.Adapter"/> | |||
| <javah class="org.example.Adapter" destdir="${output}" implementation="org.example.Adapter" /> | |||
| </au:expectfailure> | |||
| <au:assertLogDoesntContain text="adapter called"/> | |||
| <au:assertLogDoesntContain text="adapter called" /> | |||
| </target> | |||
| <target name="testImplementationClasspath" depends="-create-javah-adapter" | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=11143"> | |||
| <javah class="org.example.Adapter" destdir="${output}" | |||
| implementation="org.example.Adapter"> | |||
| <implementationclasspath location="${adapter.dir}"/> | |||
| <target name="testImplementationClasspath" depends="-create-javah-adapter" description="https://issues.apache.org/bugzilla/show_bug.cgi?id=11143"> | |||
| <mkdir dir="${output}" /> | |||
| <javah class="org.example.Adapter" destdir="${output}" implementation="org.example.Adapter"> | |||
| <implementationclasspath location="${resources}" /> | |||
| </javah> | |||
| <au:assertLogContains text="adapter called"/> | |||
| <au:assertLogContains text="adapter called" /> | |||
| </target> | |||
| <target name="testImplementationAsNestedElement" | |||
| depends="-create-javah-adapter"> | |||
| <target name="testImplementationAsNestedElement" depends="-create-javah-adapter"> | |||
| <componentdef classname="org.example.Adapter" name="myjavac"> | |||
| <classpath location="${adapter.dir}"/> | |||
| <classpath location="${resources}" /> | |||
| </componentdef> | |||
| <mkdir dir="${output}" /> | |||
| <javah class="org.example.Adapter" destdir="${output}"> | |||
| <myjavac/> | |||
| <myjavac /> | |||
| </javah> | |||
| <au:assertLogContains text="adapter called"/> | |||
| <au:assertLogContains text="adapter called" /> | |||
| </target> | |||
| </project> | |||
| @@ -18,7 +18,6 @@ | |||
| <project default="all" xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <property name="ant-build" location="../../../../../../build"/> | |||
| <property name="build-junit-dir" location="${ant-build}/ant-unit/junit-dir"/> | |||
| <property name="classes.dir" location="${build-junit-dir}/classes"/> | |||
| <property name="reports.dir" location="${build-junit-dir}/report"/> | |||
| <macrodef name="assert-file-not-contains" backtrace="no"> | |||
| @@ -61,7 +60,7 @@ | |||
| <junit fork="@{fork}" haltonfailure="no" showoutput="@{showoutput}" | |||
| outputtoformatters="@{outputtoformatters}"> | |||
| <test name="ExampleTest" todir="${reports.dir}"/> | |||
| <classpath path="${classes.dir}"/> | |||
| <classpath path="${resources}"/> | |||
| <formatter type="plain" usefile="yes"/> | |||
| </junit> | |||
| </sequential> | |||
| @@ -69,12 +68,12 @@ | |||
| <target name="init"> | |||
| <delete quiet="yes" dir="${build-junit-dir}"/> | |||
| <mkdir dir="${classes.dir}"/> | |||
| <mkdir dir="${resources}"/> | |||
| <mkdir dir="${reports.dir}"/> | |||
| </target> | |||
| <target name="compile" depends="init"> | |||
| <javac srcdir="src" destdir="${classes.dir}" debug="yes"/> | |||
| <javac srcdir="src" destdir="${resources}" debug="yes"/> | |||
| </target> | |||
| <target name="test-show-yes-formatters-yes" depends="compile"> | |||
| @@ -19,34 +19,37 @@ | |||
| <import file="../../../antunit-base.xml" /> | |||
| <path id="junit"> | |||
| <fileset dir="../../../../../../lib/optional" includes="junit*"/> | |||
| <fileset dir="../../../../../../lib/optional" includes="junit*" /> | |||
| </path> | |||
| <macrodef name="empty-test"> | |||
| <attribute name="classname"/> | |||
| <attribute name="package" default="test"/> | |||
| <attribute name="classname" /> | |||
| <attribute name="package" default="test" /> | |||
| <sequential> | |||
| <echo file="${input}/@{classname}.java"><![CDATA[ | |||
| <echo file="${input}/@{classname}.java"> | |||
| <![CDATA[ | |||
| package @{package}; | |||
| import junit.framework.TestCase; | |||
| public class @{classname} extends TestCase { | |||
| public void testEmpty() {} | |||
| } | |||
| ]]> </echo> | |||
| ]]> | |||
| </echo> | |||
| </sequential> | |||
| </macrodef> | |||
| <target name="setUp"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| </target> | |||
| <target name="testTimeoutLogOfBatchTests"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <empty-test classname="ATest" package="org.apache.ant.test"/> | |||
| <echo file="${input}/BTest.java"><![CDATA[ | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <empty-test classname="ATest" package="org.apache.ant.test" /> | |||
| <echo file="${input}/BTest.java"> | |||
| <![CDATA[ | |||
| package org.apache.ant.test; | |||
| import junit.framework.TestCase; | |||
| @@ -55,32 +58,34 @@ public class BTest extends TestCase { | |||
| Thread.sleep(20 * 1000); | |||
| } | |||
| } | |||
| ]]> </echo> | |||
| <empty-test classname="CTest" package="org.apache.ant.test"/> | |||
| <empty-test classname="DTest" package="org.apache.ant.test"/> | |||
| ]]> | |||
| </echo> | |||
| <empty-test classname="CTest" package="org.apache.ant.test" /> | |||
| <empty-test classname="DTest" package="org.apache.ant.test" /> | |||
| <javac srcdir="${input}" destdir="${output}"> | |||
| <classpath refid="junit"/> | |||
| <classpath refid="junit" /> | |||
| </javac> | |||
| <junit fork="true" forkMode="perBatch" timeout="5000" printsummary="yes"> | |||
| <classpath refid="junit"/> | |||
| <classpath location="${output}"/> | |||
| <classpath refid="junit" /> | |||
| <classpath location="${output}" /> | |||
| <batchtest> | |||
| <fileset dir="${output}"> | |||
| <include name="**/*Test.class" /> | |||
| </fileset> | |||
| </batchtest> | |||
| </junit> | |||
| <au:assertLogContains text="ATest"/> | |||
| <au:assertLogContains text="BTest"/> | |||
| <au:assertLogContains text="org.apache.ant.test.Batch-With-Multiple-Tests"/> | |||
| <au:assertLogDoesntContain text="CTest"/> | |||
| <au:assertLogDoesntContain text="DTest"/> | |||
| <au:assertLogContains text="ATest" /> | |||
| <au:assertLogContains text="BTest" /> | |||
| <au:assertLogContains text="org.apache.ant.test.Batch-With-Multiple-Tests" /> | |||
| <au:assertLogDoesntContain text="CTest" /> | |||
| <au:assertLogDoesntContain text="DTest" /> | |||
| </target> | |||
| <target name="testFailurePropertyOnTestCase"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <echo file="${input}/ATest.java"><![CDATA[ | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <echo file="${input}/ATest.java"> | |||
| <![CDATA[ | |||
| package test; | |||
| import junit.framework.TestCase; | |||
| @@ -89,26 +94,28 @@ public class ATest extends TestCase { | |||
| assertTrue(false); | |||
| } | |||
| } | |||
| ]]> </echo> | |||
| ]]> | |||
| </echo> | |||
| <javac srcdir="${input}" destdir="${output}"> | |||
| <classpath refid="junit"/> | |||
| <classpath refid="junit" /> | |||
| </javac> | |||
| <junit failureProperty="testcase.failed" haltonfailure="false"> | |||
| <classpath refid="junit"/> | |||
| <classpath location="${output}"/> | |||
| <classpath refid="junit" /> | |||
| <classpath location="${output}" /> | |||
| <batchtest> | |||
| <fileset dir="${output}"> | |||
| <include name="**/*Test.class" /> | |||
| </fileset> | |||
| </batchtest> | |||
| </junit> | |||
| <au:assertPropertySet name="testcase.failed"/> | |||
| <au:assertPropertySet name="testcase.failed" /> | |||
| </target> | |||
| <target name="testFailurePropertyOnTestSuite"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <echo file="${input}/ATest.java"><![CDATA[ | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <echo file="${input}/ATest.java"> | |||
| <![CDATA[ | |||
| package test; | |||
| import junit.framework.Assert; | |||
| import junit.framework.TestSuite; | |||
| @@ -121,48 +128,49 @@ public class ATest extends TestSuite { | |||
| Assert.assertTrue(false); | |||
| } | |||
| } | |||
| ]]> </echo> | |||
| ]]> | |||
| </echo> | |||
| <javac srcdir="${input}" destdir="${output}"> | |||
| <classpath refid="junit"/> | |||
| <classpath refid="junit" /> | |||
| </javac> | |||
| <junit failureProperty="testsuite.failed" haltonfailure="false"> | |||
| <classpath refid="junit"/> | |||
| <classpath location="${output}"/> | |||
| <classpath refid="junit" /> | |||
| <classpath location="${output}" /> | |||
| <batchtest> | |||
| <fileset dir="${output}"> | |||
| <include name="**/*Test.class" /> | |||
| </fileset> | |||
| </batchtest> | |||
| </junit> | |||
| <au:assertPropertySet name="testsuite.failed"/> | |||
| <au:assertPropertySet name="testsuite.failed" /> | |||
| </target> | |||
| <target name="testTimeoutAndFormattersForkPerTest"> | |||
| <antcall target="runTimeoutAndFormattersTest"> | |||
| <param name="forkMode" value="perTest"/> | |||
| <param name="forkMode" value="perTest" /> | |||
| </antcall> | |||
| <au:assertFileExists file="${output}/TEST-test.CTest.txt"/> | |||
| <au:assertFileExists file="${output}/TEST-test.CTest.xml"/> | |||
| <au:assertFileExists file="${output}/TEST-test.DTest.txt"/> | |||
| <au:assertFileExists file="${output}/TEST-test.DTest.xml"/> | |||
| <au:assertFileExists file="${output}/TEST-test.CTest.txt" /> | |||
| <au:assertFileExists file="${output}/TEST-test.CTest.xml" /> | |||
| <au:assertFileExists file="${output}/TEST-test.DTest.txt" /> | |||
| <au:assertFileExists file="${output}/TEST-test.DTest.xml" /> | |||
| </target> | |||
| <target name="testTimeoutAndFormattersForkOnce"> | |||
| <antcall target="runTimeoutAndFormattersTest"> | |||
| <param name="forkMode" value="once"/> | |||
| <param name="forkMode" value="once" /> | |||
| </antcall> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.CTest.txt"/> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.CTest.xml"/> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.DTest.txt"/> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.DTest.xml"/> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.CTest.txt" /> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.CTest.xml" /> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.DTest.txt" /> | |||
| <au:assertFileDoesntExist file="${output}/TEST-test.DTest.xml" /> | |||
| </target> | |||
| <target name="runTimeoutAndFormattersTest" | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=35634"> | |||
| <mkdir dir="${input}"/> | |||
| <mkdir dir="${output}"/> | |||
| <empty-test classname="ATest"/> | |||
| <echo file="${input}/BTest.java"><![CDATA[ | |||
| <target name="runTimeoutAndFormattersTest" description="https://issues.apache.org/bugzilla/show_bug.cgi?id=35634"> | |||
| <mkdir dir="${input}" /> | |||
| <mkdir dir="${output}" /> | |||
| <empty-test classname="ATest" /> | |||
| <echo file="${input}/BTest.java"> | |||
| <![CDATA[ | |||
| package test; | |||
| import junit.framework.TestCase; | |||
| @@ -171,50 +179,51 @@ public class BTest extends TestCase { | |||
| Thread.sleep(20 * 1000); | |||
| } | |||
| } | |||
| ]]></echo> | |||
| <empty-test classname="CTest"/> | |||
| <empty-test classname="DTest"/> | |||
| ]]> | |||
| </echo> | |||
| <empty-test classname="CTest" /> | |||
| <empty-test classname="DTest" /> | |||
| <javac srcdir="${input}" destdir="${output}"> | |||
| <classpath refid="junit"/> | |||
| <classpath refid="junit" /> | |||
| </javac> | |||
| <junit fork="true" timeout="5000" forkmode="${forkMode}"> | |||
| <classpath refid="junit"/> | |||
| <classpath location="${output}"/> | |||
| <classpath refid="junit" /> | |||
| <classpath location="${output}" /> | |||
| <batchtest todir="${output}"> | |||
| <fileset dir="${output}"> | |||
| <include name="**/*Test.class" /> | |||
| </fileset> | |||
| </batchtest> | |||
| <formatter type="brief"/> | |||
| <formatter type="xml"/> | |||
| <formatter type="brief" /> | |||
| <formatter type="xml" /> | |||
| </junit> | |||
| <au:assertFileExists file="${output}/TEST-test.ATest.txt"/> | |||
| <au:assertFileExists file="${output}/TEST-test.ATest.xml"/> | |||
| <au:assertFileExists file="${output}/TEST-test.BTest.txt"/> | |||
| <au:assertFileExists file="${output}/TEST-test.BTest.xml"/> | |||
| <au:assertFileExists file="${output}/TEST-test.ATest.txt" /> | |||
| <au:assertFileExists file="${output}/TEST-test.ATest.xml" /> | |||
| <au:assertFileExists file="${output}/TEST-test.BTest.txt" /> | |||
| <au:assertFileExists file="${output}/TEST-test.BTest.xml" /> | |||
| </target> | |||
| <target name="-ifUnlessSetup" depends="setUp"> | |||
| <empty-test classname="ATest"/> | |||
| <empty-test classname="BTest"/> | |||
| <empty-test classname="CTest"/> | |||
| <empty-test classname="DTest"/> | |||
| <empty-test classname="ETest"/> | |||
| <empty-test classname="FTest"/> | |||
| <empty-test classname="GTest"/> | |||
| <empty-test classname="HTest"/> | |||
| <empty-test classname="ATest" /> | |||
| <empty-test classname="BTest" /> | |||
| <empty-test classname="CTest" /> | |||
| <empty-test classname="DTest" /> | |||
| <empty-test classname="ETest" /> | |||
| <empty-test classname="FTest" /> | |||
| <empty-test classname="GTest" /> | |||
| <empty-test classname="HTest" /> | |||
| <javac srcdir="${input}" destdir="${output}"> | |||
| <classpath refid="junit"/> | |||
| <classpath refid="junit" /> | |||
| </javac> | |||
| <macrodef name="j"> | |||
| <sequential> | |||
| <junit fork="true" forkMode="perBatch" printsummary="yes"> | |||
| <classpath refid="junit"/> | |||
| <classpath location="${output}"/> | |||
| <test name="test.ATest" if="${if}"/> | |||
| <test name="test.BTest" if="if"/> | |||
| <test name="test.CTest" unless="${if}"/> | |||
| <test name="test.DTest" unless="if"/> | |||
| <classpath refid="junit" /> | |||
| <classpath location="${output}" /> | |||
| <test name="test.ATest" if="${if}" /> | |||
| <test name="test.BTest" if="if" /> | |||
| <test name="test.CTest" unless="${if}" /> | |||
| <test name="test.DTest" unless="if" /> | |||
| <batchtest if="${if}"> | |||
| <fileset dir="${output}"> | |||
| <include name="**/ETest.class" /> | |||
| @@ -241,72 +250,72 @@ public class BTest extends TestCase { | |||
| </target> | |||
| <target name="testPropertiesNotSet" depends="-ifUnlessSetup"> | |||
| <j/> | |||
| <au:assertLogDoesntContain text="Running test.ATest"/> | |||
| <au:assertLogDoesntContain text="Running test.BTest"/> | |||
| <au:assertLogContains text="Running test.CTest"/> | |||
| <au:assertLogContains text="Running test.DTest"/> | |||
| <au:assertLogDoesntContain text="Running test.ETest"/> | |||
| <au:assertLogDoesntContain text="Running test.FTest"/> | |||
| <au:assertLogContains text="Running test.GTest"/> | |||
| <au:assertLogContains text="Running test.HTest"/> | |||
| <j /> | |||
| <au:assertLogDoesntContain text="Running test.ATest" /> | |||
| <au:assertLogDoesntContain text="Running test.BTest" /> | |||
| <au:assertLogContains text="Running test.CTest" /> | |||
| <au:assertLogContains text="Running test.DTest" /> | |||
| <au:assertLogDoesntContain text="Running test.ETest" /> | |||
| <au:assertLogDoesntContain text="Running test.FTest" /> | |||
| <au:assertLogContains text="Running test.GTest" /> | |||
| <au:assertLogContains text="Running test.HTest" /> | |||
| </target> | |||
| <target name="testPropertiesSet" depends="-ifUnlessSetup"> | |||
| <property name="if" value="whatever"/> | |||
| <j/> | |||
| <au:assertLogDoesntContain text="Running test.ATest"/> | |||
| <au:assertLogContains text="Running test.BTest"/> | |||
| <au:assertLogContains text="Running test.CTest"/> | |||
| <au:assertLogDoesntContain text="Running test.DTest"/> | |||
| <au:assertLogDoesntContain text="Running test.ETest"/> | |||
| <au:assertLogContains text="Running test.FTest"/> | |||
| <au:assertLogContains text="Running test.GTest"/> | |||
| <au:assertLogDoesntContain text="Running test.HTest"/> | |||
| <property name="if" value="whatever" /> | |||
| <j /> | |||
| <au:assertLogDoesntContain text="Running test.ATest" /> | |||
| <au:assertLogContains text="Running test.BTest" /> | |||
| <au:assertLogContains text="Running test.CTest" /> | |||
| <au:assertLogDoesntContain text="Running test.DTest" /> | |||
| <au:assertLogDoesntContain text="Running test.ETest" /> | |||
| <au:assertLogContains text="Running test.FTest" /> | |||
| <au:assertLogContains text="Running test.GTest" /> | |||
| <au:assertLogDoesntContain text="Running test.HTest" /> | |||
| </target> | |||
| <target name="testPropertiesTrue" depends="-ifUnlessSetup"> | |||
| <property name="if" value="true"/> | |||
| <j/> | |||
| <au:assertLogContains text="Running test.ATest"/> | |||
| <au:assertLogContains text="Running test.BTest"/> | |||
| <au:assertLogDoesntContain text="Running test.CTest"/> | |||
| <au:assertLogDoesntContain text="Running test.DTest"/> | |||
| <au:assertLogContains text="Running test.ETest"/> | |||
| <au:assertLogContains text="Running test.FTest"/> | |||
| <au:assertLogDoesntContain text="Running test.GTest"/> | |||
| <au:assertLogDoesntContain text="Running test.HTest"/> | |||
| <property name="if" value="true" /> | |||
| <j /> | |||
| <au:assertLogContains text="Running test.ATest" /> | |||
| <au:assertLogContains text="Running test.BTest" /> | |||
| <au:assertLogDoesntContain text="Running test.CTest" /> | |||
| <au:assertLogDoesntContain text="Running test.DTest" /> | |||
| <au:assertLogContains text="Running test.ETest" /> | |||
| <au:assertLogContains text="Running test.FTest" /> | |||
| <au:assertLogDoesntContain text="Running test.GTest" /> | |||
| <au:assertLogDoesntContain text="Running test.HTest" /> | |||
| </target> | |||
| <target name="testPropertiesFalse" depends="-ifUnlessSetup"> | |||
| <property name="if" value="false"/> | |||
| <j/> | |||
| <au:assertLogDoesntContain text="Running test.ATest"/> | |||
| <au:assertLogContains text="Running test.BTest"/> | |||
| <au:assertLogContains text="Running test.CTest"/> | |||
| <au:assertLogDoesntContain text="Running test.DTest"/> | |||
| <au:assertLogDoesntContain text="Running test.ETest"/> | |||
| <au:assertLogContains text="Running test.FTest"/> | |||
| <au:assertLogContains text="Running test.GTest"/> | |||
| <au:assertLogDoesntContain text="Running test.HTest"/> | |||
| <property name="if" value="false" /> | |||
| <j /> | |||
| <au:assertLogDoesntContain text="Running test.ATest" /> | |||
| <au:assertLogContains text="Running test.BTest" /> | |||
| <au:assertLogContains text="Running test.CTest" /> | |||
| <au:assertLogDoesntContain text="Running test.DTest" /> | |||
| <au:assertLogDoesntContain text="Running test.ETest" /> | |||
| <au:assertLogContains text="Running test.FTest" /> | |||
| <au:assertLogContains text="Running test.GTest" /> | |||
| <au:assertLogDoesntContain text="Running test.HTest" /> | |||
| </target> | |||
| <target name="testMissingTestName"> | |||
| <property name="test.name" value="null"/> | |||
| <property name="test.name" value="null" /> | |||
| <au:expectfailure message="test name must be specified"> | |||
| <junit fork="false"> | |||
| <test name="${test.name}"/> | |||
| <test name="${test.name}" /> | |||
| </junit> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testTestMethods" if="jdk1.5+"> | |||
| <echo file="${input}/T1.java">public class T1 extends | |||
| <target name="testTestMethods" if="jdk1.5+"> | |||
| <echo file="${input}/T1.java">public class T1 extends | |||
| junit.framework.TestCase { | |||
| public void testOK() {} | |||
| public void testBad() {throw new RuntimeException("failed");} | |||
| }</echo> | |||
| <echo file="${input}/T2.java"> | |||
| <echo file="${input}/T2.java"> | |||
| import org.junit.Test; | |||
| public class T2 { | |||
| @Test | |||
| @@ -315,19 +324,18 @@ public class BTest extends TestCase { | |||
| public void bad() { | |||
| throw new RuntimeException("failed");} | |||
| }</echo> | |||
| <javac srcdir="${input}" destdir="${output}" includes="T1.java,T2.java" source="5" | |||
| includeantruntime="false" > | |||
| <classpath> | |||
| <path refid="junit"/> | |||
| </classpath> | |||
| </javac> | |||
| <junit fork="true" printsummary="true" haltonerror="true"> | |||
| <classpath> | |||
| <pathelement location="${output}"/> | |||
| <path refid="junit"/> | |||
| </classpath> | |||
| <test name="T1" methods="testOK" /> | |||
| <test name="T2" methods="ok" /> | |||
| </junit> | |||
| </target> | |||
| <javac srcdir="${input}" destdir="${output}" includes="T1.java,T2.java" source="5" includeantruntime="false"> | |||
| <classpath> | |||
| <path refid="junit" /> | |||
| </classpath> | |||
| </javac> | |||
| <junit fork="true" printsummary="true" haltonerror="true"> | |||
| <classpath> | |||
| <pathelement location="${output}" /> | |||
| <path refid="junit" /> | |||
| </classpath> | |||
| <test name="T1" methods="testOK" /> | |||
| <test name="T2" methods="ok" /> | |||
| </junit> | |||
| </target> | |||
| </project> | |||
| @@ -19,7 +19,6 @@ | |||
| <import file="../../antunit-base.xml" /> | |||
| <target name="-create-native2ascii-adapter"> | |||
| <property name="adapter.dir" location="${output}/adapter"/> | |||
| <mkdir dir="${input}/org/example"/> | |||
| <echo file="${input}/org/example/Adapter.java"><![CDATA[ | |||
| package org.example; | |||
| @@ -33,8 +32,8 @@ public class Adapter implements Native2AsciiAdapter { | |||
| return true; | |||
| } | |||
| }]]></echo> | |||
| <mkdir dir="${adapter.dir}"/> | |||
| <javac srcdir="${input}" destdir="${adapter.dir}"/> | |||
| <mkdir dir="${resources}"/> | |||
| <javac srcdir="${input}" destdir="${resources}"/> | |||
| </target> | |||
| <target name="testAdapterNotFound" depends="-create-native2ascii-adapter"> | |||
| @@ -49,7 +48,7 @@ public class Adapter implements Native2AsciiAdapter { | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=11143"> | |||
| <native2ascii src="${input}" dest="${output}" includes="**/*.java" | |||
| implementation="org.example.Adapter"> | |||
| <implementationclasspath location="${adapter.dir}"/> | |||
| <implementationclasspath location="${resources}"/> | |||
| </native2ascii> | |||
| <au:assertLogContains text="adapter called"/> | |||
| </target> | |||
| @@ -57,7 +56,7 @@ public class Adapter implements Native2AsciiAdapter { | |||
| <target name="testImplementationAsNestedElement" | |||
| depends="-create-native2ascii-adapter"> | |||
| <componentdef classname="org.example.Adapter" name="myjavac"> | |||
| <classpath location="${adapter.dir}"/> | |||
| <classpath location="${resources}"/> | |||
| </componentdef> | |||
| <native2ascii src="${input}" dest="${output}" includes="**/*.java"> | |||
| <myjavac/> | |||
| @@ -17,21 +17,21 @@ | |||
| --> | |||
| <project default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <import file="../../../antunit-base.xml"/> | |||
| <import file="../../../antunit-base.xml" /> | |||
| <description> | |||
| In which we test interesting aspects of scripting. | |||
| The targeted language is javascript; this lets us run without | |||
| additions on Java6+. | |||
| </description> | |||
| <condition property="prereqs-ok"> | |||
| <or> | |||
| <and> | |||
| <available classname="org.apache.bsf.BSFManager"/> | |||
| <available classname="org.apache.bsf.engines.javascript.JavaScriptEngine"/> | |||
| <available classname="org.apache.bsf.BSFManager" /> | |||
| <available classname="org.apache.bsf.engines.javascript.JavaScriptEngine" /> | |||
| </and> | |||
| <available classname="javax.script.ScriptEngineManager"/> | |||
| <available classname="javax.script.ScriptEngineManager" /> | |||
| </or> | |||
| </condition> | |||
| @@ -43,15 +43,13 @@ | |||
| </string> | |||
| <presetdef name="js"> | |||
| <scriptdef language="javascript" name="scripttest" | |||
| manager="${script.manager}"> | |||
| <scriptdef language="javascript" name="scripttest" manager="${script.manager}"> | |||
| <!-- optional property attribute--> | |||
| <attribute name="property" /> | |||
| </scriptdef> | |||
| </presetdef> | |||
| <property name="prop" | |||
| value='self.log("Ant version =${ant.version}");project.setNewProperty("property","live");' /> | |||
| <property name="prop" value='self.log("Ant version =${ant.version}");project.setNewProperty("property","live");' /> | |||
| <presetdef name="assertPropSet"> | |||
| <au:assertPropertyEquals name="property" value="live" /> | |||
| @@ -61,21 +59,21 @@ | |||
| <!--purely to test that everything works --> | |||
| <target name="testInline" if="prereqs-ok"> | |||
| <js>self.log("Hello");</js> | |||
| <scripttest/> | |||
| <scripttest /> | |||
| </target> | |||
| <target name="testStringResource" if="prereqs-ok"> | |||
| <js> | |||
| <string value='self.log("Ant version =${ant.version}");' /> | |||
| </js> | |||
| <scripttest/> | |||
| <scripttest /> | |||
| </target> | |||
| <target name="testStringResourceRef" if="prereqs-ok"> | |||
| <js> | |||
| <string refid="script.code" /> | |||
| </js> | |||
| <scripttest/> | |||
| <scripttest /> | |||
| <assertPropSet /> | |||
| </target> | |||
| @@ -86,40 +84,38 @@ | |||
| project.setNewProperty("property","live"); | |||
| </string> | |||
| </js> | |||
| <scripttest/> | |||
| <assertPropSet/> | |||
| <scripttest /> | |||
| <assertPropSet /> | |||
| </target> | |||
| <target name="testPropertyResource" if="prereqs-ok"> | |||
| <js> | |||
| <propertyresource name="prop" /> | |||
| </js> | |||
| <scripttest/> | |||
| <assertPropSet/> | |||
| <scripttest /> | |||
| <assertPropSet /> | |||
| </target> | |||
| <target name="testMixedResources" if="prereqs-ok"> | |||
| <js> | |||
| <string refid="script.code" /> | |||
| <propertyresource name="prop" /> | |||
| <string > | |||
| <string> | |||
| project.setNewProperty("property2","live"); | |||
| </string> | |||
| </js> | |||
| <scripttest/> | |||
| <scripttest /> | |||
| <assertPropSet name="property2" /> | |||
| </target> | |||
| <target name="testExceptionNesting" | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=47509" | |||
| if="prereqs-ok"> | |||
| <target name="testExceptionNesting" description="https://issues.apache.org/bugzilla/show_bug.cgi?id=47509" if="prereqs-ok"> | |||
| <scriptdef name="quickfail" language="javascript"> | |||
| <![CDATA[ | |||
| self.fail("I failed!"); | |||
| ]]> | |||
| </scriptdef> | |||
| <au:expectfailure message="I failed!"> | |||
| <quickfail/> | |||
| <quickfail /> | |||
| </au:expectfailure> | |||
| </target> | |||
| </project> | |||
| @@ -19,7 +19,6 @@ | |||
| <import file="../antunit-base.xml" /> | |||
| <target name="-create-rmic-adapter"> | |||
| <property name="adapter.dir" location="${output}/adapter"/> | |||
| <mkdir dir="${input}/org/example"/> | |||
| <echo file="${input}/org/example/Adapter.java"><![CDATA[ | |||
| package org.example; | |||
| @@ -46,13 +45,13 @@ public class Adapter implements RmicAdapter { | |||
| return new Path(null); | |||
| } | |||
| }]]></echo> | |||
| <mkdir dir="${adapter.dir}"/> | |||
| <javac srcdir="${input}" destdir="${adapter.dir}"/> | |||
| <mkdir dir="${resources}"/> | |||
| <javac srcdir="${input}" destdir="${resources}"/> | |||
| </target> | |||
| <target name="testCompilerNotFound" depends="-create-rmic-adapter"> | |||
| <au:expectfailure> | |||
| <rmic base="${adapter.dir}" includes="**/*.class" | |||
| <rmic base="${resources}" includes="**/*.class" | |||
| compiler="org.example.Adapter"/> | |||
| </au:expectfailure> | |||
| <au:assertLogDoesntContain text="adapter called"/> | |||
| @@ -60,18 +59,18 @@ public class Adapter implements RmicAdapter { | |||
| <target name="testCompilerClasspath" depends="-create-rmic-adapter" | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=11143"> | |||
| <rmic base="${adapter.dir}" includes="**/*.class" | |||
| <rmic base="${resources}" includes="**/*.class" | |||
| compiler="org.example.Adapter"> | |||
| <compilerclasspath location="${adapter.dir}"/> | |||
| <compilerclasspath location="${resources}"/> | |||
| </rmic> | |||
| <au:assertLogContains text="adapter called"/> | |||
| </target> | |||
| <target name="testCompilerAsNestedElement" depends="-create-rmic-adapter"> | |||
| <componentdef classname="org.example.Adapter" name="myjavac"> | |||
| <classpath location="${adapter.dir}"/> | |||
| <classpath location="${resources}"/> | |||
| </componentdef> | |||
| <rmic base="${adapter.dir}" includes="**/*.class"> | |||
| <rmic base="${resources}" includes="**/*.class"> | |||
| <myjavac/> | |||
| </rmic> | |||
| <au:assertLogContains text="adapter called"/> | |||
| @@ -16,17 +16,17 @@ | |||
| limitations under the License. | |||
| --> | |||
| <project name="test-input" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <import file="../antunit-base.xml"/> | |||
| <target name="setUp"> | |||
| </target> | |||
| <target name="test-secure-input" if="jdk1.6+"> | |||
| <input message="secure-input:>" addproperty="the.password"> | |||
| <handler classname="org.apache.tools.ant.input.SecureInputHandler"/> | |||
| </input> | |||
| <au:assertPropertySet name="the.password"/> | |||
| </target> | |||
| <import file="../antunit-base.xml" /> | |||
| <target name="setUp"> | |||
| </target> | |||
| <target name="test-secure-input" if="jdk1.6+"> | |||
| <input message="secure-input:>" addproperty="the.password"> | |||
| <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> | |||
| </input> | |||
| <au:assertPropertySet name="the.password" /> | |||
| </target> | |||
| </project> | |||
| @@ -19,68 +19,65 @@ | |||
| <import file="../antunit-base.xml" /> | |||
| <property name="classes.dir" value="../../../../build/classes"/> | |||
| <property name="classes.dir" value="../../../../build/classes" /> | |||
| <property name="sign.dir" location="${output}" /> | |||
| <property name="subdir" location="${sign.dir}/subdir" /> | |||
| <property name="test.jar" location="${sign.dir}/signtest.jar" /> | |||
| <property name="subdirtest.jar" location="${subdir}/signtest.jar" /> | |||
| <property name="testkeystore" location="../../../etc/testcases/testkeystore"/> | |||
| <property name="signtest.jar" location="${sign.dir}/signtest.jar" /> | |||
| <property name="subdirsigntest.jar" location="${subdir}/signtest.jar" /> | |||
| <property name="testkeystore" location="../../../etc/testcases/testkeystore" /> | |||
| <macrodef name="assertSigned"> | |||
| <attribute name="jar" default="${test.jar}" /> | |||
| <attribute name="jar" default="${signtest.jar}" /> | |||
| <sequential> | |||
| <au:assertTrue message="not signed: @{jar}"> | |||
| <issigned file="@{jar}"/> | |||
| <issigned file="@{jar}" /> | |||
| </au:assertTrue> | |||
| </sequential> | |||
| </macrodef> | |||
| <presetdef name="sign-base"> | |||
| <signjar alias="testonly" keystore="${testkeystore}" | |||
| storepass="apacheant"/> | |||
| <signjar alias="testonly" keystore="${testkeystore}" storepass="apacheant" /> | |||
| </presetdef> | |||
| <presetdef name="verify-base"> | |||
| <verifyjar keystore="${testkeystore}" | |||
| storepass="apacheant"/> | |||
| <verifyjar keystore="${testkeystore}" storepass="apacheant" /> | |||
| </presetdef> | |||
| <presetdef name="sign"> | |||
| <sign-base jar="${test.jar}" /> | |||
| <sign-base jar="${signtest.jar}" /> | |||
| </presetdef> | |||
| <target name="setUp"> | |||
| <mkdir dir="${sign.dir}" /> | |||
| <mkdir dir="${subdir}" /> | |||
| </target> | |||
| <target name="jar" depends="setUp"> | |||
| <jar jarfile="${test.jar}" basedir="${classes.dir}" includes="**/Task.class"/> | |||
| </target> | |||
| <jar jarfile="${signtest.jar}" basedir="${classes.dir}" includes="**/Task.class" /> | |||
| </target> | |||
| <target name="basic" depends="jar"> | |||
| <sign /> | |||
| </target> | |||
| <target name="testBasic" depends="basic"> | |||
| <assertSigned/> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testMaxmemory" depends="jar"> | |||
| <sign maxmemory="128m"/> | |||
| <assertSigned/> | |||
| <sign maxmemory="128m" /> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testPreserveLastModified" depends="jar"> | |||
| <touch file="${test.jar}" datetime="06/28/2000 2:02 pm"/> | |||
| <sign | |||
| preservelastmodified="true"/> | |||
| <touch file="${signtest.jar}" datetime="06/28/2000 2:02 pm" /> | |||
| <sign preservelastmodified="true" /> | |||
| <assertSigned /> | |||
| <fail message="preserveLastModified did not preserve the last modified time"> | |||
| <condition> | |||
| <not> | |||
| <isfileselected file="${test.jar}" > | |||
| <date datetime="06/28/2000 2:02 pm" when="equal"/> | |||
| <isfileselected file="${signtest.jar}"> | |||
| <date datetime="06/28/2000 2:02 pm" when="equal" /> | |||
| </isfileselected> | |||
| </not> | |||
| </condition> | |||
| @@ -89,117 +86,117 @@ | |||
| <target name="testFileset" depends="jar"> | |||
| <sign-base> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </sign-base> | |||
| <assertSigned/> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testFilesetAndJar" depends="jar"> | |||
| <sign-base jar="${test.jar}" lazy="true"> | |||
| <fileset file="${test.jar}" /> | |||
| <sign-base jar="${signtest.jar}" lazy="true"> | |||
| <fileset file="${signtest.jar}" /> | |||
| </sign-base> | |||
| <assertSigned/> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testFilesetAndSignedJar" depends="jar"> | |||
| <au:expectfailure expectedMessage="You cannot specify the signed JAR when using paths or filesets"> | |||
| <sign-base signedjar="${sign.dir}/newfile.jar"> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </sign-base> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testPath" depends="jar"> | |||
| <sign-base> | |||
| <path> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </path> | |||
| </sign-base> | |||
| <assertSigned/> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testPathAndJar" depends="jar"> | |||
| <sign-base jar="${test.jar}" lazy="true"> | |||
| <sign-base jar="${signtest.jar}" lazy="true"> | |||
| <path> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </path> | |||
| </sign-base> | |||
| <assertSigned/> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testPathAndSignedJar" depends="jar"> | |||
| <au:expectfailure expectedMessage="You cannot specify the signed JAR when using paths or filesets"> | |||
| <sign-base signedjar="${sign.dir}/newfile.jar"> | |||
| <path> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </path> | |||
| </sign-base> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testSignedJar" depends="jar"> | |||
| <sign signedjar="${subdirtest.jar}"/> | |||
| <assertSigned jar="${subdirtest.jar}"/> | |||
| <sign signedjar="${subdirsigntest.jar}" /> | |||
| <assertSigned jar="${subdirsigntest.jar}" /> | |||
| </target> | |||
| <target name="testDestDirAndSignedJar" depends="jar"> | |||
| <au:expectfailure expectedMessage="'destdir' and 'signedjar' cannot both be set"> | |||
| <sign destDir="${subdir}" signedjar="${sign.dir}/newfile.jar"/> | |||
| <sign destDir="${subdir}" signedjar="${sign.dir}/newfile.jar" /> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testDestDir" depends="jar"> | |||
| <sign destDir="${subdir}" /> | |||
| <assertSigned jar="${subdirtest.jar}"/> | |||
| <assertSigned jar="${subdirsigntest.jar}" /> | |||
| </target> | |||
| <target name="testDestDirFileset" depends="jar"> | |||
| <sign-base destDir="${subdir}"> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </sign-base> | |||
| <assertSigned jar="${subdirtest.jar}"/> | |||
| <assertSigned jar="${subdirsigntest.jar}" /> | |||
| </target> | |||
| <target name="testDestDirPath" depends="jar"> | |||
| <sign-base destDir="${subdir}"> | |||
| <path> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </path> | |||
| </sign-base> | |||
| <assertSigned jar="${subdirtest.jar}"/> | |||
| <assertSigned jar="${subdirsigntest.jar}" /> | |||
| </target> | |||
| <target name="testMapperNoDest" depends="jar"> | |||
| <au:expectfailure expectedMessage="The destDir attribute is required if a mapper is set"> | |||
| <sign-base > | |||
| <sign-base> | |||
| <flattenmapper /> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| </sign-base> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testMapperFileset" depends="jar"> | |||
| <sign-base destDir="${subdir}"> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| <flattenmapper /> | |||
| </sign-base> | |||
| <assertSigned jar="${subdirtest.jar}"/> | |||
| <assertSigned jar="${subdirsigntest.jar}" /> | |||
| </target> | |||
| <target name="testMapperPath" depends="jar"> | |||
| <sign-base destDir="${subdir}"> | |||
| <path> | |||
| <pathelement location="${test.jar}" /> | |||
| <pathelement location="${signtest.jar}" /> | |||
| </path> | |||
| <flattenmapper /> | |||
| </sign-base> | |||
| <assertSigned jar="${subdirtest.jar}"/> | |||
| <assertSigned jar="${subdirsigntest.jar}" /> | |||
| </target> | |||
| <target name="testTwoMappers" depends="jar"> | |||
| <au:expectfailure expectedMessage="Too many mappers"> | |||
| <sign-base destDir="${subdir}"> | |||
| <fileset file="${test.jar}" /> | |||
| <fileset file="${signtest.jar}" /> | |||
| <flattenmapper /> | |||
| <flattenmapper /> | |||
| </sign-base> | |||
| @@ -208,13 +205,11 @@ | |||
| <target name="testNoAlias" depends="jar"> | |||
| <au:expectfailure expectedMessage="alias attribute must be set"> | |||
| <signjar keystore="${testkeystore}" | |||
| jar="${test.jar}" | |||
| storepass="apacheant"/> | |||
| <signjar keystore="${testkeystore}" jar="${signtest.jar}" storepass="apacheant" /> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testNoFiles" > | |||
| <target name="testNoFiles"> | |||
| <au:expectfailure expectedMessage="jar must be set through jar attribute"> | |||
| <sign-base /> | |||
| </au:expectfailure> | |||
| @@ -222,9 +217,7 @@ | |||
| <target name="testNoStorePass" depends="jar"> | |||
| <au:expectfailure expectedMessage="storepass attribute must be set"> | |||
| <signjar keystore="${testkeystore}" | |||
| alias="testonly" | |||
| jar="${test.jar}"/> | |||
| <signjar keystore="${testkeystore}" alias="testonly" jar="${signtest.jar}" /> | |||
| </au:expectfailure> | |||
| </target> | |||
| @@ -232,39 +225,39 @@ | |||
| <sign> | |||
| <sysproperty key="ant.home" value="${ant.home}" /> | |||
| </sign> | |||
| <assertSigned/> | |||
| <assertSigned /> | |||
| </target> | |||
| <target name="testVerifyJar" depends="basic"> | |||
| <verify-base jar="${test.jar}"/> | |||
| <verify-base jar="${signtest.jar}" /> | |||
| </target> | |||
| <target name="testVerifyJarCertificates" depends="basic"> | |||
| <verify-base jar="${test.jar}" certificates="true" verbose="true"/> | |||
| <verify-base jar="${signtest.jar}" certificates="true" verbose="true" /> | |||
| </target> | |||
| <target name="testVerifyJarUnsigned" depends="jar"> | |||
| <au:expectfailure expectedMessage="Failed to verify ${test.jar}"> | |||
| <verify-base jar="${test.jar}"/> | |||
| <au:expectfailure expectedMessage="Failed to verify ${signtest.jar}"> | |||
| <verify-base jar="${signtest.jar}" /> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="NOtestVerifyJarNotInKeystore" depends="basic"> | |||
| <au:expectfailure> | |||
| <verifyjar jar="${test.jar}" certificates="true" verbose="true"/> | |||
| <verifyjar jar="${signtest.jar}" certificates="true" verbose="true" /> | |||
| </au:expectfailure> | |||
| </target> | |||
| <target name="testVerifyFileset" depends="basic"> | |||
| <verify-base > | |||
| <fileset file="${test.jar}" /> | |||
| <verify-base> | |||
| <fileset file="${signtest.jar}" /> | |||
| </verify-base> | |||
| </target> | |||
| <target name="testVerifyPath" depends="basic"> | |||
| <verify-base > | |||
| <verify-base> | |||
| <path> | |||
| <pathelement location="${test.jar}" /> | |||
| <pathelement location="${signtest.jar}" /> | |||
| </path> | |||
| </verify-base> | |||
| </target> | |||
| @@ -274,6 +267,6 @@ | |||
| <verify-base /> | |||
| </au:expectfailure> | |||
| </target> | |||
| </project> | |||
| @@ -31,13 +31,11 @@ | |||
| </target> | |||
| <target name="testPlainDir" depends="setUp"> | |||
| <tempfile property="jar" deleteonexit="true" | |||
| destdir="${tmpdir}" prefix="test" suffix=".jar"/> | |||
| <jar destfile="${jar}"> | |||
| <jar destfile="${test1.jar}"> | |||
| <fileset dir="${input}"/> | |||
| </jar> | |||
| <taskdef resource="org/example/antlib.xml" | |||
| classpath="${jar}" | |||
| classpath="${test1.jar}" | |||
| uri="urn:test:plain"/> | |||
| <echooo xmlns="urn:test:plain">Hello</echooo> | |||
| <au:assertLogContains text="Hello"/> | |||
| @@ -47,13 +45,11 @@ | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50007"> | |||
| <property name="dir" location="${tmpdir}/pl!ng"/> | |||
| <mkdir dir="${dir}"/> | |||
| <tempfile property="jar" deleteonexit="true" destdir="${dir}" | |||
| prefix="test" suffix=".jar"/> | |||
| <jar destfile="${jar}"> | |||
| <jar destfile="${test2.jar}"> | |||
| <fileset dir="${input}"/> | |||
| </jar> | |||
| <taskdef resource="org/example/antlib.xml" | |||
| classpath="${jar}" | |||
| classpath="${test2.jar}" | |||
| uri="urn:test:indir"/> | |||
| <echooo xmlns="urn:test:indir">Hello</echooo> | |||
| <au:assertLogContains text="Hello"/> | |||
| @@ -65,43 +61,37 @@ | |||
| description="https://issues.apache.org/bugzilla/show_bug.cgi?id=50007"> | |||
| <property name="dir" location="${tmpdir}/pling!"/> | |||
| <mkdir dir="${dir}"/> | |||
| <tempfile property="jar" deleteonexit="true" destdir="${dir}" | |||
| prefix="test" suffix=".jar"/> | |||
| <jar destfile="${jar}"> | |||
| <jar destfile="${test3.jar}"> | |||
| <fileset dir="${input}"/> | |||
| </jar> | |||
| <taskdef resource="org/example/antlib.xml" | |||
| classpath="${jar}" | |||
| classpath="${test3.jar}" | |||
| uri="urn:test:atend"/> | |||
| <echooo xmlns="urn:test:atend">Hello</echooo> | |||
| <au:assertLogContains text="Hello"/> | |||
| </target> | |||
| <target name="testPlingInJar" depends="setUp"> | |||
| <tempfile property="jar" deleteonexit="true" | |||
| destdir="${tmpdir}" prefix="test" suffix=".jar"/> | |||
| <move file="${input}/org/example/antlib.xml" | |||
| tofile="${input}/org/examp!e/antlib.xml"/> | |||
| <jar destfile="${jar}"> | |||
| <jar destfile="${test4.jar}"> | |||
| <fileset dir="${input}"/> | |||
| </jar> | |||
| <taskdef resource="org/examp!e/antlib.xml" | |||
| classpath="${jar}" | |||
| classpath="${test4.jar}" | |||
| uri="urn:test:injar"/> | |||
| <echooo xmlns="urn:test:injar">Hello</echooo> | |||
| <au:assertLogContains text="Hello"/> | |||
| </target> | |||
| <target name="testPlingInJarAtEnd" depends="setUp"> | |||
| <tempfile property="jar" deleteonexit="true" | |||
| destdir="${tmpdir}" prefix="test" suffix=".jar"/> | |||
| <move file="${input}/org/example/antlib.xml" | |||
| <move file="${input}/org/example/antlib.xml" | |||
| tofile="${input}/org/example!/antlib.xml"/> | |||
| <jar destfile="${jar}"> | |||
| <jar destfile="${test5.jar}"> | |||
| <fileset dir="${input}"/> | |||
| </jar> | |||
| <taskdef resource="org/example!/antlib.xml" | |||
| classpath="${jar}" | |||
| classpath="${test5.jar}" | |||
| uri="urn:test:injaratend"/> | |||
| <echooo xmlns="urn:test:injaratend">Hello</echooo> | |||
| <au:assertLogContains text="Hello"/> | |||
| @@ -15,20 +15,19 @@ | |||
| See the License for the specific language governing permissions and | |||
| limitations under the License. | |||
| --> | |||
| <project name="files-test" default="antunit" | |||
| xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <project name="files-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | |||
| <target name="antunit"> | |||
| <au:antunit> | |||
| <au:plainlistener /> | |||
| <file file="${ant.file}" /> | |||
| <au:plainlistener/> | |||
| <file file="${ant.file}"/> | |||
| </au:antunit> | |||
| </target> | |||
| <target name="setUp"> | |||
| <property name="out" value="out"/> | |||
| </target> | |||
| <target name="tearDown"> | |||
| <delete dir="${out}"/> | |||
| </target> | |||
| @@ -38,7 +37,7 @@ | |||
| <mkdir dir="${out}"/> | |||
| <copy todir="${out}"> | |||
| <!-- threw a java.lang.NullPointerException --> | |||
| <files refid="foo"/> | |||
| <files refid="foo"/> | |||
| </copy> | |||
| </target> | |||
| @@ -47,7 +47,7 @@ | |||
| actual="${output}/org/apache/tools/ant/antlib.xml"/> | |||
| </target> | |||
| <target name="testParentFirstFalse" depends="-setUpAntlibXmlInInput"> | |||
| <target name="testParentFirstFalse" depends="-setUpAntlibXmlInInput" unless="build.sysclasspath.only"> | |||
| <copy todir="${output}"> | |||
| <javaresource name="org/apache/tools/ant/antlib.xml" | |||
| parentFirst="false"> | |||