Author: chetanm
Date: Wed Oct 19 15:09:43 2016
New Revision: 1765635

URL: http://svn.apache.org/viewvc?rev=1765635&view=rev
Log:
OAK-1312 -  [bundling] Bundle nodes into a document

Add test case for binary flag being set when a relative binary property is 
added to NodeDocument

Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
    
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java?rev=1765635&r1=1765634&r2=1765635&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeState.java
 Wed Oct 19 15:09:43 2016
@@ -111,7 +111,7 @@ public class DocumentNodeState extends A
                               boolean hasChildren,
                               @Nullable RevisionVector lastRevision,
                               boolean fromExternalChange) {
-        this(store, path, rootRevision, lastRevision,
+        this(store, path, lastRevision, rootRevision,
                 fromExternalChange, 
createBundlingContext(checkNotNull(properties), hasChildren));
     }
 

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java?rev=1765635&r1=1765634&r2=1765635&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/DocumentBundlingTest.java
 Wed Oct 19 15:09:43 2016
@@ -106,13 +106,11 @@ public class DocumentBundlingTest {
 
         assertNull(getNodeDocument("/test/book.jpg/jcr:content"));
         assertNotNull(getNodeDocument("/test/book.jpg"));
+        assertTrue(hasNodeProperty("/test/book.jpg", concat("jcr:content", 
DocumentBundlor.META_PROP_NODE)));
 
         AssertingDiff.assertEquals(fileNode.getNodeState(), 
fileNodeState.getChildNode("book.jpg"));
     }
 
-    //TODO Test _bin being set
-    //TODO Test with asserts on expected properties present in NodeDocument 
like :self etc
-
     @Test
     public void bundledParent() throws Exception{
         NodeBuilder builder = store.getRoot().builder();
@@ -421,6 +419,29 @@ public class DocumentBundlingTest {
 
     }
 
+    @Test
+    public void binaryFlagSet() throws Exception{
+        NodeBuilder builder = store.getRoot().builder();
+        NodeBuilder appNB = newNode("app:Asset");
+        createChild(appNB,
+                "jcr:content",
+                "jcr:content/renditions", //includes all
+                "jcr:content/renditions/original",
+                "jcr:content/renditions/original/jcr:content"
+        );
+
+
+        builder.child("test").setChildNode("book.jpg", appNB.getNodeState());
+        merge(builder);
+
+        assertFalse(getNodeDocument("/test/book.jpg").hasBinary());
+
+        builder = store.getRoot().builder();
+        childBuilder(builder, 
"test/book.jpg/jcr:content/renditions/original/jcr:content").setProperty("foo", 
"bar".getBytes());
+        merge(builder);
+        assertTrue(getNodeDocument("/test/book.jpg").hasBinary());
+    }
+
     private void createTestNode(String path, NodeState state) throws 
CommitFailedException {
         String parentPath = PathUtils.getParentPath(path);
         NodeBuilder builder = store.getRoot().builder();


Reply via email to