KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > UntarTest


1 /*
2  * Copyright 2001-2005 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

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 /**
23  */

24 public class UntarTest extends BuildFileTest {
25
26     public UntarTest(String JavaDoc 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 JavaDoc {
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 JavaDoc {
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 JavaDoc {
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 JavaDoc {
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 JavaDoc {
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 JavaDoc {
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