commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1153347 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
Date Wed, 03 Aug 2011 05:13:32 GMT
Author: bodewig
Date: Wed Aug  3 05:13:31 2011
New Revision: 1153347

URL: http://svn.apache.org/viewvc?rev=1153347&view=rev
Log:
hard-code compressed sizes in tests so there is a baseline to test against when I stop using
Deflater#getBytesWritten.  This assumes compressed sizes do not depend on platform or Java
version, will verify the same later.

Modified:
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java?rev=1153347&r1=1153346&r2=1153347&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
Wed Aug  3 05:13:31 2011
@@ -486,7 +486,6 @@ public class Zip64SupportTest {
      *
      * Creates a temporary archive of approx 4MB in size
      */
-    @Ignore
     @Test public void writeBigDeflatedEntryKnownSizeToStream()
         throws Throwable {
         withTemporaryArchive("writeBigDeflatedEntryKnownSizeToStream",
@@ -563,7 +562,7 @@ public class Zip64SupportTest {
                                                  // file name
                                                  (byte) '0'
                                              }, rest);
-                                         byte[] extra = new byte[12];
+                                         byte[] extra = new byte[20];
                                          a.readFully(extra);
                                          // 5e9 == 0x12A05F200
                                          assertArrayEquals(new byte[] {
@@ -574,10 +573,10 @@ public class Zip64SupportTest {
                                                  // original size
                                                  0, (byte) 0xF2, 5, (byte) 0x2A,
                                                  1, 0, 0, 0,
-                                                 // don't know the
-                                                 // compressed size,
-                                                 // don't want to
-                                                 // hard-code it
+                                                 // compressed size
+                                                 (byte) 0x68, (byte) 0x27,
+                                                 (byte) 0x4A, 0,
+                                                 0, 0, 0, 0,
                                              }, extra);
 
                                          // validate data descriptor
@@ -591,11 +590,13 @@ public class Zip64SupportTest {
                                                  (byte) 0x50, (byte) 0x6F,
                                                  (byte) 0x31, (byte) 0x5c,
                                              }, dd);
-                                         // skip uncompressed size
-                                         a.skipBytes(8);
-                                         dd = new byte[8];
+                                         dd = new byte[16];
                                          a.readFully(dd);
                                          assertArrayEquals(new byte[] {
+                                                 // compressed size
+                                                 (byte) 0x68, (byte) 0x27,
+                                                 (byte) 0x4A, 0,
+                                                 0, 0, 0, 0,
                                                  // original size
                                                  0, (byte) 0xF2, 5, (byte) 0x2A,
                                                  1, 0, 0, 0,
@@ -641,8 +642,10 @@ public class Zip64SupportTest {
                                                  16, 0,
                                                  // original size
                                                  0, 0, 0, 0,
+                                                 0, 0, 0, 0,
                                                  // compressed size
                                                  0, 0, 0, 0,
+                                                 0, 0, 0, 0,
                                              }, extra);
                                      } finally {
                                          a.close();
@@ -730,7 +733,7 @@ public class Zip64SupportTest {
                             // file name
                             (byte) '0'
                         }, rest);
-                    byte[] extra = new byte[12];
+                    byte[] extra = new byte[20];
                     a.readFully(extra);
                     // 5e9 == 0x12A05F200
                     assertArrayEquals(new byte[] {
@@ -741,10 +744,9 @@ public class Zip64SupportTest {
                             // original size
                             0, (byte) 0xF2, 5, (byte) 0x2A,
                             1, 0, 0, 0,
-                            // don't know the
-                            // compressed size,
-                            // don't want to
-                            // hard-code it
+                            // compressed size
+                            (byte) 0x68, (byte) 0x27, (byte) 0x4A, 0,
+                            0, 0, 0, 0,
                         }, extra);
 
                     // and now validate local file header
@@ -779,7 +781,7 @@ public class Zip64SupportTest {
                             // file name
                             (byte) '0'
                         }, rest);
-                    extra = new byte[12];
+                    extra = new byte[20];
                     a.readFully(extra);
                     assertArrayEquals(new byte[] {
                             // Header-ID
@@ -789,10 +791,9 @@ public class Zip64SupportTest {
                             // original size
                             0, (byte) 0xF2, 5, (byte) 0x2A,
                             1, 0, 0, 0,
-                            // don't know the
-                            // compressed size,
-                            // don't want to
-                            // hard-code it
+                            // compressed size
+                            (byte) 0x68, (byte) 0x27, (byte) 0x4A, 0,
+                            0, 0, 0, 0,
                         }, extra);
                 } finally {
                     a.close();



Mime
View raw message