You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/11/17 16:47:07 UTC

svn commit: r718263 - in /ant/core/trunk/src: main/org/apache/tools/ant/types/resources/MappedResource.java tests/antunit/taskdefs/zip-test.xml

Author: bodewig
Date: Mon Nov 17 07:47:07 2008
New Revision: 718263

URL: http://svn.apache.org/viewvc?rev=718263&view=rev
Log:
yes, mapperesources work inside <zip>

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java
    ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java?rev=718263&r1=718262&r2=718263&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/MappedResource.java Mon Nov 17 07:47:07 2008
@@ -30,7 +30,7 @@
  * dynamically remap the resource's name.
  *
  * <p>Strips the FileProvider interface from decorated resources since
- * it may be used to circomvent name mapping.</p>
+ * it may be used to circumvent name mapping.</p>
  *
  * <p>Overwrites all setters to throw exceptions.</p>
  *

Modified: ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml?rev=718263&r1=718262&r2=718263&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/zip-test.xml Mon Nov 17 07:47:07 2008
@@ -27,4 +27,37 @@
     <unzip src="${output}/test.zip" dest="${output}/bar"/>
     <au:assertFileExists file="${output}/bar/foo"/>
   </target>
+
+  <target name="testMappedResources">
+    <mkdir dir="${input}"/>
+    <mkdir dir="${output}/out"/>
+    <echo file="${input}/foo.txt">Hello, world!</echo>
+    <zip destfile="${output}/test.zip">
+      <mappedresources>
+        <fileset dir="${input}"/>
+        <globmapper from="foo.*" to="bar.*"/>
+      </mappedresources>
+    </zip>
+    <unzip src="${output}/test.zip" dest="${output}/out"/>
+    <au:assertFileDoesntExist file="${output}/out/foo.txt"/>
+    <au:assertFileExists file="${output}/out/bar.txt"/>
+    <au:assertFilesMatch expected="${input}/foo.txt"
+                         actual="${output}/out/bar.txt"/>
+  </target>
+
+  <target name="testMappedClasspath">
+    <mkdir dir="${input}"/>
+    <mkdir dir="${output}/out"/>
+    <zip destfile="${output}/test.zip">
+      <mappedresources>
+        <path path="${java.class.path}"/>
+        <chainedmapper>
+          <flattenmapper/>
+          <globmapper from="*" to="WEB-INF/lib/*"/>
+        </chainedmapper>
+      </mappedresources>
+    </zip>
+    <unzip src="${output}/test.zip" dest="${output}/out"/>
+    <au:assertFileExists file="${output}/out/WEB-INF/lib/ant.jar"/>
+  </target>
 </project>