git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277086 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,20 +1,25 @@ | |||
| <?xml version="1.0"?> | |||
| <project name="recorder-test" default="all" basedir="."> | |||
| <property name="recdir" location="recorder"/> | |||
| <property name="recin" location="recorder"/> | |||
| <property name="recdir" location="recorder-out"/> | |||
| <target name="all" depends="noappend,append,restart,deleterestart"/> | |||
| <target name="prepare"> | |||
| <fixcrlf srcdir="${recdir}" includes="*.result"/> | |||
| <mkdir dir="${recdir}"/> | |||
| <copy toDir="${recdir}"> | |||
| <fileset dir="${recin}"/> | |||
| </copy> | |||
| <fixcrlf srcdir="${recdir}"/> | |||
| </target> | |||
| <target name="noappend"> | |||
| <copy file="${recdir}/rectest2.result" tofile="${recdir}/rectest1.log"/> | |||
| <record name="${recdir}/rectest1.log" action="start" /> | |||
| <echo message="some message1"/> | |||
| <record name="${recdir}/rectest1.log" action="stop" /> | |||
| <fixcrlf srcdir="${recdir}" includes="*.log"/> | |||
| </target> | |||
| <target name="append"> | |||
| @@ -22,6 +27,7 @@ | |||
| <record name="${recdir}/rectest2.log" append="true" action="start"/> | |||
| <echo message="some message2"/> | |||
| <record name="${recdir}/rectest2.log" action="stop"/> | |||
| <fixcrlf srcdir="${recdir}" includes="*.log"/> | |||
| </target> | |||
| <target name="restart"> | |||
| @@ -32,6 +38,7 @@ | |||
| <record name="${recdir}/rectest3.log" action="start"/> | |||
| <echo message="some message3"/> | |||
| <record name="${recdir}/rectest3.log" action="stop"/> | |||
| <fixcrlf srcdir="${recdir}" includes="*.log"/> | |||
| </target> | |||
| <target name="deleterestart"> | |||
| @@ -43,14 +50,12 @@ | |||
| <record name="${recdir}/rectest4.log" action="start"/> | |||
| <echo message="some message3"/> | |||
| <record name="${recdir}/rectest4.log" action="stop"/> | |||
| <fixcrlf srcdir="${recdir}" includes="*.log"/> | |||
| </target> | |||
| <target name="cleanup"> | |||
| <delete file="${recdir}/rectest1.log"/> | |||
| <delete file="${recdir}/rectest2.log"/> | |||
| <delete file="${recdir}/rectest3.log"/> | |||
| <delete file="${recdir}/rectest4.log"/> | |||
| <delete dir="${recdir}"/> | |||
| </target> | |||
| </project> | |||
| @@ -27,6 +27,8 @@ import java.io.IOException; | |||
| */ | |||
| public class RecorderTest extends BuildFileTest { | |||
| private static final String REC_DIR = "recorder-out"; | |||
| public RecorderTest(String name) { | |||
| super(name); | |||
| } | |||
| @@ -43,29 +45,41 @@ public class RecorderTest extends BuildFileTest { | |||
| public void testNoAppend() throws IOException { | |||
| FileUtils fileUtils = FileUtils.newFileUtils(); | |||
| executeTarget("noappend"); | |||
| assertTrue(fileUtils.contentEquals(project.resolveFile("recorder/rectest1.result"), | |||
| project.resolveFile("recorder/rectest1.log"))); | |||
| assertTrue(fileUtils | |||
| .contentEquals(project.resolveFile(REC_DIR | |||
| + "rectest1.result"), | |||
| project.resolveFile(REC_DIR | |||
| + "rectest1.log"))); | |||
| } | |||
| public void testAppend() throws IOException { | |||
| FileUtils fileUtils = FileUtils.newFileUtils(); | |||
| executeTarget("append"); | |||
| assertTrue(fileUtils.contentEquals(project.resolveFile("recorder/rectest2.result"), | |||
| project.resolveFile("recorder/rectest2.log"))); | |||
| assertTrue(fileUtils | |||
| .contentEquals(project.resolveFile(REC_DIR | |||
| + "rectest2.result"), | |||
| project.resolveFile(REC_DIR | |||
| + "rectest2.log"))); | |||
| } | |||
| public void testRestart() throws IOException { | |||
| FileUtils fileUtils = FileUtils.newFileUtils(); | |||
| executeTarget("restart"); | |||
| assertTrue(fileUtils.contentEquals(project.resolveFile("recorder/rectest3.result"), | |||
| project.resolveFile("recorder/rectest3.log"))); | |||
| assertTrue(fileUtils | |||
| .contentEquals(project.resolveFile(REC_DIR | |||
| + "rectest3.result"), | |||
| project.resolveFile(REC_DIR | |||
| + "rectest3.log"))); | |||
| } | |||
| public void testDeleteRestart() throws IOException { | |||
| FileUtils fileUtils = FileUtils.newFileUtils(); | |||
| executeTarget("deleterestart"); | |||
| assertTrue(fileUtils.contentEquals(project.resolveFile("recorder/rectest4.result"), | |||
| project.resolveFile("recorder/rectest4.log"))); | |||
| assertTrue(fileUtils | |||
| .contentEquals(project.resolveFile(REC_DIR | |||
| + "rectest4.result"), | |||
| project.resolveFile(REC_DIR | |||
| + "rectest4.log"))); | |||
| } | |||
| } | |||