1 17 18 package org.apache.tools.ant.taskdefs; 19 20 import org.apache.tools.ant.BuildFileTest; 21 import org.apache.tools.ant.Project; 22 import org.apache.tools.ant.util.FileUtils; 23 import java.io.File ; 24 import java.io.IOException ; 25 26 30 public class MoveTest extends BuildFileTest { 31 32 public MoveTest(String name) { 33 super(name); 34 } 35 36 public void setUp() { 37 configureProject("src/etc/testcases/taskdefs/move.xml"); 38 } 39 40 public void tearDown() { 41 executeTarget("cleanup"); 42 } 43 44 public void testFilterSet() throws IOException { 45 executeTarget("testFilterSet"); 46 FileUtils fileUtils = FileUtils.newFileUtils(); 47 File tmp = new File (getProjectDir(), "move.filterset.tmp"); 48 File check = new File (getProjectDir(), "expected/copy.filterset.filtered"); 49 assertTrue(tmp.exists()); 50 assertTrue(fileUtils.contentEquals(tmp, check)); 51 } 52 53 public void testFilterChain() throws IOException { 54 executeTarget("testFilterChain"); 55 FileUtils fileUtils = FileUtils.newFileUtils(); 56 File tmp = new File (getProjectDir(), "move.filterchain.tmp"); 57 File check = new File (getProjectDir(), "expected/copy.filterset.filtered"); 58 assertTrue(tmp.exists()); 59 assertTrue(fileUtils.contentEquals(tmp, check)); 60 } 61 62 63 public void testDirectoryRemoval() throws IOException { 64 executeTarget("testDirectoryRemoval"); 65 assertTrue(!getProject().resolveFile("E/B/1").exists()); 66 assertTrue(getProject().resolveFile("E/C/2").exists()); 67 assertTrue(getProject().resolveFile("E/D/3").exists()); 68 assertTrue(getProject().resolveFile("A/B/1").exists()); 69 assertTrue(!getProject().resolveFile("A/C/2").exists()); 70 assertTrue(!getProject().resolveFile("A/D/3").exists()); 71 assertTrue(!getProject().resolveFile("A/C").exists()); 72 assertTrue(!getProject().resolveFile("A/D").exists()); 73 } 74 75 76 public void testDirectoryRetaining() throws IOException { 77 executeTarget("testDirectoryRetaining"); 78 assertTrue(getProject().resolveFile("E").exists()); 79 assertTrue(getProject().resolveFile("E/1").exists()); 80 assertTrue(!getProject().resolveFile("A/1").exists()); 81 assertTrue(getProject().resolveFile("A").exists()); 82 } 83 84 public void testCompleteDirectoryMove() throws IOException { 85 executeTarget("testCompleteDirectoryMove"); 86 assertTrue(getProject().resolveFile("E").exists()); 87 assertTrue(getProject().resolveFile("E/1").exists()); 88 assertTrue(!getProject().resolveFile("A/1").exists()); 89 assertTrue(!getProject().resolveFile("A").exists()); 90 } 91 92 public void testMoveFileAndFileset() { 93 executeTarget("testMoveFileAndFileset"); 94 } 95 96 public void testCompleteDirectoryMoveToExistingDir() { 97 executeTarget("testCompleteDirectoryMoveToExistingDir"); 98 } 99 100 public void testCompleteDirectoryMoveFileToFile() { 101 executeTarget("testCompleteDirectoryMoveFileToFile"); 102 } 103 104 public void testCompleteDirectoryMoveFileToDir() { 105 executeTarget("testCompleteDirectoryMoveFileToDir"); 106 } 107 108 public void testCompleteDirectoryMoveFileAndFileset() { 109 executeTarget("testCompleteDirectoryMoveFileAndFileset"); 110 } 111 112 public void testCompleteDirectoryMoveFileToExistingFile() { 113 executeTarget("testCompleteDirectoryMoveFileToExistingFile"); 114 } 115 116 public void testCompleteDirectoryMoveFileToExistingDir() { 117 executeTarget("testCompleteDirectoryMoveFileToExistingDir"); 118 } 119 120 public void testCompleteDirectoryMoveFileToDirWithExistingFile() { 121 executeTarget("testCompleteDirectoryMoveFileToDirWithExistingFile"); 122 } 123 124 public void testCompleteDirectoryMoveFileToDirWithExistingDir() { 125 executeTarget("testCompleteDirectoryMoveFileToDirWithExistingDir"); 126 } 127 128 } 129 | Popular Tags |