jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1564366 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Date Tue, 04 Feb 2014 16:12:43 GMT
Author: jukka
Date: Tue Feb  4 16:12:43 2014
New Revision: 1564366

URL: http://svn.apache.org/r1564366
Log:
OAK-1374: Async indexer fails on the SegmentMK

Add a test case

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

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java?rev=1564366&r1=1564365&r2=1564366&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Tue Feb  4 16:12:43 2014
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.plugin
 
 import static com.google.common.collect.Lists.newArrayList;
 import static junit.framework.Assert.fail;
+import static org.apache.jackrabbit.oak.api.Type.BINARIES;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 import static org.apache.jackrabbit.oak.plugins.segment.ListRecord.LEVEL_SIZE;
 import static org.junit.Assert.assertEquals;
@@ -326,4 +327,33 @@ public class RecordTest {
         assertEquals(builder.getNodeState(), after);
     }
 
+    @Test
+    public void testMultiValuedBinaryPropertyAcrossSegments()
+            throws IOException {
+        // biggest possible inlined value record
+        byte[] data = new byte[Segment.MEDIUM_LIMIT - 1];
+        random.nextBytes(data);
+
+        // create enough copies of the value to fill a full segment
+        List<Blob> blobs = newArrayList();
+        while (blobs.size() * data.length < Segment.MAX_SEGMENT_SIZE) {
+            blobs.add(writer.writeStream(new ByteArrayInputStream(data)));
+        }
+
+        // write a simple node that'll now be stored in a separate segment
+        NodeBuilder builder = EMPTY_NODE.builder();
+        builder.setProperty("test", blobs, BINARIES);
+        NodeState state = writer.writeNode(builder.getNodeState());
+
+        // all the blobs should still be accessible, even if they're
+        // referenced from another segment
+        for (Blob blob : state.getProperty("test").getValue(BINARIES)) {
+            try {
+                blob.getNewStream().close();
+            } catch (IllegalStateException e) {
+                fail("OAK-1374");
+            }
+        }
+    }
+
 }



Mime
View raw message