Methods Summary |
---|
protected void | assertGoodFile()
File f = createRelativeFile( GOOD_OUTFILE );
assertTrue(
"Did not create "+f.getAbsolutePath(),
f.exists() );
Properties props=loadPropFile(GOOD_OUTFILE);
props.list(System.out);
assertEquals("test property not found ",
TEST_VALUE, props.getProperty("test.property"));
/*
// read in the file
FileReader fr = new FileReader( f );
try {
BufferedReader br = new BufferedReader( fr );
String read = null;
while ( (read = br.readLine()) != null)
{
if (read.indexOf("test.property" + TEST_VALUE) >= 0)
{
// found the property we set - it's good.
return;
}
}
fail( "did not encounter set property in generated file." );
} finally {
try { fr.close(); } catch(IOException e) {}
}
*/
|
protected java.io.File | createRelativeFile(java.lang.String filename)
if (filename.equals( "." )) {
return getProjectDir();
}
// else
return new File( getProjectDir(), filename );
|
protected java.util.Properties | loadPropFile(java.lang.String relativeFilename)
File f = createRelativeFile( relativeFilename );
Properties props=new Properties();
InputStream in=null;
try {
in=new BufferedInputStream(new FileInputStream(f));
props.load(in);
} finally {
if(in!=null) {
try { in.close(); } catch(IOException e) {}
}
}
return props;
|
public void | setUp()
configureProject(TASKDEFS_DIR + "echoproperties.xml");
project.setProperty( "test.property", TEST_VALUE );
|
public void | tearDown()
executeTarget("cleanup");
|
public void | testEchoPrefix()
testEchoPrefixVarious("testEchoPrefix");
|
public void | testEchoPrefixAsDoublyNegatedPropertyset()
testEchoPrefixVarious("testEchoPrefixAsDoublyNegatedPropertyset");
|
public void | testEchoPrefixAsNegatedPropertyset()
testEchoPrefixVarious("testEchoPrefixAsNegatedPropertyset");
|
public void | testEchoPrefixAsPropertyset()
testEchoPrefixVarious("testEchoPrefixAsPropertyset");
|
private void | testEchoPrefixVarious(java.lang.String target)
executeTarget(target);
Properties props = loadPropFile(PREFIX_OUTFILE);
assertEquals("prefix didn't include 'a.set' property",
"true", props.getProperty("a.set"));
assertNull("prefix failed to filter out property 'b.set'",
props.getProperty("b.set"));
|
public void | testEchoToBadFile()
expectBuildExceptionContaining( "testEchoToBadFile",
"destfile is a directory", "destfile is a directory!" );
|
public void | testEchoToBadFileFail()
expectBuildExceptionContaining( "testEchoToBadFileFail",
"destfile is a directory", "destfile is a directory!" );
|
public void | testEchoToBadFileNoFail()
expectLog( "testEchoToBadFileNoFail", "destfile is a directory!");
|
public void | testEchoToGoodFile()
executeTarget( "testEchoToGoodFile" );
assertGoodFile();
|
public void | testEchoToGoodFileFail()
executeTarget( "testEchoToGoodFileFail" );
assertGoodFile();
|
public void | testEchoToGoodFileNoFail()
executeTarget( "testEchoToGoodFileNoFail" );
assertGoodFile();
|
public void | testEchoToGoodFileXml()
executeTarget( "testEchoToGoodFileXml" );
// read in the file
File f = createRelativeFile( GOOD_OUTFILE_XML );
FileReader fr = new FileReader( f );
try {
BufferedReader br = new BufferedReader( fr );
String read = null;
while ( (read = br.readLine()) != null) {
if (read.indexOf("<property name=\"test.property\" value=\""+TEST_VALUE+"\" />") >= 0) {
// found the property we set - it's good.
return;
}
}
fail( "did not encounter set property in generated file." );
} finally {
try {
fr.close();
} catch(IOException e) {}
}
|
public void | testEchoToLog()
expectLogContaining("testEchoToLog", "test.property="+TEST_VALUE);
|
public void | testEchoWithEmptyPrefixToLog()
expectLogContaining("testEchoWithEmptyPrefixToLog", "test.property="+TEST_VALUE);
|
public void | testReadBadFile()
expectBuildExceptionContaining( "testReadBadFile",
"srcfile is a directory", "srcfile is a directory!" );
|
public void | testReadBadFileFail()
expectBuildExceptionContaining( "testReadBadFile",
"srcfile is a directory", "srcfile is a directory!" );
|
public void | testReadBadFileNoFail()
expectLog( "testReadBadFileNoFail", "srcfile is a directory!" );
|
public void | testWithEmptyPrefixAndRegex()
expectLogContaining("testEchoWithEmptyPrefixToLog", "test.property="+TEST_VALUE);
|
public void | testWithPrefixAndRegex()
expectSpecificBuildException("testWithPrefixAndRegex",
"The target must fail with prefix and regex attributes set",
"Please specify either prefix or regex, but not both");
|
public void | testWithRegex()
executeTarget("testWithRegex");
assertDebuglogContaining("ant.home=");
|
protected java.lang.String | toAbsolute(java.lang.String filename)
return createRelativeFile( filename ).getAbsolutePath();
|