Source Code Cross Referenced for UnzipTest.java in  » Build » ANT » org » apache » tools » ant » taskdefs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » ANT » org.apache.tools.ant.taskdefs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:
019:        package org.apache.tools.ant.taskdefs;
020:
021:        import org.apache.tools.ant.BuildFileTest;
022:        import org.apache.tools.ant.util.FileUtils;
023:
024:        import java.io.IOException;
025:
026:        /**
027:         */
028:        public class UnzipTest extends BuildFileTest {
029:
030:            /** Utilities used for file operations */
031:            private static final FileUtils FILE_UTILS = FileUtils
032:                    .getFileUtils();
033:
034:            public UnzipTest(String name) {
035:                super (name);
036:            }
037:
038:            public void setUp() {
039:                configureProject("src/etc/testcases/taskdefs/unzip.xml");
040:            }
041:
042:            public void tearDown() {
043:                executeTarget("cleanup");
044:            }
045:
046:            public void test1() {
047:                expectBuildException("test1", "required argument not specified");
048:            }
049:
050:            public void test2() {
051:                expectBuildException("test2", "required argument not specified");
052:            }
053:
054:            public void test3() {
055:                expectBuildException("test3", "required argument not specified");
056:            }
057:
058:            public void testRealTest() throws java.io.IOException {
059:                executeTarget("realTest");
060:                assertLogoUncorrupted();
061:            }
062:
063:            /**
064:             * test that the logo gif file has not been corrupted
065:             * @throws IOException
066:             */
067:            private void assertLogoUncorrupted() throws IOException {
068:                assertTrue(FILE_UTILS.contentEquals(project
069:                        .resolveFile("../asf-logo.gif"), project
070:                        .resolveFile("asf-logo.gif")));
071:            }
072:
073:            public void testTestZipTask() throws java.io.IOException {
074:                executeTarget("testZipTask");
075:                assertLogoUncorrupted();
076:            }
077:
078:            public void testTestUncompressedZipTask()
079:                    throws java.io.IOException {
080:                executeTarget("testUncompressedZipTask");
081:                assertLogoUncorrupted();
082:            }
083:
084:            /*
085:             * PR 11100
086:             */
087:            public void testPatternSetExcludeOnly() {
088:                executeTarget("testPatternSetExcludeOnly");
089:                assertFileMissing("1/foo is excluded", "unziptestout/1/foo");
090:                assertFileExists("2/bar is not excluded", "unziptestout/2/bar");
091:            }
092:
093:            /*
094:             * PR 11100
095:             */
096:            public void testPatternSetIncludeOnly() {
097:                executeTarget("testPatternSetIncludeOnly");
098:                assertFileMissing("1/foo is not included", "unziptestout/1/foo");
099:                assertFileExists("2/bar is included", "unziptestout/2/bar");
100:            }
101:
102:            /*
103:             * PR 11100
104:             */
105:            public void testPatternSetIncludeAndExclude() {
106:                executeTarget("testPatternSetIncludeAndExclude");
107:                assertFileMissing("1/foo is not included", "unziptestout/1/foo");
108:                assertFileMissing("2/bar is excluded", "unziptestout/2/bar");
109:            }
110:
111:            /*
112:             * PR 38973
113:             */
114:            public void testTwoPatternSets() {
115:                executeTarget("testTwoPatternSets");
116:                assertFileMissing("1/foo is not included", "unziptestout/1/foo");
117:                assertFileExists("2/bar is included", "unziptestout/2/bar");
118:            }
119:
120:            /*
121:             * PR 38973
122:             */
123:            public void testTwoPatternSetsWithExcludes() {
124:                executeTarget("testTwoPatternSetsWithExcludes");
125:                assertFileMissing("1/foo is not included", "unziptestout/1/foo");
126:                assertFileMissing("2/bar is excluded", "unziptestout/2/bar");
127:            }
128:
129:            /*
130:             * PR 16213
131:             */
132:            public void testSelfExtractingArchive() {
133:                executeTarget("selfExtractingArchive");
134:            }
135:
136:            /*
137:             * PR 20969
138:             */
139:            public void testPatternSetSlashOnly() {
140:                executeTarget("testPatternSetSlashOnly");
141:                assertFileMissing("1/foo is not included", "unziptestout/1/foo");
142:                assertFileExists("\"2/bar is included", "unziptestout/2/bar");
143:            }
144:
145:            /*
146:             * PR 10504
147:             */
148:            public void testEncoding() {
149:                executeTarget("encodingTest");
150:                assertFileExists("foo has been properly named",
151:                        "unziptestout/foo");
152:            }
153:
154:            /*
155:             * PR 21996
156:             */
157:            public void testFlattenMapper() {
158:                executeTarget("testFlattenMapper");
159:                assertFileMissing("1/foo is not flattened",
160:                        "unziptestout/1/foo");
161:                assertFileExists("foo is flattened", "unziptestout/foo");
162:            }
163:
164:            /**
165:             * assert that a file exists, relative to the project
166:             * @param message message if there is no mpatch
167:             * @param filename filename to resolve against the project
168:             */
169:            private void assertFileExists(String message, String filename) {
170:                assertTrue(message, getProject().resolveFile(filename).exists());
171:            }
172:
173:            /**
174:             * assert that a file doesnt exist, relative to the project
175:             *
176:             * @param message  message if there is no mpatch
177:             * @param filename filename to resolve against the project
178:             */
179:            private void assertFileMissing(String message, String filename) {
180:                assertTrue(message, !getProject().resolveFile(filename)
181:                        .exists());
182:            }
183:
184:            /**
185:             * PR 21996
186:             */
187:            public void testGlobMapper() {
188:                executeTarget("testGlobMapper");
189:                assertFileMissing("1/foo is not mapped", "unziptestout/1/foo");
190:                assertFileExists("1/foo is mapped", "unziptestout/1/foo.txt");
191:            }
192:
193:            public void testTwoMappers() {
194:                expectBuildException("testTwoMappers",
195:                        Expand.ERROR_MULTIPLE_MAPPERS);
196:            }
197:
198:            public void testResourceCollections() {
199:                executeTarget("testResourceCollection");
200:                assertFileExists("junit.jar has been extracted",
201:                        "unziptestout/junit/framework/Assert.class");
202:            }
203:
204:            public void testDocumentationClaimsOnCopy() {
205:                executeTarget("testDocumentationClaimsOnCopy");
206:                assertFileMissing("1/foo is excluded", "unziptestout/1/foo");
207:                assertFileExists("2/bar is not excluded", "unziptestout/2/bar");
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.