commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1426276 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
Date Thu, 27 Dec 2012 18:04:18 GMT
Author: bodewig
Date: Thu Dec 27 18:04:18 2012
New Revision: 1426276

URL: http://svn.apache.org/viewvc?rev=1426276&view=rev
Log:
COMPRESS-200 - passing test case, will ask for more info

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java?rev=1426276&r1=1426275&r2=1426276&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
Thu Dec 27 18:04:18 2012
@@ -337,4 +337,39 @@ public class TarArchiveOutputStreamTest 
         tin.close();
     }
 
-}
\ No newline at end of file
+    /**
+     * @see https://issues.apache.org/jira/browse/COMPRESS-200
+     */
+    public void testRoundtripWith66CharFileNameGnu() throws Exception {
+        testRoundtripWith66CharFileName(TarArchiveOutputStream.LONGFILE_GNU);
+    }
+
+    /**
+     * @see https://issues.apache.org/jira/browse/COMPRESS-200
+     */
+    public void testRoundtripWith66CharFileNamePosix() throws Exception {
+        testRoundtripWith66CharFileName(TarArchiveOutputStream.LONGFILE_POSIX);
+    }
+
+    private void testRoundtripWith66CharFileName(int mode) throws Exception {
+        String n = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+            + "AAAAAAA";
+        assertEquals(67, n.length());
+        TarArchiveEntry t = new TarArchiveEntry(n);
+        t.setSize(10 * 1024);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
+        tos.setLongFileMode(mode);
+        tos.putArchiveEntry(t);
+        tos.write(new byte[10 * 1024]);
+        tos.closeArchiveEntry();
+        byte[] data = bos.toByteArray();
+        TarArchiveInputStream tin =
+            new TarArchiveInputStream(new ByteArrayInputStream(data));
+        TarArchiveEntry e = tin.getNextTarEntry();
+        assertEquals(n, e.getName());
+        tin.close();
+        tos.close();
+    }
+
+}



Mime
View raw message