From commits-return-23311-apmail-commons-commits-archive=commons.apache.org@commons.apache.org Thu Nov 3 05:53:56 2011 Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5F7F67C76 for ; Thu, 3 Nov 2011 05:53:56 +0000 (UTC) Received: (qmail 40197 invoked by uid 500); 3 Nov 2011 05:53:55 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 39894 invoked by uid 500); 3 Nov 2011 05:53:55 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 39846 invoked by uid 99); 3 Nov 2011 05:53:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2011 05:53:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Nov 2011 05:53:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 533452388D61 for ; Thu, 3 Nov 2011 05:53:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111103055332.533452388D61@eris.apache.org> 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