ionutzpi commented on code in PR #1473: URL: https://github.com/apache/jackrabbit-oak/pull/1473#discussion_r1618377176
########## oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentPropertyStateTest.java: ########## @@ -81,4 +88,83 @@ public void multiValuedBinarySize() throws Exception { assertEquals(0, reads.size()); } + @Test + public void multiValuedAboveThresholdSize() throws Exception { + NodeBuilder builder = ns.getRoot().builder(); + List<Blob> blobs = newArrayList(); + for (int i = 0; i < 13; i++) { + blobs.add(builder.createBlob(new RandomStream(BLOB_SIZE, i))); + } + builder.child(TEST_NODE).setProperty("p", blobs, Type.BINARIES); + TestUtils.merge(ns, builder); + + PropertyState p = ns.getRoot().getChildNode(TEST_NODE).getProperty("p"); + assertEquals(Type.BINARIES, Objects.requireNonNull(p).getType()); + assertEquals(13, p.count()); + + reads.clear(); + assertEquals(BLOB_SIZE, p.size(0)); + // must not read the blob via stream + assertEquals(0, reads.size()); + } + + @Test + public void stringBelowThresholdSize() throws Exception { + NodeBuilder builder = ns.getRoot().builder(); + builder.child(TEST_NODE).setProperty("p", "dummy", Type.STRING); + TestUtils.merge(ns, builder); + + PropertyState p = ns.getRoot().getChildNode(TEST_NODE).getProperty("p"); + assertEquals(Type.STRING, Objects.requireNonNull(p).getType()); + assertEquals(1, p.count()); + + reads.clear(); + assertEquals(5, p.size(0)); + // must not read the string via stream + assertEquals(0, reads.size()); + } Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org