jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1584352 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/TarFileTest.java
Date Thu, 03 Apr 2014 19:46:11 GMT
Author: jukka
Date: Thu Apr  3 19:46:11 2014
New Revision: 1584352

URL: http://svn.apache.org/r1584352
Log:
OAK-1672: TarFileTest#testWriteAndRead failure

Make sure that the randomly generated test UUID is not a data segment id
to prevent TarWriter.writeEntry() from trying to interpret the test data

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/TarFileTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/TarFileTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/TarFileTest.java?rev=1584352&r1=1584351&r2=1584352&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/TarFileTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/file/TarFileTest.java
Thu Apr  3 19:46:11 2014
@@ -24,9 +24,7 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.UUID;
 
-import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class TarFileTest {
@@ -38,20 +36,16 @@ public class TarFileTest {
         file = File.createTempFile("TarFileTest", ".tar", new File("target"));
     }
 
-    @Ignore
     @Test
     public void testWriteAndRead() throws IOException {
         UUID id = UUID.randomUUID();
         long msb = id.getMostSignificantBits();
-        long lsb = id.getLeastSignificantBits();
+        long lsb = id.getLeastSignificantBits() & (-1 >>> 4); // OAK-1672
         byte[] data = "Hello, World!".getBytes(UTF_8);
 
         TarWriter writer = new TarWriter(file);
         try {
-            writer.writeEntry(
-                    id.getMostSignificantBits(),
-                    id.getLeastSignificantBits(),
-                    data, 0, data.length);
+            writer.writeEntry(msb, lsb, data, 0, data.length);
             assertEquals(ByteBuffer.wrap(data), writer.readEntry(msb, lsb));
         } finally {
             writer.close();



Mime
View raw message