Author: chetanm
Date: Fri Nov 11 12:14:17 2016
New Revision: 1769282

URL: http://svn.apache.org/viewvc?rev=1769282&view=rev
Log:
OAK-5079 - Diff would not work for bundled nodes when done without journal 
support

Including changes as suggested by Marcel

Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDiffer.java
    
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/TestUtils.java
    
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.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/bundlor/BundledDocumentDiffer.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDiffer.java?rev=1769282&r1=1769281&r2=1769282&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDiffer.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDiffer.java
 Fri Nov 11 12:14:17 2016
@@ -40,7 +40,7 @@ public class BundledDocumentDiffer {
 
     /**
      * Performs diff for bundled nodes. The passed state can be 
DocumentNodeState or
-     * one from secondary nodestore i.e. {@link DelegatingDocumentNodeState}. 
So the
+     * one from secondary nodestore i.e. {@code DelegatingDocumentNodeState}. 
So the
      * passed states cannot be cast down to DocumentNodeState
      *
      * @param from from state

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/TestUtils.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/TestUtils.java?rev=1769282&r1=1769281&r2=1769282&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/TestUtils.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/TestUtils.java
 Fri Nov 11 12:14:17 2016
@@ -30,6 +30,8 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
+import static org.junit.Assert.fail;
+
 public class TestUtils {
 
     public static final Predicate<UpdateOp> IS_LAST_REV_UPDATE = new 
Predicate<UpdateOp>() {
@@ -76,4 +78,12 @@ public class TestUtils {
         }
         return nb;
     }
+
+    public static DocumentNodeState asDocumentState(NodeState state){
+        if (state instanceof DocumentNodeState){
+            return (DocumentNodeState) state;
+        }
+        fail("Not of type DocumentNodeState " + state.getClass());
+        return null;
+    }
 }

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java?rev=1769282&r1=1769281&r2=1769282&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/bundlor/BundledDocumentDifferTest.java
 Fri Nov 11 12:14:17 2016
@@ -54,7 +54,7 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.plugins.document.TestUtils.merge;
 import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.BundlingConfigHandler.BUNDLOR;
 import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.BundlingConfigHandler.DOCUMENT_NODE_STORE;
-import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlingTest.asDocumentState;
+import static 
org.apache.jackrabbit.oak.plugins.document.TestUtils.asDocumentState;
 import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlingTest.newNode;
 import static org.hamcrest.CoreMatchers.hasItem;
 import static org.junit.Assert.assertEquals;

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=1769282&r1=1769281&r2=1769282&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
 Fri Nov 11 12:14:17 2016
@@ -41,6 +41,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
 import org.apache.jackrabbit.oak.plugins.document.PathRev;
 import org.apache.jackrabbit.oak.plugins.document.TestNodeObserver;
+import org.apache.jackrabbit.oak.plugins.document.TestUtils;
 import org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
 import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
@@ -54,7 +55,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -65,6 +65,9 @@ import static org.apache.commons.io.File
 import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
 import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
 import static 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.SYS_PROP_DISABLE_JOURNAL;
+import static 
org.apache.jackrabbit.oak.plugins.document.TestUtils.asDocumentState;
+import static 
org.apache.jackrabbit.oak.plugins.document.TestUtils.childBuilder;
+import static org.apache.jackrabbit.oak.plugins.document.TestUtils.createChild;
 import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.BundlingConfigHandler.BUNDLOR;
 import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.BundlingConfigHandler.DOCUMENT_NODE_STORE;
 import static 
org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlor.META_PROP_BUNDLED_CHILD;
@@ -817,14 +820,6 @@ public class DocumentBundlingTest {
         return store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
     }
 
-    static DocumentNodeState asDocumentState(NodeState state){
-        if (state instanceof DocumentNodeState){
-            return (DocumentNodeState) state;
-        }
-        fail("Not of type AbstractDoucmentNodeState");
-        return null;
-    }
-
     private static String getBundlingPath(NodeState contentNode) {
         PropertyState ps = 
contentNode.getProperty(DocumentBundlor.META_PROP_BUNDLING_PATH);
         return checkNotNull(ps).getValue(Type.STRING);
@@ -844,21 +839,6 @@ public class DocumentBundlingTest {
         return builder;
     }
 
-    private static NodeBuilder createChild(NodeBuilder root, String ... paths){
-        for (String path : paths){
-            childBuilder(root, path);
-        }
-        return root;
-    }
-
-    private static NodeBuilder childBuilder(NodeBuilder root, String path){
-        NodeBuilder nb = root;
-        for (String nodeName : PathUtils.elements(path)){
-            nb = nb.child(nodeName);
-        }
-        return nb;
-    }
-
     private static class RecordingDocumentStore extends MemoryDocumentStore {
         final List<String> queryPaths = new ArrayList<>();
         final List<String> findPaths = new ArrayList<>();


Reply via email to