jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1494161 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/mongomk/ test/java/org/apache/jackrabbit/oak/kernel/ test/java/org/apache/jackrabbit/oak/plugins/mongomk/
Date Tue, 18 Jun 2013 15:00:38 GMT
Author: mreutegg
Date: Tue Jun 18 15:00:38 2013
New Revision: 1494161

URL: http://svn.apache.org/r1494161
Log:
OAK-827: NodeStoreTest diff failures with MongoMK

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKDiffTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java?rev=1494161&r1=1494160&r2=1494161&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
Tue Jun 18 15:00:38 2013
@@ -852,7 +852,25 @@ public class MongoMK implements MicroKer
             }
             String id = e.get(UpdateOp.ID).toString();
             String p = Utils.getPathFromId(id);
-            w.tag('^').key(p).object().endObject().newline();
+            if (getNode(p, fromRev) != null) {
+                // exists in fromRev
+                if (getNode(p, toRev) != null) {
+                    // exists in both revisions
+                    w.tag('^').key(p).object().endObject().newline();
+                } else {
+                    // does not exist in toRev -> was removed
+                    w.tag('-').value(p).newline();
+                }
+            } else {
+                // does not exist in fromRev
+                if (getNode(p, toRev) != null) {
+                    // exists in toRev
+                    w.tag('+').key(p).object().endObject().newline();
+                } else {
+                    // does not exist in either revisions
+                    // -> do nothing
+                }
+            }
         }
     }
     

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java?rev=1494161&r1=1494160&r2=1494161&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/kernel/NodeStoreTest.java
Tue Jun 18 15:00:38 2013
@@ -229,8 +229,6 @@ public class NodeStoreTest {
 
     @Test
     public void manyChildNodes() throws CommitFailedException {
-        // OAK-872
-        Assume.assumeTrue(fixture != NodeStoreFixture.MONGO_MK);
         NodeStoreBranch branch = store.branch();
         NodeBuilder root = branch.getHead().builder();
         NodeBuilder parent = root.child("parent");
@@ -334,8 +332,6 @@ public class NodeStoreTest {
 
     @Test
     public void compareAgainstBaseState100() throws CommitFailedException {
-        // OAK-872
-        Assume.assumeTrue(fixture != NodeStoreFixture.MONGO_MK);
         compareAgainstBaseState(KernelNodeState.MAX_CHILD_NODE_NAMES);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKDiffTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKDiffTest.java?rev=1494161&r1=1494160&r2=1494161&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKDiffTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKDiffTest.java
Tue Jun 18 15:00:38 2013
@@ -246,4 +246,22 @@ public class MongoMKDiffTest extends Abs
         obj = parseJSONObject(mk.getNodes("/level1", null, 0, 0, -1, null));
         assertPropertyValue(obj, "prop1", "value1");
     }
+
+    @Test
+    public void diffManyChildren() {
+        String baseRev = mk.getHeadRevision();
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < MongoMK.MANY_CHILDREN_THRESHOLD * 2; i++) {
+            sb.append("+\"node-").append(i).append("\":{}");
+        }
+        String rev = mk.commit("/", sb.toString(), null, null);
+        String jsop = mk.diff(baseRev, rev, "/", 0);
+        for (int i = 0; i < MongoMK.MANY_CHILDREN_THRESHOLD * 2; i++) {
+            assertTrue(jsop.contains("+\"/node-" + i + "\""));
+        }
+        jsop = mk.diff(rev, baseRev, "/", 0);
+        for (int i = 0; i < MongoMK.MANY_CHILDREN_THRESHOLD * 2; i++) {
+            assertTrue(jsop.contains("-\"/node-" + i + "\""));
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message