git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@540043 13f79535-47bb-0310-9956-ffa450edef68master
@@ -15,7 +15,7 @@ | |||||
</target> | </target> | ||||
<target name="setUp"> | <target name="setUp"> | ||||
<mkdir dir="${classes.dir}"/> | |||||
<mkdir dir="${classes.dir}"/> | |||||
<javac srcdir="src" destdir="${classes.dir}" debug="yes"/> | <javac srcdir="src" destdir="${classes.dir}" debug="yes"/> | ||||
<taskdef name="echo-location" classname="task.EchoLocation" | <taskdef name="echo-location" classname="task.EchoLocation" | ||||
classpath="${classes.dir}"/> | classpath="${classes.dir}"/> | ||||
@@ -46,7 +46,7 @@ | |||||
</target> | </target> | ||||
<target name="tearDown"> | <target name="tearDown"> | ||||
<delete dir="${working.dir}"/> | |||||
<delete dir="${working.dir}"/> | |||||
</target> | </target> | ||||
<target name="test-plain-task"> | <target name="test-plain-task"> | ||||
@@ -74,4 +74,4 @@ | |||||
<au:assertLogContains text="Line: "/> | <au:assertLogContains text="Line: "/> | ||||
</target> | </target> | ||||
</project> | |||||
</project> |
@@ -1,11 +1,11 @@ | |||||
<?xml version="1.0"?> | <?xml version="1.0"?> | ||||
<project name="delete-test" basedir="." default="antunit" | <project name="delete-test" basedir="." default="antunit" | ||||
xmlns:au="antlib:org.apache.ant.antunit"> | |||||
xmlns:au="antlib:org.apache.ant.antunit"> | |||||
<property name="working.dir" value="working"/> | <property name="working.dir" value="working"/> | ||||
<property name="existing.dir" value="working/exists"/> | <property name="existing.dir" value="working/exists"/> | ||||
<property name="nonexistent.dir" value="working/nonexists"/> | <property name="nonexistent.dir" value="working/nonexists"/> | ||||
<import file="../antunit-base.xml" /> | <import file="../antunit-base.xml" /> | ||||
<target name="init"> | <target name="init"> | ||||
@@ -24,15 +24,15 @@ | |||||
<fileset dir="${nonexistent.dir}"/> | <fileset dir="${nonexistent.dir}"/> | ||||
</delete> | </delete> | ||||
<au:assertFileExists file="${existing.dir}" /> | |||||
<au:assertFileExists file="${existing.dir}" /> | |||||
<delete quiet="true" includeEmptyDirs="true"> | <delete quiet="true" includeEmptyDirs="true"> | ||||
<fileset dir="${existing.dir}"/> | <fileset dir="${existing.dir}"/> | ||||
</delete> | </delete> | ||||
<au:assertFileDoesntExist file="${existing.dir}" /> | |||||
<au:assertFileDoesntExist file="${existing.dir}" /> | |||||
<mkdir dir="${existing.dir}"/> | <mkdir dir="${existing.dir}"/> | ||||
<delete quiet="true" includeEmptyDirs="true"> | <delete quiet="true" includeEmptyDirs="true"> | ||||
@@ -41,7 +41,7 @@ | |||||
</delete> | </delete> | ||||
<au:assertFileDoesntExist file="${existing.dir}" /> | |||||
<au:assertFileDoesntExist file="${existing.dir}" /> | |||||
<mkdir dir="${existing.dir}"/> | <mkdir dir="${existing.dir}"/> | ||||
@@ -51,7 +51,7 @@ | |||||
</delete> | </delete> | ||||
<au:assertFileDoesntExist file="${existing.dir}" /> | |||||
<au:assertFileDoesntExist file="${existing.dir}" /> | |||||
</target> | </target> | ||||
@@ -4,40 +4,40 @@ | |||||
<import file="../antunit-base.xml"/> | <import file="../antunit-base.xml"/> | ||||
<target name="test1"> | <target name="test1"> | ||||
<au:expectfailure expectedmessage="property attribute required"> | |||||
<au:expectfailure expectedmessage="property attribute required"> | |||||
<dirname/> | <dirname/> | ||||
</au:expectfailure> | |||||
</au:expectfailure> | |||||
</target> | </target> | ||||
<target name="test2"> | <target name="test2"> | ||||
<au:expectfailure expectedmessage="file attribute required"> | |||||
<dirname property="propname"/> | |||||
</au:expectfailure> | |||||
<au:expectfailure expectedmessage="file attribute required"> | |||||
<dirname property="propname"/> | |||||
</au:expectfailure> | |||||
</target> | </target> | ||||
<target name="test3"> | <target name="test3"> | ||||
<au:expectfailure expectedmessage="property attribute required"> | |||||
<au:expectfailure expectedmessage="property attribute required"> | |||||
<dirname file="filename"/> | <dirname file="filename"/> | ||||
</au:expectfailure> | </au:expectfailure> | ||||
</target> | </target> | ||||
<target name="init-test4"> | <target name="init-test4"> | ||||
<condition property="valid.os"> | |||||
<and> | |||||
<not><os family="dos"/></not><not><os family="netware"/></not> | |||||
</and> | |||||
</condition> | |||||
<condition property="valid.os"> | |||||
<and> | |||||
<not><os family="dos"/></not><not><os family="netware"/></not> | |||||
</and> | |||||
</condition> | |||||
</target> | </target> | ||||
<target name="test4" depends="init-test4" if="valid.os"> | <target name="test4" depends="init-test4" if="valid.os"> | ||||
<dirname property="local.dir" file="/usr/local/foo.txt"/> | |||||
<au:assertPropertyEquals name="local.dir" | |||||
value="${file.separator}usr${file.separator}local${file.separator}foo.txt"/> | |||||
<dirname property="local.dir" file="/usr/local/foo.txt"/> | |||||
<au:assertPropertyEquals name="local.dir" | |||||
value="${file.separator}usr${file.separator}local${file.separator}foo.txt"/> | |||||
</target> | </target> | ||||
<target name="test5"> | <target name="test5"> | ||||
<dirname property="base.dir" file="foo.txt"/> | <dirname property="base.dir" file="foo.txt"/> | ||||
<au:assertPropertyEquals name="base.dir" value="${basedir}"/> | |||||
<au:assertPropertyEquals name="base.dir" value="${basedir}"/> | |||||
</target> | </target> | ||||
</project> | |||||
</project> |
@@ -3,47 +3,47 @@ | |||||
<!-- note relies on antunit built from svn trunk (1.1-alpha) --> | <!-- note relies on antunit built from svn trunk (1.1-alpha) --> | ||||
<import file="../antunit-base.xml"/> | <import file="../antunit-base.xml"/> | ||||
<target name="setUp"> | <target name="setUp"> | ||||
<property name="file" location="${java.io.tmpdir}/echoed.xml"/> | |||||
<echoxml file="${file}"> | |||||
<project> | |||||
<property name="foo" value="bar" /> | |||||
<fail message="$$$${foo}=$${foo}"> | |||||
<condition> | |||||
<istrue value="${mustfail}" /> | |||||
</condition> | |||||
</fail> | |||||
</project> | |||||
</echoxml> | |||||
<property name="file" location="${java.io.tmpdir}/echoed.xml"/> | |||||
<echoxml file="${file}"> | |||||
<project> | |||||
<property name="foo" value="bar" /> | |||||
<fail message="$$$${foo}=$${foo}"> | |||||
<condition> | |||||
<istrue value="${mustfail}" /> | |||||
</condition> | |||||
</fail> | |||||
</project> | |||||
</echoxml> | |||||
</target> | </target> | ||||
<target name="tearDown"> | <target name="tearDown"> | ||||
<delete file="${file}"/> | <delete file="${file}"/> | ||||
</target> | |||||
</target> | |||||
<target name="testPass"> | <target name="testPass"> | ||||
<ant antfile="${file}"/> | |||||
<ant antfile="${file}"/> | |||||
</target> | </target> | ||||
<target name="testFail"> | <target name="testFail"> | ||||
<au:expectfailure expectedmessage="${foo}=bar" message="Should have thrown an exception"> | |||||
<au:expectfailure expectedmessage="${foo}=bar" message="Should have thrown an exception"> | |||||
<ant antfile="${file}"> | <ant antfile="${file}"> | ||||
<property name="mustfail" value="true" /> | <property name="mustfail" value="true" /> | ||||
</ant> | </ant> | ||||
</au:expectfailure> | |||||
</au:expectfailure> | |||||
</target> | </target> | ||||
<target name="testEmpty"> | <target name="testEmpty"> | ||||
<au:expectfailure expectedmessage="No nested XML specified" message="Should have thrown an exception"> | |||||
<au:expectfailure expectedmessage="No nested XML specified" message="Should have thrown an exception"> | |||||
<echoxml /> | <echoxml /> | ||||
</au:expectfailure> | |||||
</au:expectfailure> | |||||
</target> | </target> | ||||
<target name="test-ns"> <!-- comment this if you don't have the svn trunk of antunit --> | <target name="test-ns"> <!-- comment this if you don't have the svn trunk of antunit --> | ||||
<echoxml file="${file}" xmlns:a="antlib:a"> | |||||
<a:something /> | |||||
</echoxml> | |||||
<au:assertResourceContains resource="${file}" value="a:something"/> | |||||
<echoxml file="${file}" xmlns:a="antlib:a"> | |||||
<a:something /> | |||||
</echoxml> | |||||
<au:assertResourceContains resource="${file}" value="a:something"/> | |||||
</target> | </target> | ||||
</project> | |||||
</project> |
@@ -3,7 +3,7 @@ | |||||
<target name="test-move-caseonly"> | <target name="test-move-caseonly"> | ||||
<!-- this test is inspired by bugzilla 41948 --> | <!-- this test is inspired by bugzilla 41948 --> | ||||
<!-- Especially intresting if executed on case-insensitive file systems --> | |||||
<!-- Especially intresting if executed on case-insensitive file systems --> | |||||
<touch file="${java.io.tmpdir}/abc"/> | <touch file="${java.io.tmpdir}/abc"/> | ||||
<move file="${java.io.tmpdir}/abc" tofile="${java.io.tmpdir}/aBc"/> | <move file="${java.io.tmpdir}/abc" tofile="${java.io.tmpdir}/aBc"/> | ||||
<fileset dir="${java.io.tmpdir}" id="myfs"> | <fileset dir="${java.io.tmpdir}" id="myfs"> | ||||
@@ -16,4 +16,4 @@ | |||||
<target name="tearDown"> | <target name="tearDown"> | ||||
<delete file="${java.io.tmpdir}/aBc"/> | <delete file="${java.io.tmpdir}/aBc"/> | ||||
</target> | </target> | ||||
</project> | |||||
</project> |
@@ -1,26 +1,27 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
<project name="retry-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | <project name="retry-test" default="antunit" xmlns:au="antlib:org.apache.ant.antunit"> | ||||
<import file="../antunit-base.xml"/> | <import file="../antunit-base.xml"/> | ||||
<target name="test-fail-and-retry"> | <target name="test-fail-and-retry"> | ||||
<property name="i" value="3"/> | |||||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||||
<!-- just in case this ever becomes a legit url... --> | |||||
<property name="src" value="http://iojasodjojaosdj"/> | |||||
<au:expectfailure expectedmessage="Task [get] failed after [${i}] attempts, giving up"> | |||||
<retry retrycount="${i}"> | |||||
<get src="${src}" dest="${dest}"/> | |||||
</retry> | |||||
</au:expectfailure> | |||||
<au:assertLogContains text="Attempt [1] error occured, retrying..."/> | |||||
<property name="i" value="3"/> | |||||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||||
<!-- just in case this ever becomes a legit url... --> | |||||
<property name="src" value="http://iojasodjojaosdj"/> | |||||
<au:expectfailure expectedmessage="Task [get] failed after [${i}] attempts, giving up"> | |||||
<retry retrycount="${i}"> | |||||
<get src="${src}" dest="${dest}"/> | |||||
</retry> | |||||
</au:expectfailure> | |||||
<au:assertLogContains text="Attempt [1] error occured, retrying..."/> | |||||
</target> | </target> | ||||
<target name="test-success"> | <target name="test-success"> | ||||
<property name="i" value="3"/> | |||||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||||
<retry retrycount="${i}"> | |||||
<touch file="${dest}"/> | |||||
</retry> | |||||
<au:assertLogDoesntContain text="Attempt [1] error occured, retrying..."/> | |||||
<property name="i" value="3"/> | |||||
<property name="dest" value="${java.io.tmpdir}/dest"/> | |||||
<retry retrycount="${i}"> | |||||
<touch file="${dest}"/> | |||||
</retry> | |||||
<au:assertLogDoesntContain text="Attempt [1] error occured, retrying..."/> | |||||
</target> | </target> | ||||
</project> | |||||
</project> |
@@ -57,5 +57,4 @@ | |||||
</au:antunit> | </au:antunit> | ||||
</target> | </target> | ||||
</project> | </project> |