|
|
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs; |
|
|
|
import org.apache.tools.ant.BuildFileTest; |
|
|
|
import org.apache.tools.ant.util.FileUtils; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileReader; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
/** |
|
|
@@ -146,4 +147,63 @@ public class CopyTest extends BuildFileTest { |
|
|
|
expectBuildException("testMissingDirBail", "not-there doesn't exist"); |
|
|
|
assertTrue(getBuildException().getMessage().endsWith(" not found.")); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testFileResourcePlain() { |
|
|
|
executeTarget("testFileResourcePlain"); |
|
|
|
File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt"); |
|
|
|
File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt"); |
|
|
|
File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt"); |
|
|
|
assertTrue(file1.exists()); |
|
|
|
assertTrue(file2.exists()); |
|
|
|
assertTrue(file3.exists()); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testFileResourceWithMapper() { |
|
|
|
executeTarget("testFileResourceWithMapper"); |
|
|
|
File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt.bak"); |
|
|
|
File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt.bak"); |
|
|
|
File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt.bak"); |
|
|
|
assertTrue(file1.exists()); |
|
|
|
assertTrue(file2.exists()); |
|
|
|
assertTrue(file3.exists()); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testFileResourceWithFilter() { |
|
|
|
executeTarget("testFileResourceWithFilter"); |
|
|
|
File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/fileNR.txt"); |
|
|
|
assertTrue(file1.exists()); |
|
|
|
try { |
|
|
|
String file1Content = FILE_UTILS.readFully(new FileReader(file1)); |
|
|
|
assertEquals(file1Content, "This is file 42"); |
|
|
|
} catch (IOException e) { |
|
|
|
// no-op: not a real business error |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void _testPathAsResource() { |
|
|
|
executeTarget("testPathAsResource"); |
|
|
|
File file1 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file1.txt.bak"); |
|
|
|
File file2 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file2.txt.bak"); |
|
|
|
File file3 = new File(getProjectDir(), getProject().getProperty("to.dir")+"/file3.txt.bak"); |
|
|
|
assertTrue(file1.exists()); |
|
|
|
assertTrue(file2.exists()); |
|
|
|
assertTrue(file3.exists()); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testResourcePlain() { |
|
|
|
executeTarget("testResourcePlain"); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testResourcePlainWithMapper() { |
|
|
|
executeTarget("testResourcePlainWithMapper"); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testResourcePlainWithFilter() { |
|
|
|
executeTarget("testResourcePlainWithFilter"); |
|
|
|
} |
|
|
|
|
|
|
|
public void _testOnlineResources() { |
|
|
|
executeTarget("testOnlineResources"); |
|
|
|
} |
|
|
|
|
|
|
|
} |