Index: src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java =================================================================== --- src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java (revision 1620787) +++ src/test/java/org/apache/jackrabbit/oak/plugins/segment/ExternalBlobTest.java (working copy) @@ -83,6 +83,32 @@ } @Test + public void testStringIsTooBig() throws Exception { + FileDataStore fds = createFileDataStore(); + DataStoreBlobStore dbs = new DataStoreBlobStore(fds); + nodeStore = getNodeStore(dbs); + + //Test for Blob which get inlined + Blob b1 = testCreateAndRead(createBlob(fds.getMinRecordLength()-2)); + assertTrue(b1 instanceof SegmentBlob); + assertNull(((SegmentBlob) b1).getBlobId()); + + //Test for Blob which need to be pushed to BlobStore + byte[] data2 = new byte[Segment.MEDIUM_LIMIT + 1]; + new Random().nextBytes(data2); + Blob b2 = testCreateAndRead(nodeStore.createBlob(new ByteArrayInputStream(data2))); + assertTrue(b2 instanceof SegmentBlob); + assertNotNull(b2.getReference()); + InputStream is = dbs.getInputStream(((SegmentBlob) b2).getBlobId()); + assertNotNull(IOUtils.contentEquals(new ByteArrayInputStream(data2), is)); + is.close(); + + NodeState ns = nodeStore.getRoot().getChildNode("hello"); + System.out.println(ns.getProperty("world").getValue(Type.STRING)); + + } + + @Test public void testNullBlobId() throws Exception{ FileDataStore fds = createFileDataStore(); DataStoreBlobStore dbs = new DataStoreBlobStore(fds);