commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1511806 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
Date Thu, 08 Aug 2013 14:33:06 GMT
Author: bodewig
Date: Thu Aug  8 14:33:06 2013
New Revision: 1511806

URL: http://svn.apache.org/r1511806
Log:
verify TarArchiveOutputStream is a "well-behaving citizen" and pads the output

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=1511806&r1=1511805&r2=1511806&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 Aug  8 14:33:06 2013
@@ -32,6 +32,7 @@ import org.apache.commons.compress.Abstr
 import org.apache.commons.compress.archivers.ArchiveOutputStream;
 import org.apache.commons.compress.archivers.ArchiveStreamFactory;
 import org.apache.commons.compress.utils.CharsetNames;
+import org.apache.commons.compress.utils.IOUtils;
 
 public class TarArchiveOutputStreamTest extends AbstractTestCase {
 
@@ -467,4 +468,21 @@ public class TarArchiveOutputStreamTest 
         tin.close();
     }
 
+    public void testPadsOutputToFullBlockLength() throws Exception {
+        File f = File.createTempFile("commons-compress-padding", ".tar");
+        f.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(f);
+        TarArchiveOutputStream tos = new TarArchiveOutputStream(fos);
+        File file1 = getFile("test1.xml");
+        TarArchiveEntry sEntry = new TarArchiveEntry(file1);
+        tos.putArchiveEntry(sEntry);
+        FileInputStream in = new FileInputStream(file1);
+        IOUtils.copy(in, tos);
+        in.close();
+        tos.closeArchiveEntry();
+        tos.close();
+        // test1.xml is small enough to fit into the default blockv size
+        assertEquals(TarBuffer.DEFAULT_BLKSIZE, f.length());
+    }
+
 }



Mime
View raw message