Methods Summary |
---|
private void | assertFileContains(java.lang.String filename, java.lang.String contains)
String content = getFileString(filename);
assertTrue(
"expecting file " + filename
+ " to contain " + contains
+ " but got " + content,
content.indexOf(contains) > -1);
|
private void | expectFileContains(java.lang.String target, java.lang.String filename, java.lang.String contains)
executeTarget(target);
assertFileContains(filename, contains);
|
private java.lang.String | getFileString(java.lang.String filename)
Reader r = null;
try {
r = new FileReader(getProject().resolveFile(filename));
return FileUtils.readFully(r);
}
finally {
FileUtils.close(r);
}
|
protected void | setUp()
configureProject("src/etc/testcases/taskdefs/style/build.xml");
//executeTarget("setup");
//commented out for performance while target is empty
|
protected void | tearDown()
executeTarget("teardown");
|
public void | testCustomMapper()
assertTrue(!FILE_UTILS.resolveFile(
getProject().getBaseDir(), "out/out.xml").exists());
expectFileContains("testCustomMapper",
"out/out.xml",
"set='myvalue'");
|
public void | testDefaultMapper()
testDefaultMapper("testDefaultMapper");
|
public void | testDefaultMapper(java.lang.String target)
assertTrue(!(FileUtils.getFileUtils().resolveFile(
getProject().getBaseDir(),"out/data.html")).exists());
expectFileContains(target,
"out/data.html",
"set='myvalue'");
|
public void | testDirectoryHierarchyWithDirMatching()
executeTarget("testDirectoryHierarchyWithDirMatching");
assertTrue(FILE_UTILS.resolveFile(
getProject().getBaseDir(), "out/dest/level1/data.html")
.exists());
|
public void | testDirsWithSpaces()
executeTarget("testDirsWithSpaces");
assertTrue(FILE_UTILS.resolveFile(
getProject().getBaseDir(), "out/d est/data.html")
.exists());
|
public void | testExplicitFileset()
testDefaultMapper("testExplicitFileset");
|
public void | testFilenameAndFiledirAsParam()
executeTarget("testFilenameAndFiledirAsParam");
assertFileContains("out/out/one.txt", "filename='one.xml'");
assertFileContains("out/out/one.txt", "filedir ='.'");
assertFileContains("out/out/dir/four.txt", "filename='four.xml'");
assertFileContains("out/out/dir/four.txt", "filedir ='dir'");
|
public void | testFilenameAsParam()
executeTarget("testFilenameAsParam");
assertFileContains("out/out/one.txt", "filename='one.xml'");
assertFileContains("out/out/two.txt", "filename='two.xml'");
assertFileContains("out/out/three.txt", "filename='three.xml'");
assertFileContains("out/out/dir/four.txt", "filename='four.xml'");
assertFileContains("out/out/dir/four.txt", "filedir ='-not-set-'");
|
public void | testFilenameAsParamNoSetting()
executeTarget("testFilenameAsParamNoSetting");
assertFileContains("out/out/one.txt", "filename='-not-set-'");
assertFileContains("out/out/two.txt", "filename='-not-set-'");
assertFileContains("out/out/three.txt", "filename='-not-set-'");
assertFileContains("out/out/dir/four.txt", "filename='-not-set-'");
|
public void | testNewerStylesheet()
expectFileContains("testNewerStylesheet",
"out/out.xml",
"new-value");
|
public void | testStyleIsSet()
expectSpecificBuildException("testStyleIsSet",
"no stylesheet specified", "specify the " +
"stylesheet either as a filename in style " +
"attribute or as a nested resource");
|
public void | testTransferParameterEmpty()
expectFileContains("testTransferParameterEmpty",
"out/out.xml",
"empty=''");
|
public void | testTransferParameterSet()
expectFileContains("testTransferParameterSet", // target
"out/out.xml", // file
"set='myvalue'"); // exptected string
|
public void | testTransferParameterUnset()
expectFileContains("testTransferParameterUnset",
"out/out.xml",
"undefined='${value}'");
|
public void | testTransferParameterUnsetWithIf()
expectFileContains("testTransferParameterUnsetWithIf",
"out/out.xml",
"undefined='undefined default value'");
|
public void | testTypedMapper()
assertTrue(!FILE_UTILS.resolveFile(
getProject().getBaseDir(), "out/out.xml").exists());
expectFileContains("testTypedMapper",
"out/out.xml",
"set='myvalue'");
|
public void | testWithFileResource()
expectFileContains("testWithFileResource", "out/out.xml", "set='value'");
|
public void | testWithStyleAttrAndResource()
expectSpecificBuildException("testWithStyleAttrAndResource",
"Must throws a BuildException", "specify the " +
"stylesheet either as a filename in style " +
"attribute or as a nested resource but not " +
"as both");
|
public void | testWithUrlResource()
expectFileContains("testWithUrlResource", "out/out.xml", "set='value'");
|