Author: bodewig
Date: Thu Aug 27 04:18:11 2009
New Revision: 808278

URL: http://svn.apache.org/viewvc?rev=808278&view=rev
Log:
gunzip and bunzip2 tasks

Added:
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java
   (with props)
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java
   (with props)
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
   (contents, props changed)
      - copied, changed from r808260, 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/GUnzip.java
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java
   (with props)
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
      - copied, changed from r808274, 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java
   (with props)
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml   
(contents, props changed)
      - copied, changed from r808260, 
ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml   
(contents, props changed)
      - copied, changed from r808260, 
ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml
    
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo-huge.tar.bz2   
(props changed)
      - copied unchanged from r808260, 
ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo-huge.tar.bz2
    ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.bz2   
(props changed)
      - copied unchanged from r808260, 
ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo.gif.bz2
    ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.gz   
(props changed)
      - copied unchanged from r808260, 
ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo.gif.gz
Modified:
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml

Modified: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml?rev=808278&r1=808277&r2=808278&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml 
(original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml 
Thu Aug 27 04:18:11 2009
@@ -48,6 +48,14 @@
     name="zip"
     classname="org.apache.ant.compress.taskdefs.Zip"
     />
+  <taskdef
+    name="gunzip"
+    classname="org.apache.ant.compress.taskdefs.GUnzip"
+    />
+  <taskdef
+    name="bunzip2"
+    classname="org.apache.ant.compress.taskdefs.BUnzip2"
+    />
 
   <typedef
     name="tarentry"

Added: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java?rev=808278&view=auto
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java
 (added)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java
 Thu Aug 27 04:18:11 2009
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import org.apache.ant.compress.util.BZip2StreamFactory;
+
+/**
+ * Expands a bzip2 archive.
+ */
+public final class BUnzip2 extends UnpackBase {
+
+    public BUnzip2() {
+        super(".bz2", new BZip2StreamFactory());
+    }
+
+}
\ No newline at end of file

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java?rev=808278&view=auto
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java
 (added)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java
 Thu Aug 27 04:18:11 2009
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.taskdefs;
+
+import org.apache.ant.compress.util.GZipStreamFactory;
+
+/**
+ * Expands a gzip archive.
+ */
+public final class GUnzip extends UnpackBase {
+
+    public GUnzip() {
+        super(".gz", new GZipStreamFactory());
+    }
+
+}
\ No newline at end of file

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
 (from r808260, 
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/GUnzip.java)
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java&p1=ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/GUnzip.java&r1=808260&r2=808278&rev=808278&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/GUnzip.java (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
 Thu Aug 27 04:18:11 2009
@@ -16,35 +16,40 @@
  *
  */
 
-package org.apache.tools.ant.taskdefs;
+package org.apache.ant.compress.taskdefs;
 
+import java.io.BufferedInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.zip.GZIPInputStream;
+
+import org.apache.ant.compress.util.CompressorStreamFactory;
+import org.apache.commons.compress.compressors.CompressorInputStream;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.taskdefs.Unpack;
 
 /**
- * Expands a file that has been compressed with the GZIP
- * algorithm. Normally used to compress non-compressed archives such
- * as TAR files.
- *
- * @since Ant 1.1
+ * Expands a resource that has been compressed.
  *
- * @ant.task category="packaging"
  */
-
-public class GUnzip extends Unpack {
+public abstract class UnpackBase extends Unpack {
     private static final int BUFFER_SIZE = 8 * 1024;
-    private static final String DEFAULT_EXTENSION = ".gz";
+
+    private final String defaultExtension;
+    private final CompressorStreamFactory factory;
+
+    protected UnpackBase(String defaultExtension,
+                         CompressorStreamFactory factory) {
+        this.defaultExtension = defaultExtension;
+        this.factory = factory;
+    }
 
     /**
      * Get the default extension.
-     * @return the value ".gz"
      */
-    protected String getDefaultExtension() {
-        return DEFAULT_EXTENSION;
+    protected final String getDefaultExtension() {
+        return defaultExtension;
     }
 
     /**
@@ -53,15 +58,15 @@
     protected void extract() {
         if (source.lastModified() > dest.lastModified()) {
             log("Expanding " + source.getAbsolutePath() + " to "
-                        + dest.getAbsolutePath());
+                + dest.getAbsolutePath());
 
             FileOutputStream out = null;
-            GZIPInputStream zIn = null;
+            CompressorInputStream zIn = null;
             InputStream fis = null;
             try {
                 out = new FileOutputStream(dest);
                 fis = srcResource.getInputStream();
-                zIn = new GZIPInputStream(fis);
+                zIn = factory.getCompressorStream(new 
BufferedInputStream(fis));
                 byte[] buffer = new byte[BUFFER_SIZE];
                 int count = 0;
                 do {
@@ -69,7 +74,7 @@
                     count = zIn.read(buffer, 0, buffer.length);
                 } while (count != -1);
             } catch (IOException ioe) {
-                String msg = "Problem expanding gzip " + ioe.getMessage();
+                String msg = "Problem expanding " + ioe.getMessage();
                 throw new BuildException(msg, ioe, getLocation());
             } finally {
                 FileUtils.close(fis);
@@ -80,17 +85,9 @@
     }
 
     /**
-     * Whether this task can deal with non-file resources.
-     *
-     * <p>This implementation returns true only if this task is
-     * &lt;gunzip&gt;.  Any subclass of this class that also wants to
-     * support non-file resources needs to override this method.  We
-     * need to do so for backwards compatibility reasons since we
-     * can't expect subclasses to support resources.</p>
-     * @return true if this task supports non file resources.
-     * @since Ant 1.7
+     * Yes, we can.
      */
-    protected boolean supportsNonFileResources() {
-        return getClass().equals(GUnzip.class);
+    protected final boolean supportsNonFileResources() {
+        return true;
     }
 }

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java?rev=808278&view=auto
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java
 (added)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java
 Thu Aug 27 04:18:11 2009
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import 
org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
+import 
org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
+
+/**
+ * Creates streams for the supported compression formats.
+ */
+public class BZip2StreamFactory implements CompressorStreamFactory {
+
+    /**
+     * @param stream the stream to read from, should be buffered
+     */
+    public CompressorInputStream getCompressorStream(InputStream stream)
+        throws IOException {
+        return new BZip2CompressorInputStream(stream);
+    }
+
+
+    /**
+     * @param stream the stream to write to, should be buffered
+     */
+    public CompressorOutputStream getCompressorStream(OutputStream stream)
+        throws IOException {
+        return new BZip2CompressorOutputStream(stream);
+    }
+}
\ No newline at end of file

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
 (from r808274, 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java)
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java&r1=808274&r2=808278&rev=808278&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java
 (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java
 Thu Aug 27 04:18:11 2009
@@ -22,31 +22,25 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
-import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.ArchiveOutputStream;
+import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
 
 /**
- * Creates streams for the supported archive formats.
+ * Creates streams for the supported compression formats.
  */
-public interface ArchiveStreamFactory {
+public interface CompressorStreamFactory {
 
     /**
      * @param stream the stream to read from, should be buffered
-     * @param encoding the encoding of the entry names, ignored by all
-     * formats except zip
      */
-    public ArchiveInputStream getArchiveStream(InputStream stream,
-                                               String encoding)
+    public CompressorInputStream getCompressorStream(InputStream stream)
         throws IOException;
 
 
     /**
      * @param stream the stream to write to, should be buffered
-     * @param encoding the encoding of the entry names, ignored by all
-     * formats except zip
      */
-    public ArchiveOutputStream getArchiveStream(OutputStream stream,
-                                                String encoding)
+    public CompressorOutputStream getCompressorStream(OutputStream stream)
         throws IOException;
 
 }
\ No newline at end of file

Added: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java?rev=808278&view=auto
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java
 (added)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java
 Thu Aug 27 04:18:11 2009
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.ant.compress.util;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.compressors.CompressorOutputStream;
+import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
+import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
+
+/**
+ * Creates streams for the supported compression formats.
+ */
+public class GZipStreamFactory implements CompressorStreamFactory {
+
+    /**
+     * @param stream the stream to read from, should be buffered
+     */
+    public CompressorInputStream getCompressorStream(InputStream stream)
+        throws IOException {
+        return new GzipCompressorInputStream(stream);
+    }
+
+
+    /**
+     * @param stream the stream to write to, should be buffered
+     */
+    public CompressorOutputStream getCompressorStream(OutputStream stream)
+        throws IOException {
+        return new GzipCompressorOutputStream(stream);
+    }
+}
\ No newline at end of file

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml 
(from r808260, ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml)
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml&p1=ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml&r1=808260&r2=808278&rev=808278&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml Thu 
Aug 27 04:18:11 2009
@@ -16,33 +16,44 @@
   limitations under the License.
 -->
 
-<project basedir="." default="cleanup">
-
-  <target name="realTest">
-    <bunzip2 src="expected/asf-logo-huge.tar.bz2" dest="asf-logo-huge.tar" />
+<project default="antunit"
+         xmlns:au="antlib:org.apache.ant.antunit"
+         xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+         xmlns:cmp="antlib:org.apache.ant.compress">
+
+  <import file="antunit-base.xml" />
+
+  <target name="setUp">
+    <mkdir dir="${output}"/>
+  </target>    
+
+  <target name="testCoreBzip2Task" depends="setUp">
+    <bzip2 src="../resources/asf-logo.gif"
+           destfile="${output}/asf-logo.gif.bz2"/>
+    <cmp:bunzip2 src="${output}/asf-logo.gif.bz2"
+                 dest="${output}/asf-logo.gif" />
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
   </target>
 
-  <target name="realTestWithResource">
-    <bunzip2 dest="asf-logo-huge.tar">
-      <file file="expected/asf-logo-huge.tar.bz2"/>
-    </bunzip2>
+  <target name="testNativeBzip2" depends="setUp">
+    <cmp:bunzip2 src="../resources/asf-logo.gif.bz2"
+                 dest="${output}/asf-logo.gif" />
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
   </target>
 
-  <target name="cleanup">
-    <delete file="asf-logo-huge.tar" />
-    <delete file="expected/asf-logo-huge.tar" />
+  <target name="testWithResource" depends="setUp">
+    <cmp:bunzip2 dest="${output}/asf-logo.gif">
+      <file file="../resources/asf-logo.gif.bz2"/>
+    </cmp:bunzip2>
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
   </target>
 
-  <target name="prepare">
-    <gunzip src="expected/asf-logo-huge.tar.gz"/>
+  <target name="testHugeFile" depends="setUp">
+    <cmp:bunzip2 src="../resources/asf-logo-huge.tar.bz2"
+                 dest="${output}/asf-logo-huge.tar" />
   </target>
 
-  <target name="testDocumentationClaimsOnCopy">
-    <copy todir=".">
-      <bzip2resource>
-        <file file="expected/asf-logo-huge.tar.bz2"/>
-      </bzip2resource>
-      <mapper type="glob" from="*.bz2" to="*"/>
-    </copy>
-  </target>
-</project>
\ No newline at end of file
+</project>

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml 
(from r808260, ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml)
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml&p1=ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml&r1=808260&r2=808278&rev=808278&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml Thu 
Aug 27 04:18:11 2009
@@ -16,43 +16,49 @@
   limitations under the License.
 -->
 
-<project name="xxx-test" basedir="." default="test1">
+<project default="antunit"
+         xmlns:au="antlib:org.apache.ant.antunit"
+         xmlns:cond="antlib:org.apache.tools.ant.types.conditions"
+         xmlns:cmp="antlib:org.apache.ant.compress">
+
+  <import file="antunit-base.xml" />
+
+  <target name="setUp">
+    <mkdir dir="${output}"/>
+  </target>    
 
   <target name="test1">
-    <gunzip/>
+    <au:expectfailure>
+      <cmp:gunzip/>
+    </au:expectfailure>
   </target>
 
   <target name="test2">
-    <gunzip src=""/>
-  </target>
-
-  <target name="cleanup">
-    <delete file="asf-logo.gif" />
-  </target>
-
-  <target name="testGzipTask">
-    <ant antfile="gzip.xml" target="realTest" />
-    <gunzip src="asf-logo.gif.gz" dest="asf-logo.gif" />
-    <ant antfile="gzip.xml" target="cleanup" />
-  </target>
-
-  <target name="realTest">
-    <gunzip src="expected/asf-logo.gif.gz" dest="asf-logo.gif" />
-  </target>
-
-  <target name="realTestWithResource">
-    <gunzip dest="asf-logo.gif">
-      <file file="expected/asf-logo.gif.gz"/>
-    </gunzip>
-  </target>
-
-  <target name="testDocumentationClaimsOnCopy">
-    <copy todir=".">
-      <gzipresource>
-        <file file="expected/asf-logo.gif.gz"/>
-      </gzipresource>
-      <mapper type="glob" from="*.gz" to="*"/>
-    </copy>
+    <au:expectfailure>
+      <cmp:gunzip src=""/>
+    </au:expectfailure>
+  </target>
+
+  <target name="testCoreGzipTask" depends="setUp">
+    <gzip src="../resources/asf-logo.gif" 
destfile="${output}/asf-logo.gif.gz"/>
+    <cmp:gunzip src="${output}/asf-logo.gif.gz" dest="${output}/asf-logo.gif" 
/>
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
+  </target>
+
+  <target name="testNativeGzip" depends="setUp">
+    <cmp:gunzip src="../resources/asf-logo.gif.gz"
+                dest="${output}/asf-logo.gif" />
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
+  </target>
+
+  <target name="testWithResource" depends="setUp">
+    <cmp:gunzip dest="${output}/asf-logo.gif">
+      <file file="../resources/asf-logo.gif.gz"/>
+    </cmp:gunzip>
+    <au:assertFilesMatch expected="../resources/asf-logo.gif"
+                         actual="${output}/asf-logo.gif"/>
   </target>
 
 </project>

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo-huge.tar.bz2
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo-huge.tar.bz2
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.bz2
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.bz2
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.gz
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: 
ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.gz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to