KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 2000-2002,2004 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
18 package org.apache.tools.ant.taskdefs;
19 import org.apache.tools.ant.BuildFileTest;
20
21 /**
22  */

23 public class TarTest extends BuildFileTest {
24
25     public TarTest(String JavaDoc name) {
26         super(name);
27     }
28
29     public void setUp() {
30         configureProject("src/etc/testcases/taskdefs/tar.xml");
31     }
32
33     public void test1() {
34         expectBuildException("test1", "required argument not specified");
35     }
36
37     public void test2() {
38         expectBuildException("test2", "required argument not specified");
39     }
40
41     public void test3() {
42         expectBuildException("test3", "required argument not specified");
43     }
44
45     public void test4() {
46         expectBuildException("test4", "tar cannot include itself");
47     }
48
49     public void test5() {
50         executeTarget("test5");
51         java.io.File JavaDoc f
52             = new java.io.File JavaDoc("src/etc/testcases/taskdefs/test5.tar");
53
54         if (!f.exists()) {
55             fail("Tarring a directory failed");
56         }
57     }
58
59     public void test6() {
60         expectBuildException("test6", "Invalid value specified for longfile attribute.");
61     }
62
63     public void test7() {
64         executeTarget("test7");
65         java.io.File JavaDoc f1
66             = new java.io.File JavaDoc("src/etc/testcases/taskdefs/test7-prefix");
67
68         if (!(f1.exists() && f1.isDirectory())) {
69             fail("The prefix attribute is not working properly.");
70         }
71
72         java.io.File JavaDoc f2
73             = new java.io.File JavaDoc("src/etc/testcases/taskdefs/test7dir");
74
75         if (!(f2.exists() && f2.isDirectory())) {
76             fail("The prefix attribute is not working properly.");
77         }
78     }
79
80     public void test8() {
81         executeTarget("test8");
82         java.io.File JavaDoc f1
83             = new java.io.File JavaDoc("src/etc/testcases/taskdefs/test8.xml");
84         if (! f1.exists()) {
85             fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly");
86         }
87     }
88
89     public void test9() {
90         expectBuildException("test9", "Invalid value specified for compression attribute.");
91     }
92
93     public void test10() {
94         executeTarget("test10");
95         java.io.File JavaDoc f1
96             = new java.io.File JavaDoc("src/etc/testcases/taskdefs/test10.xml");
97         if (! f1.exists()) {
98             fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly");
99         }
100     }
101
102     public void test11() {
103         executeTarget("test11");
104         java.io.File JavaDoc f1
105             = new java.io.File JavaDoc("src/etc/testcases/taskdefs/test11.xml");
106         if (! f1.exists()) {
107             fail("The fullpath attribute or the preserveLeadingSlashes attribute does not work propertly");
108         }
109     }
110
111
112     public void tearDown() {
113         executeTarget("cleanup");
114     }
115 }
116
Popular Tags