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