commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1196950 - in /commons/proper/compress/trunk/src/test: java/org/apache/commons/compress/compressors/XZTestCase.java resources/bla.tar.xz
Date Thu, 03 Nov 2011 05:53:32 GMT
Author: bodewig
Date: Thu Nov  3 05:53:31 2011
New Revision: 1196950

URL: http://svn.apache.org/viewvc?rev=1196950&view=rev
Log:
Initial test for XZ.  COMPRESS-156

Added:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
      - copied, changed from r1196949, commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
    commons/proper/compress/trunk/src/test/resources/bla.tar.xz   (with props)

Copied: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
(from r1196949, commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java)
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java?p2=commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java&p1=commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java&r1=1196949&r2=1196950&rev=1196950&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/XZTestCase.java
Thu Nov  3 05:53:31 2011
@@ -30,15 +30,15 @@ import java.io.OutputStream;
 import org.apache.commons.compress.AbstractTestCase;
 import org.apache.commons.compress.utils.IOUtils;
 
-public final class GZipTestCase extends AbstractTestCase {
+public final class XZTestCase extends AbstractTestCase {
 
-    public void testGzipCreation()  throws Exception {
+    public void testXZCreation()  throws Exception {
         final File input = getFile("test1.xml");
-        final File output = new File(dir, "test1.xml.gz");
+        final File output = new File(dir, "test1.xml.xz");
         final OutputStream out = new FileOutputStream(output);
         try {
             final CompressorOutputStream cos = new CompressorStreamFactory()
-                .createCompressorOutputStream("gz", out);
+                .createCompressorOutputStream("xz", out);
             try {
                 IOUtils.copy(new FileInputStream(input), cos);
             } finally {
@@ -49,13 +49,13 @@ public final class GZipTestCase extends 
         }
     }
 
-    public void testGzipUnarchive() throws Exception {
-        final File input = getFile("bla.tgz");
+    public void testXZUnarchive() throws Exception {
+        final File input = getFile("bla.tar.xz");
         final File output = new File(dir, "bla.tar");
         final InputStream is = new FileInputStream(input);
         try {
             final CompressorInputStream in = new CompressorStreamFactory()
-                .createCompressorInputStream("gz", is);
+                .createCompressorInputStream("xz", is);
             FileOutputStream out = null;
             try {
                 out = new FileOutputStream(output);
@@ -71,43 +71,4 @@ public final class GZipTestCase extends 
         }
     }
 
-    /**
-     * @see "https://issues.apache.org/jira/browse/COMPRESS-84"
-     */
-    public void testCorruptedInput() throws Exception {
-        InputStream in = null;
-        OutputStream out = null;
-        CompressorInputStream cin = null;
-        try {
-            in = new FileInputStream(getFile("bla.tgz"));
-            out = new ByteArrayOutputStream();
-            IOUtils.copy(in, out);
-            in.close();
-            out.close();
-
-            byte[] data = ((ByteArrayOutputStream) out).toByteArray();
-            in = new ByteArrayInputStream(data, 0, data.length - 1);
-            cin = new CompressorStreamFactory()
-                .createCompressorInputStream("gz", in);
-            out = new ByteArrayOutputStream();
-
-            try {
-                IOUtils.copy(cin, out);
-                fail("Expected an exception");
-            } catch (IOException ioex) {
-                // the whole point of the test
-            }
-
-        } finally {
-            if (out != null) {
-                out.close();
-            }
-            if (cin != null) {
-                cin.close();
-            }
-            if (in != null) {
-                in.close();
-            }
-        }
-    }
 }

Added: commons/proper/compress/trunk/src/test/resources/bla.tar.xz
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/bla.tar.xz?rev=1196950&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/compress/trunk/src/test/resources/bla.tar.xz
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message