1 17 package org.apache.tools.ant.taskdefs; 18 19 import org.apache.tools.ant.BuildFileTest; 20 import org.apache.tools.ant.util.FileUtils; 21 22 24 public class UntarTest extends BuildFileTest { 25 26 public UntarTest(String name) { 27 super(name); 28 } 29 30 public void setUp() { 31 configureProject("src/etc/testcases/taskdefs/untar.xml"); 32 } 33 34 public void tearDown() { 35 executeTarget("cleanup"); 36 } 37 38 public void testRealTest() throws java.io.IOException { 39 FileUtils fileUtils = FileUtils.newFileUtils(); 40 executeTarget("realTest"); 41 assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), 42 project.resolveFile("asf-logo.gif"))); 43 } 44 45 public void testRealGzipTest() throws java.io.IOException { 46 FileUtils fileUtils = FileUtils.newFileUtils(); 47 executeTarget("realGzipTest"); 48 assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), 49 project.resolveFile("asf-logo.gif"))); 50 } 51 52 public void testRealBzip2Test() throws java.io.IOException { 53 FileUtils fileUtils = FileUtils.newFileUtils(); 54 executeTarget("realBzip2Test"); 55 assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), 56 project.resolveFile("asf-logo.gif"))); 57 } 58 59 public void testTestTarTask() throws java.io.IOException { 60 FileUtils fileUtils = FileUtils.newFileUtils(); 61 executeTarget("testTarTask"); 62 assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), 63 project.resolveFile("asf-logo.gif"))); 64 } 65 66 public void testTestGzipTarTask() throws java.io.IOException { 67 FileUtils fileUtils = FileUtils.newFileUtils(); 68 executeTarget("testGzipTarTask"); 69 assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), 70 project.resolveFile("asf-logo.gif"))); 71 } 72 73 public void testTestBzip2TarTask() throws java.io.IOException { 74 FileUtils fileUtils = FileUtils.newFileUtils(); 75 executeTarget("testBzip2TarTask"); 76 assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), 77 project.resolveFile("asf-logo.gif"))); 78 } 79 80 public void testSrcDirTest() { 81 expectBuildException("srcDirTest", "Src cannot be a directory."); 82 } 83 84 public void testEncoding() { 85 expectSpecificBuildException("encoding", 86 "<untar> overrides setEncoding.", 87 "The untar task doesn't support the " 88 + "encoding attribute"); 89 } 90 91 } 92 | Popular Tags |