PR: 26663 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276097 13f79535-47bb-0310-9956-ffa450edef68master
@@ -0,0 +1,120 @@ | |||
<project name="apply-test" basedir="."> | |||
<target name="init"> | |||
<property environment="env"/> | |||
<!-- UNIX --> | |||
<available file="sh" filepath="${env.PATH}" property="sh.executable"/> | |||
<!-- CYGWIN --> | |||
<available file="sh.exe" filepath="${env.PATH}" property="sh.exe.executable"/> | |||
<condition property="test.can.run"> | |||
<or> | |||
<isset property="sh.executable"/> | |||
<isset property="sh.exe.executable"/> | |||
</or> | |||
</condition> | |||
<!-- UNIX --> | |||
<available file="wc" filepath="${env.PATH}" property="wc.executable"/> | |||
<!-- CYGWIN --> | |||
<available file="wc.exe" filepath="${env.PATH}" property="wc.exe.executable"/> | |||
<condition property="wc.can.run"> | |||
<or> | |||
<isset property="wc.executable"/> | |||
<isset property="wc.exe.executable"/> | |||
</or> | |||
</condition> | |||
<!-- UNIX --> | |||
<available file="sed" filepath="${env.PATH}" property="sed.executable"/> | |||
<!-- CYGWIN --> | |||
<available file="sed.exe" filepath="${env.PATH}" property="sed.exe.executable"/> | |||
<condition property="sed.can.run"> | |||
<or> | |||
<isset property="sed.executable"/> | |||
<isset property="sed.exe.executable"/> | |||
</or> | |||
</condition> | |||
</target> | |||
<target name="xyz"> | |||
<echo file="x">s/x/blah/g${line.separator}</echo> | |||
<echo file="y">s/y/blah/g${line.separator}</echo> | |||
<echo file="z">s/z/blah/g${line.separator}</echo> | |||
<fileset id="xyz" dir="${basedir}" includes="x,y,z" /> | |||
</target> | |||
<target name="no-redirect" depends="init,xyz" if="test.can.run"> | |||
<apply executable="sh"> | |||
<arg value="parrot.sh"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect1" depends="init,xyz" if="test.can.run"> | |||
<apply executable="sh" output="redirect.out" append="true"> | |||
<arg value="parrot.sh"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect2" depends="init,xyz" if="test.can.run"> | |||
<apply executable="sh" output="redirect.out" | |||
error="redirect.err" append="true"> | |||
<arg value="parrot.sh"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect3" depends="init,xyz" if="test.can.run"> | |||
<apply executable="sh" logerror="true" append="true" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="parrot.sh"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect4" depends="init,xyz" if="test.can.run"> | |||
<apply executable="sh" append="true" | |||
error="redirect.err" errorproperty="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="parrot.sh"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect5" depends="init,xyz" if="sed.can.run"> | |||
<apply executable="sed" inputstring="x y z${line.separator}" append="true" | |||
error="redirect.err" errorproperty="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="-f"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect6" depends="init,xyz" if="sed.can.run"> | |||
<echo file="redirect.in">x y z${line.separator}</echo> | |||
<apply executable="sed" input="redirect.in" append="true" | |||
error="redirect.err" errorproperty="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="-f"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect7" depends="init,xyz" if="sed.can.run"> | |||
<apply executable="sed" inputstring="x y z${line.separator}" | |||
error="redirect.err" output="redirect.out" | |||
outputproperty="redirect.out"> | |||
<arg value="-f"/> | |||
<fileset refid="xyz" /> | |||
</apply> | |||
</target> | |||
<target name="redirect7b" depends="redirect7"> | |||
<echo>redirect.out=${redirect.out}</echo> | |||
</target> | |||
<target name="cleanup"> | |||
<delete> | |||
<fileset dir="${basedir}" includes="redirect.*" /> | |||
<fileset refid="xyz" /> | |||
</delete> | |||
</target> | |||
</project> |
@@ -3,7 +3,7 @@ | |||
<!-- this property can be overriden programatically in the Java test case --> | |||
<property name="timeToWait" value="10"/> | |||
<!-- this property can be overriden programatically in the Java test case --> | |||
<property name="logFile" value="/tmp/spawn.log"/> | |||
<property name="logFile" value="${java.io.tmpdir}/spawn.log"/> | |||
<property environment="env"/> | |||
<!-- UNIX --> | |||
<available file="sh" filepath="${env.PATH}" property="sh.executable"/> | |||
@@ -15,7 +15,18 @@ | |||
<isset property="sh.exe.executable"/> | |||
</or> | |||
</condition> | |||
<!-- UNIX --> | |||
<available file="wc" filepath="${env.PATH}" property="wc.executable"/> | |||
<!-- CYGWIN --> | |||
<available file="wc.exe" filepath="${env.PATH}" property="wc.exe.executable"/> | |||
<condition property="wc.can.run"> | |||
<or> | |||
<isset property="wc.executable"/> | |||
<isset property="wc.exe.executable"/> | |||
</or> | |||
</condition> | |||
</target> | |||
<target name="spawn" depends="init" if="test.can.run"> | |||
<exec executable="sh" spawn="true"> | |||
<arg value="spawn.sh"/> | |||
@@ -23,7 +34,74 @@ | |||
<arg value="${logFile}" /> | |||
</exec> | |||
</target> | |||
<target name="no-redirect" depends="init" if="test.can.run"> | |||
<exec executable="sh"> | |||
<arg value="parrot.sh"/> | |||
<arg value="${ant.file}" /> | |||
</exec> | |||
</target> | |||
<target name="redirect1" depends="init" if="test.can.run"> | |||
<exec executable="sh" output="redirect.out"> | |||
<arg value="parrot.sh"/> | |||
<arg value="${ant.file}" /> | |||
</exec> | |||
</target> | |||
<target name="redirect2" depends="init" if="test.can.run"> | |||
<exec executable="sh" output="redirect.out" error="redirect.err"> | |||
<arg value="parrot.sh"/> | |||
<arg value="${ant.file}" /> | |||
</exec> | |||
</target> | |||
<target name="redirect3" depends="init" if="test.can.run"> | |||
<exec executable="sh" logerror="true" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="parrot.sh"/> | |||
<arg value="${ant.file}" /> | |||
</exec> | |||
</target> | |||
<target name="redirect4" depends="init" if="test.can.run"> | |||
<exec executable="sh" | |||
error="redirect.err" errorproperty="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="parrot.sh"/> | |||
<arg value="${ant.file}" /> | |||
</exec> | |||
</target> | |||
<target name="redirect5" depends="init" if="wc.can.run"> | |||
<exec executable="wc" inputstring="x y z" | |||
error="redirect.err" errorproperty="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="-w"/> | |||
</exec> | |||
</target> | |||
<target name="redirect6" depends="init" if="wc.can.run"> | |||
<echo file="redirect.in">x y z</echo> | |||
<exec executable="wc" input="redirect.in" | |||
error="redirect.err" errorproperty="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="-w"/> | |||
</exec> | |||
</target> | |||
<target name="redirect7" depends="init" if="wc.can.run"> | |||
<exec executable="wc" inputstring="x y z" | |||
error="redirect.err" | |||
output="redirect.out" outputproperty="redirect.out"> | |||
<arg value="-w"/> | |||
</exec> | |||
</target> | |||
<target name="cleanup"> | |||
<delete file="${logFile}"/> | |||
<delete> | |||
<fileset file="${logFile}" /> | |||
<fileset dir="${basedir}" includes="redirect.*" /> | |||
</delete> | |||
</target> | |||
</project> | |||
</project> |
@@ -0,0 +1,6 @@ | |||
# Copyright (c) 2004 The Apache Software Foundation. All rights reserved. | |||
for arg in $@ ; do | |||
echo $arg out | |||
sleep 1 | |||
echo $arg err>&2 | |||
done |
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2003-2004 The Apache Software Foundation | |||
* Copyright 2003-2004 The Apache Software Foundation. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
@@ -21,13 +21,16 @@ import org.apache.tools.ant.*; | |||
import org.apache.tools.ant.util.FileUtils; | |||
import java.io.File; | |||
import java.io.FileReader; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.util.GregorianCalendar; | |||
import junit.framework.Assert; | |||
import junit.framework.ComparisonFailure; | |||
/** | |||
* @author <a href="antoine@antbuild.com">Antoine Levy-Lambert</a> | |||
* @author Matt Benson | |||
*/ | |||
public class ExecTaskTest extends BuildFileTest { | |||
private static final String BUILD_PATH = "src/etc/testcases/taskdefs/exec/"; | |||
@@ -49,11 +52,130 @@ public class ExecTaskTest extends BuildFileTest { | |||
} | |||
public void tearDown() { | |||
if (logFile != null) { | |||
executeTarget("cleanup"); | |||
if (logFile != null && logFile.exists()) { | |||
logFile.delete(); | |||
} | |||
} | |||
public void testNoRedirect() { | |||
expectLog("no-redirect", getProject().getProperty("ant.file") + " out" | |||
+ getProject().getProperty("ant.file") + " err"); | |||
} | |||
public void testRedirect1() { | |||
executeTarget("redirect1"); | |||
String expectedOut = getProject().getProperty("ant.file") + " out\n" | |||
+ getProject().getProperty("ant.file") + " err\n"; | |||
String actualOut = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertEquals("unexpected output", expectedOut, actualOut); | |||
} | |||
public void testRedirect2() { | |||
executeTarget("redirect2"); | |||
String expectedOut = getProject().getProperty("ant.file") + " out\n"; | |||
String expectedErr = getProject().getProperty("ant.file") + " err\n"; | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertEquals("unexpected output", expectedOut, actualOut); | |||
assertEquals("unexpected error output", expectedErr, actualErr); | |||
} | |||
public void testRedirect3() { | |||
expectLog("redirect3", getProject().getProperty("ant.file") + " err"); | |||
String expectedOut = getProject().getProperty("ant.file") + " out\n"; | |||
String actualOut = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertEquals("unexpected output", expectedOut, actualOut); | |||
assertPropertyEquals("redirect.out", expectedOut.trim()); | |||
} | |||
public void testRedirect4() { | |||
executeTarget("redirect4"); | |||
String expectedOut = getProject().getProperty("ant.file") + " out\n"; | |||
String expectedErr = getProject().getProperty("ant.file") + " err\n"; | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertEquals("unexpected output", expectedOut, actualOut); | |||
assertPropertyEquals("redirect.out", expectedOut.trim()); | |||
assertEquals("unexpected error output", expectedErr, actualErr); | |||
assertPropertyEquals("redirect.err", expectedErr.trim()); | |||
} | |||
public void testRedirect5() { | |||
testRedirect5or6("redirect5"); | |||
} | |||
public void testRedirect6() { | |||
testRedirect5or6("redirect6"); | |||
} | |||
public void testRedirect5or6(String target) { | |||
executeTarget(target); | |||
String expectedOut = getProject().getProperty("ant.file") + " out\n"; | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertEquals("unexpected output", "3", actualOut.trim()); | |||
assertEquals(getProject().getProperty("redirect.out").trim(), "3"); | |||
assertEquals("unexpected error output", null, actualErr); | |||
assertPropertyEquals("redirect.err", ""); | |||
} | |||
public void testRedirect7() { | |||
executeTarget("redirect7"); | |||
String expectedOut = getProject().getProperty("ant.file") + " out\n"; | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertEquals("unexpected output", "3", actualOut.trim()); | |||
assertEquals(getProject().getProperty("redirect.out").trim(), "3"); | |||
assertEquals("unexpected error output", null, actualErr); | |||
} | |||
public void testspawn() { | |||
project.executeTarget("init"); | |||
if (project.getProperty("test.can.run") == null) { | |||
@@ -0,0 +1,248 @@ | |||
/* | |||
* Copyright 2004 The Apache Software Foundation. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
* | |||
*/ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.tools.ant.*; | |||
import org.apache.tools.ant.util.FileUtils; | |||
import java.io.File; | |||
import java.io.FileReader; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.util.GregorianCalendar; | |||
import junit.framework.ComparisonFailure; | |||
/** | |||
* @author Matt Benson | |||
*/ | |||
public class ExecuteOnTest extends BuildFileTest { | |||
private static final String BUILD_PATH = "src/etc/testcases/taskdefs/exec/"; | |||
private static final String BUILD_FILE = BUILD_PATH + "apply.xml"; | |||
// private final int TIME_TO_WAIT = 1; | |||
/** maximum time allowed for the build in milliseconds */ | |||
// private final int MAX_BUILD_TIME = 4000; | |||
// private final int SECURITY_MARGIN = 2000; // wait 2 second extras | |||
// the test failed with 100 ms of margin on cvs.apache.org on August 1st, 2003 | |||
public ExecuteOnTest(String name) { | |||
super(name); | |||
} | |||
public void setUp() { | |||
configureProject(BUILD_FILE); | |||
} | |||
public void tearDown() { | |||
executeTarget("cleanup"); | |||
} | |||
public void testNoRedirect() { | |||
executeTarget("no-redirect"); | |||
String log = getLog(); | |||
File x = getProject().resolveFile("x"); | |||
File y = getProject().resolveFile("y"); | |||
File z = getProject().resolveFile("z"); | |||
int xout = log.indexOf(x + " out"); | |||
int yout = log.indexOf(y + " out"); | |||
int zout = log.indexOf(z + " out"); | |||
int xerr = log.indexOf(x + " err"); | |||
int yerr = log.indexOf(y + " err"); | |||
int zerr = log.indexOf(z + " err"); | |||
assertFalse("xout < 0", xout < 0); | |||
assertFalse("yout < 0", yout < 0); | |||
assertFalse("zout < 0", zout < 0); | |||
assertFalse("xerr < 0", xerr < 0); | |||
assertFalse("yerr < 0", yerr < 0); | |||
assertFalse("zerr < 0", zerr < 0); | |||
assertFalse("yout < xout", yout < xout); | |||
assertFalse("zout < yout", zout < yout); | |||
assertFalse("yerr < xerr", yerr < xerr); | |||
assertFalse("zerr < yerr", zerr < yerr); | |||
} | |||
public void testRedirect1() { | |||
executeTarget("redirect1"); | |||
String actualOut = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
File x = getProject().resolveFile("x"); | |||
File y = getProject().resolveFile("y"); | |||
File z = getProject().resolveFile("z"); | |||
int xout = actualOut.indexOf(x + " out"); | |||
int yout = actualOut.indexOf(y + " out"); | |||
int zout = actualOut.indexOf(z + " out"); | |||
int xerr = actualOut.indexOf(x + " err"); | |||
int yerr = actualOut.indexOf(y + " err"); | |||
int zerr = actualOut.indexOf(z + " err"); | |||
assertFalse("xout < 0", xout < 0); | |||
assertFalse("yout < 0", yout < 0); | |||
assertFalse("zout < 0", zout < 0); | |||
assertFalse("xerr < 0", xerr < 0); | |||
assertFalse("yerr < 0", yerr < 0); | |||
assertFalse("zerr < 0", zerr < 0); | |||
assertFalse("yout < xout", yout < xout); | |||
assertFalse("zout < yout", zout < yout); | |||
assertFalse("yerr < xerr", yerr < xerr); | |||
assertFalse("zerr < yerr", zerr < yerr); | |||
} | |||
public void testRedirect2() { | |||
executeTarget("redirect2"); | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
File x = getProject().resolveFile("x"); | |||
File y = getProject().resolveFile("y"); | |||
File z = getProject().resolveFile("z"); | |||
int xout = actualOut.indexOf(x + " out"); | |||
int yout = actualOut.indexOf(y + " out"); | |||
int zout = actualOut.indexOf(z + " out"); | |||
int xerr = actualErr.indexOf(x + " err"); | |||
int yerr = actualErr.indexOf(y + " err"); | |||
int zerr = actualErr.indexOf(z + " err"); | |||
assertFalse("xout < 0", xout < 0); | |||
assertFalse("yout < 0", yout < 0); | |||
assertFalse("zout < 0", zout < 0); | |||
assertFalse("xerr < 0", xerr < 0); | |||
assertFalse("yerr < 0", yerr < 0); | |||
assertFalse("zerr < 0", zerr < 0); | |||
assertFalse("yout < xout", yout < xout); | |||
assertFalse("zout < yout", zout < yout); | |||
assertFalse("yerr < xerr", yerr < xerr); | |||
assertFalse("zerr < yerr", zerr < yerr); | |||
} | |||
public void testRedirect3() { | |||
executeTarget("redirect3"); | |||
String actualOut = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
File x = getProject().resolveFile("x"); | |||
File y = getProject().resolveFile("y"); | |||
File z = getProject().resolveFile("z"); | |||
int xout = actualOut.indexOf(x + " out"); | |||
int yout = actualOut.indexOf(y + " out"); | |||
int zout = actualOut.indexOf(z + " out"); | |||
int xerr = getLog().indexOf(x + " err"); | |||
int yerr = getLog().indexOf(y + " err"); | |||
int zerr = getLog().indexOf(z + " err"); | |||
assertFalse("xout < 0", xout < 0); | |||
assertFalse("yout < 0", yout < 0); | |||
assertFalse("zout < 0", zout < 0); | |||
assertFalse("xerr < 0", xerr < 0); | |||
assertFalse("yerr < 0", yerr < 0); | |||
assertFalse("zerr < 0", zerr < 0); | |||
assertFalse("yout < xout", yout < xout); | |||
assertFalse("zout < yout", zout < yout); | |||
assertFalse("yerr < xerr", yerr < xerr); | |||
assertFalse("zerr < yerr", zerr < yerr); | |||
assertPropertyEquals("redirect.out", x + " out"); | |||
} | |||
public void testRedirect4() { | |||
executeTarget("redirect4"); | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
File x = getProject().resolveFile("x"); | |||
File y = getProject().resolveFile("y"); | |||
File z = getProject().resolveFile("z"); | |||
int xout = actualOut.indexOf(x + " out"); | |||
int yout = actualOut.indexOf(y + " out"); | |||
int zout = actualOut.indexOf(z + " out"); | |||
int xerr = actualErr.indexOf(x + " err"); | |||
int yerr = actualErr.indexOf(y + " err"); | |||
int zerr = actualErr.indexOf(z + " err"); | |||
assertFalse("xout < 0", xout < 0); | |||
assertFalse("yout < 0", yout < 0); | |||
assertFalse("zout < 0", zout < 0); | |||
assertFalse("xerr < 0", xerr < 0); | |||
assertFalse("yerr < 0", yerr < 0); | |||
assertFalse("zerr < 0", zerr < 0); | |||
assertFalse("yout < xout", yout < xout); | |||
assertFalse("zout < yout", zout < yout); | |||
assertFalse("yerr < xerr", yerr < xerr); | |||
assertFalse("zerr < yerr", zerr < yerr); | |||
assertPropertyEquals("redirect.out", x + " out"); | |||
assertPropertyEquals("redirect.err", x + " err"); | |||
} | |||
public void testRedirect5() { | |||
testRedirect5or6("redirect5"); | |||
} | |||
public void testRedirect6() { | |||
testRedirect5or6("redirect6"); | |||
} | |||
private void testRedirect5or6(String target) { | |||
executeTarget(target); | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertPropertyEquals("redirect.out", "blah y z"); | |||
assertPropertyEquals("redirect.err", ""); | |||
assertEquals("unexpected content in redirect.out", | |||
"blah y z\nx blah z\nx y blah\n", actualOut); | |||
assertEquals("unexpected content in redirect.err", null, actualErr); | |||
} | |||
public void testRedirect7() { | |||
executeTarget("redirect7"); | |||
String actualOut = null; | |||
String actualErr = null; | |||
try { | |||
actualOut = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.out"))); | |||
actualErr = FileUtils.newFileUtils().readFully(new FileReader( | |||
getProject().resolveFile("redirect.err"))); | |||
} catch (IOException eyeOhEx) { | |||
} | |||
assertPropertyEquals("redirect.out", "blah y z"); | |||
assertPropertyUnset("redirect.err"); | |||
assertEquals("unexpected content in redirect.out", | |||
"x y blah\n", actualOut); | |||
assertEquals("unexpected content in redirect.err", null, actualErr); | |||
} | |||
} |