ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r306519 - in /ant/core/trunk: docs/manual/CoreTasks/ src/etc/testcases/taskdefs/ src/testcases/org/apache/tools/ant/taskdefs/
Date Thu, 06 Oct 2005 03:49:42 GMT
Author: bodewig
Date: Wed Oct  5 20:49:34 2005
New Revision: 306519

URL: http://svn.apache.org/viewcvs?rev=306519&view=rev
Log:
docs and tests for unzip/tar and resource collections

Modified:
    ant/core/trunk/docs/manual/CoreTasks/unzip.html
    ant/core/trunk/src/etc/testcases/taskdefs/untar.xml
    ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml
    ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java
    ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java

Modified: ant/core/trunk/docs/manual/CoreTasks/unzip.html
URL: http://svn.apache.org/viewcvs/ant/core/trunk/docs/manual/CoreTasks/unzip.html?rev=306519&r1=306518&r2=306519&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/unzip.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/unzip.html Wed Oct  5 20:49:34 2005
@@ -14,9 +14,17 @@
 <p><a href="../CoreTypes/patternset.html">PatternSet</a>s are used to select
files to extract
 <I>from</I> the archive.  If no patternset is used, all files are extracted.
 </p>
-<p><a href="../CoreTypes/fileset.html">FileSet</a>s may be used to select
archived files
-to perform unarchival upon.
-</p>
+
+<p><a href="../CoreTypes/resources.html#collection">Resource
+Collection</a>s may be used to select archived files to perform
+unarchival upon.  Only file system based resource collections are
+supported by Unjar/Unwar/Unzip, this includes <a
+href="../CoreTypes/fileset.html">fileset</a>s, <a
+href="../CoreTypes/filelist.html">filelist</a> and <a
+href="../using.html#path">path</a>.  Untar supports arbitrary resource
+collections.  Prior to Ant 1.7 only fileset has been supported as a
+nested element.</p>
+
 <p>You can define filename transformations by using a nested <a href="../CoreTypes/mapper.html">mapper</a>
element.  The default mapper is the
 <a href="../CoreTypes/mapper.html#identity-mapper">identity mapper</a>.
 </p>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/untar.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/untar.xml?rev=306519&r1=306518&r2=306519&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/untar.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/untar.xml Wed Oct  5 20:49:34 2005
@@ -4,6 +4,7 @@
 
   <target name="cleanup">
     <delete file="asf-logo.gif" />
+    <delete dir="untartestout"/>
   </target>
 
   <target name="testTarTask">
@@ -43,5 +44,19 @@
 
   <target name="encoding">
     <untar src="expected/asf-logo.gif.tar" dest="." encoding="foo"/>
+  </target>
+
+  <target name="resourceCollection">
+    <mkdir dir="untartestout"/>
+    <zip destfile="untartestout/test.zip">
+      <fileset dir="expected">
+        <include name="asf-logo.gif.tar"/>
+      </fileset>
+    </zip>
+    <untar dest=".">
+      <zipfileset src="untartestout/test.zip">
+        <include name="*.tar"/>
+      </zipfileset>
+    </untar>
   </target>
 </project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml?rev=306519&r1=306518&r2=306519&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/unzip.xml Wed Oct  5 20:49:34 2005
@@ -122,4 +122,16 @@
       <mapper type="flatten"/>      
     </unzip>
   </target>
+
+  <target name="testResourceCollection">
+    <unzip dest="unziptestout">
+      <patternset>
+        <include name="junit/**"/>
+      </patternset>
+      <restrict>
+        <path path="${java.class.path}"/>
+        <type type="file" xmlns="antlib:org.apache.tools.ant.types.resources.selectors"/>
+      </restrict>
+    </unzip>
+  </target>
 </project>

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java?rev=306519&r1=306518&r2=306519&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UntarTest.java Wed Oct  5 20:49:34
2005
@@ -39,39 +39,27 @@
     }
 
     public void testRealTest() throws java.io.IOException {
-        executeTarget("realTest");
-        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
-                                           project.resolveFile("asf-logo.gif")));
+        testLogoExtraction("realTest");
     }
 
     public void testRealGzipTest() throws java.io.IOException {
-        executeTarget("realGzipTest");
-        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
-                                           project.resolveFile("asf-logo.gif")));
+        testLogoExtraction("realGzipTest");
     }
 
     public void testRealBzip2Test() throws java.io.IOException {
-        executeTarget("realBzip2Test");
-        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
-                                           project.resolveFile("asf-logo.gif")));
+        testLogoExtraction("realBzip2Test");
     }
 
     public void testTestTarTask() throws java.io.IOException {
-        executeTarget("testTarTask");
-        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
-                                           project.resolveFile("asf-logo.gif")));
+        testLogoExtraction("testTarTask");
     }
 
     public void testTestGzipTarTask() throws java.io.IOException {
-        executeTarget("testGzipTarTask");
-        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
-                                           project.resolveFile("asf-logo.gif")));
+        testLogoExtraction("testGzipTarTask");
     }
 
     public void testTestBzip2TarTask() throws java.io.IOException {
-        executeTarget("testBzip2TarTask");
-        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
-                                           project.resolveFile("asf-logo.gif")));
+        testLogoExtraction("testBzip2TarTask");
     }
 
     public void testSrcDirTest() {
@@ -85,4 +73,13 @@
                                      + "encoding attribute");
     }
 
+    public void testResourceCollection() throws java.io.IOException {
+        testLogoExtraction("resourceCollection");
+    }
+
+    private void testLogoExtraction(String target) throws java.io.IOException {
+        executeTarget(target);
+        assertTrue(FILE_UTILS.contentEquals(project.resolveFile("../asf-logo.gif"),
+                                           project.resolveFile("asf-logo.gif")));
+    }
 }

Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java?rev=306519&r1=306518&r2=306519&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java Wed Oct  5 20:49:34
2005
@@ -173,4 +173,9 @@
         expectBuildException("testTwoMappers",Expand.ERROR_MULTIPLE_MAPPERS);
     }
 
+    public void testResourceCollections() {
+        executeTarget("testResourceCollection");
+        assertFileExists("junit.jar has been extracted",
+                         "unziptestout/junit/framework/Assert.class");
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message