jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1407119 [7/9] - in /jackrabbit/oak/trunk: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/ oak-mk-perf/ oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/tasks/ oak-...
Date Thu, 08 Nov 2012 15:18:02 GMT
Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,349 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.junit.Test;
+
+/**
+ * Tests for {@code MicroKernel#branch}
+ */
+public class MongoMKBranchMergeTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void oneBranchAddedChildren1() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = addNodes(branchRev, "/branch1", "/branch1/child1");
+        assertNodesExist(branchRev, "/trunk", "/trunk/child1");
+        assertNodesExist(branchRev, "/branch1", "/branch1/child1");
+        assertNodesNotExist(null, "/branch1", "/branch1/child1");
+
+        addNodes(null, "/trunk/child2");
+        assertNodesExist(null, "/trunk/child2");
+        assertNodesNotExist(branchRev, "/trunk/child2");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/trunk", "/trunk/child1", "/trunk/child2", "/branch1", "/branch1/child1");
+    }
+
+    @Test
+    public void oneBranchAddedChildren2() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = addNodes(branchRev, "/trunk/child1/child2");
+        assertNodesExist(branchRev, "/trunk", "/trunk/child1");
+        assertNodesExist(branchRev, "/trunk/child1/child2");
+        assertNodesNotExist(null, "/trunk/child1/child2");
+
+        addNodes(null, "/trunk/child3");
+        assertNodesExist(null, "/trunk/child3");
+        assertNodesNotExist(branchRev, "/trunk/child3");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/trunk", "/trunk/child1", "/trunk/child1/child2", "/trunk/child3");
+    }
+
+    @Test
+    public void oneBranchAddedChildren3() {
+        addNodes(null, "/root", "/root/child1");
+        assertNodesExist(null, "/root", "/root/child1");
+
+        String branchRev = mk.branch(null);
+
+        addNodes(null, "/root/child2");
+        assertNodesExist(null, "/root", "/root/child1", "/root/child2");
+        assertNodesExist(branchRev, "/root", "/root/child1");
+        assertNodesNotExist(branchRev, "/root/child2");
+
+        branchRev = addNodes(branchRev, "/root/child1/child3", "/root/child4");
+        assertNodesExist(branchRev, "/root", "/root/child1", "/root/child1/child3", "/root/child4");
+        assertNodesNotExist(branchRev, "/root/child2");
+        assertNodesExist(null, "/root", "/root/child1", "/root/child2");
+        assertNodesNotExist(null, "/root/child1/child3", "/root/child4");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/root", "/root/child1", "/root/child2",
+                "/root/child1/child3", "/root/child4");
+    }
+
+    @Test
+    public void oneBranchRemovedChildren() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = removeNodes(branchRev, "/trunk/child1");
+        assertNodesExist(branchRev, "/trunk");
+        assertNodesNotExist(branchRev, "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/trunk");
+        assertNodesNotExist(null, "/trunk/child1");
+    }
+
+    @Test
+    public void oneBranchRemovedRoot() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = removeNodes(branchRev, "/trunk");
+        assertNodesNotExist(branchRev, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        mk.merge(branchRev, "");
+        assertNodesNotExist(null, "/trunk", "/trunk/child1");
+    }
+
+    /**
+     * This is a test to make sure properties are properly escaped in merge.
+     */
+    @Test
+    public void oneBranchAddPropertyRoot() {
+        String branchRev = mk.branch(null);
+
+        branchRev = setProp(branchRev, "/jcr:primaryType", "nam:rep:root");
+        assertPropExists(branchRev, "/", "jcr:primaryType");
+
+        branchRev = mk.merge(branchRev, "");
+        assertPropExists(branchRev, "/", "jcr:primaryType");
+
+        String mergedNode = mk.getNodes("/", branchRev, -1, 0, -1, null);
+        String expectedNode = "{\"jcr:primaryType\":\"nam:rep:root\",\":childNodeCount\":0}";
+        assertEquals("Wrong property value after merge", expectedNode, mergedNode);
+    }
+
+    @Test
+    public void oneBranchChangedProperties() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        setProp(null, "/trunk/child1/prop1", "value1");
+        setProp(null, "/trunk/child1/prop2", "value2");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+        assertPropExists(null, "/trunk/child1", "prop1");
+        assertPropExists(null, "/trunk/child1", "prop2");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = setProp(branchRev, "/trunk/child1/prop1", "value1a");
+        branchRev = setProp(branchRev, "/trunk/child1/prop2", null);
+        branchRev = setProp(branchRev, "/trunk/child1/prop3", "value3");
+        assertPropValue(branchRev, "/trunk/child1", "prop1", "value1a");
+        assertPropNotExists(branchRev, "/trunk/child1", "prop2");
+        assertPropValue(branchRev, "/trunk/child1", "prop3", "value3");
+        assertPropValue(null, "/trunk/child1", "prop1", "value1");
+        assertPropExists(null, "/trunk/child1", "prop2");
+        assertPropNotExists(null, "/trunk/child1", "prop3");
+
+        mk.merge(branchRev, "");
+        assertPropValue(null, "/trunk/child1", "prop1", "value1a");
+        assertPropNotExists(null, "/trunk/child1", "prop2");
+        assertPropValue(null, "/trunk/child1", "prop3", "value3");
+    }
+
+    @Test
+    public void oneBranchAddedSubChildren() {
+        addNodes(null, "/trunk", "/trunk/child1", "/trunk/child1/child2", "/trunk/child1/child2/child3");
+        assertNodesExist(null, "/trunk", "/trunk/child1", "/trunk/child1/child2", "/trunk/child1/child2/child3");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = addNodes(branchRev, "/branch1", "/branch1/child1", "/branch1/child1/child2", "/branch1/child1/child2/child3");
+        assertNodesExist(branchRev, "/trunk", "/trunk/child1", "/trunk/child1/child2", "/trunk/child1/child2/child3");
+        assertNodesExist(branchRev, "/branch1", "/branch1/child1", "/branch1/child1/child2", "/branch1/child1/child2/child3");
+        assertNodesNotExist(null, "/branch1", "/branch1/child1", "/branch1/child1/child2", "/branch1/child1/child2/child3");
+
+        addNodes(null, "/trunk/child1/child2/child3/child4", "/trunk/child5");
+        assertNodesExist(null, "/trunk/child1/child2/child3/child4", "/trunk/child5");
+        assertNodesNotExist(branchRev, "/trunk/child1/child2/child3/child4", "/trunk/child5");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/trunk", "/trunk/child1", "/trunk/child1/child2", "/trunk/child1/child2/child3", "/trunk/child1/child2/child3/child4");
+        assertNodesExist(null, "/branch1", "/branch1/child1", "/branch1/child1/child2", "/branch1/child1/child2/child3");
+    }
+
+    @Test
+    public void oneBranchAddedChildrenAndAddedProperties() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        setProp(null, "/trunk/child1/prop1", "value1");
+        setProp(null, "/trunk/child1/prop2", "value2");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+        assertPropExists(null, "/trunk/child1", "prop1");
+        assertPropExists(null, "/trunk/child1", "prop2");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = addNodes(branchRev, "/branch1", "/branch1/child1");
+        branchRev = setProp(branchRev, "/branch1/child1/prop1", "value1");
+        branchRev = setProp(branchRev, "/branch1/child1/prop2", "value2");
+        assertNodesExist(branchRev, "/trunk", "/trunk/child1");
+        assertPropExists(branchRev, "/trunk/child1", "prop1");
+        assertPropExists(branchRev, "/trunk/child1", "prop2");
+        assertNodesExist(branchRev, "/branch1", "/branch1/child1");
+        assertPropExists(branchRev, "/branch1/child1", "prop1");
+        assertPropExists(branchRev, "/branch1/child1", "prop2");
+        assertNodesNotExist(null, "/branch1", "/branch1/child1");
+        assertPropNotExists(null, "/branch1/child1", "prop1");
+        assertPropNotExists(null, "/branch1/child1", "prop2");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+        assertPropExists(null, "/trunk/child1", "prop1");
+        assertPropExists(null, "/trunk/child1", "prop2");
+        assertNodesExist(null, "/branch1", "/branch1/child1");
+        assertPropExists(null, "/branch1/child1", "prop1");
+        assertPropExists(null, "/branch1/child1", "prop2");
+    }
+
+    @Test
+    public void twoBranchesAddedChildren1() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        String branchRev1 = mk.branch(null);
+        String branchRev2 = mk.branch(null);
+
+        branchRev1 = addNodes(branchRev1, "/branch1", "/branch1/child1");
+        branchRev2 = addNodes(branchRev2, "/branch2", "/branch2/child2");
+        assertNodesExist(branchRev1, "/trunk", "/trunk/child1");
+        assertNodesExist(branchRev2, "/trunk", "/trunk/child1");
+        assertNodesExist(branchRev1, "/branch1/child1");
+        assertNodesNotExist(branchRev1, "/branch2/child2");
+        assertNodesExist(branchRev2, "/branch2/child2");
+        assertNodesNotExist(branchRev2, "/branch1/child1");
+        assertNodesNotExist(null, "/branch1/child1", "/branch2/child2");
+
+        addNodes(null, "/trunk/child2");
+        assertNodesExist(null, "/trunk/child2");
+        assertNodesNotExist(branchRev1, "/trunk/child2");
+        assertNodesNotExist(branchRev2, "/trunk/child2");
+
+        mk.merge(branchRev1, "");
+        assertNodesExist(null, "/trunk", "/branch1", "/branch1/child1");
+        assertNodesNotExist(null, "/branch2", "/branch2/child2");
+
+        mk.merge(branchRev2, "");
+        assertNodesExist(null, "/trunk", "/branch1", "/branch1/child1", "/branch2", "/branch2/child2");
+    }
+
+    @Test
+    public void oneBranchAddedChildrenWithConflict() {
+        addNodes(null, "/trunk", "/trunk/child1");
+        assertNodesExist(null, "/trunk", "/trunk/child1");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = removeNodes(branchRev, "/trunk/child1");
+        assertNodesExist(branchRev, "/trunk");
+        assertNodesNotExist(branchRev, "/trunk/child1");
+
+        addNodes(null, "/trunk/child1/child2");
+        assertNodesExist(null, "/trunk", "/trunk/child1", "/trunk/child1/child2");
+
+        mk.merge(branchRev, "");
+        assertNodesExist(null, "/trunk");
+        assertNodesNotExist(null, "/trunk/child1", "/trunk/child1/child2");
+    }
+
+    @Test
+    public void oneBranchChangedPropertiesWithConflict() {
+        addNodes(null, "/trunk");
+        setProp(null, "/trunk/prop1", "value1");
+        assertPropExists(null, "/trunk", "prop1");
+
+        String branchRev = mk.branch(null);
+
+        branchRev = setProp(branchRev, "/trunk/prop1", "value1a");
+        assertPropValue(branchRev, "/trunk", "prop1", "value1a");
+
+        setProp(null, "/trunk/prop1", "value1b");
+        try {
+            mk.merge(branchRev, "");
+            fail("Expected: Concurrent modification exception");
+        } catch (Exception expected){}
+    }
+
+    @Test
+    public void addExistingRootInBranch() {
+        addNodes(null, "/root");
+        assertNodesExist(null, "/root");
+
+        String branchRev = mk.branch(null);
+        try {
+            branchRev = addNodes(branchRev, "/root");
+            fail("Should not be able to add the same root node twice");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void addExistingChildInBranch() {
+        addNodes(null, "/root", "/root/child1");
+        assertNodesExist(null, "/root", "/root/child1");
+
+        String branchRev = mk.branch(null);
+        branchRev = addNodes(branchRev, "/root/child2");
+        assertNodesExist(branchRev, "/root/child1", "/root/child2");
+
+        try {
+            branchRev = addNodes(branchRev, "/root/child1");
+            fail("Should not be able to add the same root node twice");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void emptyMergeCausesNoChange() {
+        String rev1 = mk.commit("", "+\"/child1\":{}", null, "");
+
+        String branchRev = mk.branch(null);
+        branchRev = mk.commit("", "+\"/child2\":{}", branchRev, "");
+        branchRev = mk.commit("", "-\"/child2\"", branchRev, "");
+
+        String rev2 = mk.merge(branchRev, "");
+
+        assertTrue(mk.nodeExists("/child1", null));
+        assertFalse(mk.nodeExists("/child2", null));
+        assertEquals(rev1, rev2);
+    }
+
+    @Test
+    public void trunkMergeNotAllowed() {
+        String rev = mk.commit("", "+\"/child1\":{}", null, "");
+        try {
+            mk.merge(rev, "");
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    private String addNodes(String rev, String...nodes) {
+        String newRev = rev;
+        for (String node : nodes) {
+            newRev = mk.commit("", "+\"" + node + "\":{}", rev, "");
+        }
+        return newRev;
+    }
+
+    private String removeNodes(String rev, String...nodes) {
+        String newRev = rev;
+        for (String node : nodes) {
+            newRev = mk.commit("", "-\"" + node + "\"", rev, "");
+        }
+        return newRev;
+    }
+
+    private String setProp(String rev, String prop, Object value) {
+        value = value == null? null : "\"" + value + "\"";
+        return mk.commit("", "^\"" + prop + "\" : " + value, rev, "");
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,113 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
+ * with emphasis on add node and property operations.
+ */
+public class MongoMKCommitAddTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void addSingleNode() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+
+        String nodes = mk.getNodes("/", null, -1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, ":childNodeCount", 1L);
+    }
+
+    @Test
+    public void addNodeWithChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\": {}, \"c\": {}, \"d\" : {} }", null, null);
+
+        assertTrue(mk.nodeExists("/a",null));
+        assertTrue(mk.nodeExists("/a/b",null));
+        assertTrue(mk.nodeExists("/a/c",null));
+        assertTrue(mk.nodeExists("/a/d",null));
+    }
+
+    @Test
+    public void addNodeWithNestedChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\": { \"c\" : { \"d\" : {} } } }", null, null);
+
+        assertTrue(mk.nodeExists("/a",null));
+        assertTrue(mk.nodeExists("/a/b",null));
+        assertTrue(mk.nodeExists("/a/b/c",null));
+        assertTrue(mk.nodeExists("/a/b/c/d",null));
+    }
+
+
+    @Test
+    public void addIntermediataryNodes() throws Exception {
+        String rev1 = mk.commit("/", "+\"a\" : { \"b\" : { \"c\": {} }}", null, null);
+        String rev2 = mk.commit("/", "+\"a/d\" : {} +\"a/b/e\" : {}", null, null);
+
+        assertTrue(mk.nodeExists("/a/b/c", rev1));
+        assertFalse(mk.nodeExists("/a/b/e", rev1));
+        assertFalse(mk.nodeExists("/a/d", rev1));
+
+        assertTrue(mk.nodeExists("/a/b/c", rev2));
+        assertTrue(mk.nodeExists("/a/b/e", rev2));
+        assertTrue(mk.nodeExists("/a/d", rev2));
+    }
+
+    @Test
+    public void addDuplicateNode() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+        try {
+            mk.commit("/", "+\"a\" : {}", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void setSingleProperty() throws Exception {
+        mk.commit("/", "+\"a\" : {} ^\"a/key1\" : \"value1\"", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, ":childNodeCount", 1L);
+        assertPropertyValue(obj, "a/key1", "value1");
+    }
+
+    @Test
+    public void setMultipleProperties() throws Exception {
+        mk.commit("/", "+\"a\" : {} ^\"a/key1\" : \"value1\"", null, null);
+        mk.commit("/", "^\"a/key2\" : 2", null, null);
+        mk.commit("/", "^\"a/key3\" : false", null, null);
+        mk.commit("/", "^\"a/key4\" : 0.25", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, ":childNodeCount", 1L);
+        assertPropertyValue(obj, "a/key1", "value1");
+        assertPropertyValue(obj, "a/key2", 2L);
+        assertPropertyValue(obj, "a/key3", false);
+        assertPropertyValue(obj, "a/key4", 0.25);
+    }
+
+    @Test
+    public void setPropertyWithoutAddingNode() throws Exception {
+        try {
+            mk.commit("/", "^\"a/key1\" : \"value1\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,259 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
+ * with emphasis on copy operations.
+ */
+public class MongoMKCommitCopyTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void copyNode() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+
+        mk.commit("/", "*\"a\" : \"b\"", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/b", null));
+    }
+
+    @Test
+    public void copyNodeWithChild() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {} }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+
+        mk.commit("/", "*\"a\" : \"c\"", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+        assertTrue(mk.nodeExists("/c/b", null));
+    }
+
+    @Test
+    public void copyNodeWithChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {},  \"c\" : {}, \"d\" : {}}", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/a/c", null));
+        assertTrue(mk.nodeExists("/a/d", null));
+
+        mk.commit("/", "*\"a\" : \"e\"", null, null);
+        assertTrue(mk.nodeExists("/e", null));
+        assertTrue(mk.nodeExists("/e/b", null));
+        assertTrue(mk.nodeExists("/e/c", null));
+        assertTrue(mk.nodeExists("/e/d", null));
+    }
+
+    @Test
+    public void copyNodeWithNestedChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : { \"c\" : { \"d\" : {} } } }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/a/b/c", null));
+        assertTrue(mk.nodeExists("/a/b/c/d", null));
+
+        mk.commit("/", "*\"a\" : \"e\"", null, null);
+        assertTrue(mk.nodeExists("/e", null));
+        assertTrue(mk.nodeExists("/e/b", null));
+        assertTrue(mk.nodeExists("/e/b/c", null));
+        assertTrue(mk.nodeExists("/e/b/c/d", null));
+
+        mk.commit("/", "*\"e/b\" : \"f\"", null, null);
+        assertTrue(mk.nodeExists("/f", null));
+        assertTrue(mk.nodeExists("/f/c", null));
+        assertTrue(mk.nodeExists("/f/c/d", null));
+    }
+
+    @Test
+    public void copyNodeWithProperties() throws Exception {
+        mk.commit("/", "+\"a\" : { \"key1\" : \"value1\" }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "a/key1", "value1");
+
+        mk.commit("/", "*\"a\" : \"c\"", null, null);
+        assertTrue(mk.nodeExists("/c", null));
+        nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "c/key1", "value1");
+    }
+
+    @Test
+    public void copyFromNonExistentNode() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+
+        try {
+            mk.commit("/", "*\"b\" : \"c\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void copyToAnExistentNode() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {} }", null, null);
+        mk.commit("/", "+\"c\" : {}", null, null);
+
+        try {
+            mk.commit("/", "*\"c\" : \"a/b\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void addNodeAndCopy() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"a/b\":{}\n" +
+                        "*\"a/b\":\"c\"", null, null);
+
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+    }
+
+    @Test
+    public void addNodeWithChildrenAndCopy() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"a/b\":{ \"c\" : {}, \"d\" : {} }\n" +
+                        "*\"a/b\":\"e\"", null, null);
+
+        assertTrue(mk.nodeExists("/a/b/c", null));
+        assertTrue(mk.nodeExists("/a/b/d", null));
+        assertTrue(mk.nodeExists("/e/c", null));
+        assertTrue(mk.nodeExists("/e/d", null));
+    }
+
+    @Test
+    public void addNodeWithNestedChildrenAndCopy() {
+        mk.commit("/", "+\"a\":{ \"b\" : { \"c\" : { } } }", null, null);
+        mk.commit("/", "+\"a/b/c/d\":{}\n"
+                     + "*\"a\":\"e\"", null, null);
+
+        assertTrue(mk.nodeExists("/a/b/c/d", null));
+        assertTrue(mk.nodeExists("/e/b/c/d", null));
+    }
+
+    @Test
+    public void addNodeAndCopyParent() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"a/b\":{}\n" +
+                        "*\"a\":\"c\"", null, null);
+
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c/b", null));
+    }
+
+    @Test
+    public void removeNodeAndCopy() {
+        mk.commit("/", "+\"a\":{ \"b\" : {} }", null, null);
+
+        try {
+            mk.commit("/", "-\"a/b\"\n" +
+                    "*\"a/b\":\"c\"", null, null);
+            fail("Expected expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void removeNodeWithNestedChildrenAndCopy() {
+        mk.commit("/", "+\"a\":{ \"b\" : { \"c\" : { \"d\" : {} } } }", null, null);
+        mk.commit("/", "-\"a/b/c/d\"\n"
+                     + "*\"a\" : \"e\"", null, null);
+
+        assertFalse(mk.nodeExists("/a/b/c/d", null));
+        assertTrue(mk.nodeExists("/e/b/c", null));
+        assertFalse(mk.nodeExists("/e/b/c/d", null));
+    }
+
+    @Test
+    public void removeNodeAndCopyParent() {
+        mk.commit("/", "+\"a\":{ \"b\" : {} }", null, null);
+        mk.commit("/", "-\"a/b\"\n" +
+                        "*\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertFalse(mk.nodeExists("/c/b", null));
+    }
+
+    @Test
+    public void setPropertyAndCopy() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "^\"a/key1\": \"value1\"\n" +
+                        "*\"a\":\"c\"", null, null);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "a/key1", "value1");
+        assertPropertyValue(obj, "c/key1", "value1");
+    }
+
+    @Test
+    public void setNestedPropertyAndCopy() {
+        mk.commit("/", "+\"a\":{ \"b\" : {} }", null, null);
+        mk.commit("/", "^\"a/b/key1\": \"value1\"\n" +
+                        "*\"a\":\"c\"", null, null);
+
+        String nodes = mk.getNodes("/", null, 2 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "a/b/key1", "value1");
+        assertPropertyValue(obj, "c/b/key1", "value1");
+    }
+
+    @Test
+    public void modifyParentAddPropertyAndCopy() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"b\" : {}\n"
+                     + "^\"a/key1\": \"value1\"\n"
+                     + "*\"a\":\"c\"", null, null);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "a/key1", "value1");
+        assertPropertyValue(obj, "c/key1", "value1");
+    }
+
+    @Test
+    public void removePropertyAndCopy() {
+        mk.commit("/", "+\"a\":{ \"b\" : { \"key1\" : \"value1\" } }", null, null);
+        mk.commit("/", "^\"a/b/key1\": null\n" +
+                        "*\"a\":\"c\"", null, null);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyNotExists(obj, "a/b/key1");
+        assertPropertyNotExists(obj, "c/b/key1");
+    }
+
+    @Test
+    public void removeNestedPropertyAndCopy() {
+        mk.commit("/", "+\"a\":{ \"key1\" : \"value1\"}", null, null);
+        mk.commit("/", "^\"a/key1\" : null\n" +
+                        "*\"a\":\"c\"", null, null);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyNotExists(obj, "a/key1");
+        assertPropertyNotExists(obj, "c/key1");
+    }
+
+    @Test
+    public void modifyParentRemovePropertyAndCopy() {
+        mk.commit("/", "+\"a\":{ \"key1\" : \"value1\"}", null, null);
+        mk.commit("/", "+\"b\" : {}\n"
+                     + "^\"a/key1\" : null\n"
+                     + "*\"a\":\"c\"", null, null);
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyNotExists(obj, "a/key1");
+        assertPropertyNotExists(obj, "c/key1");
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,307 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
+ * with emphasis on move operations.
+ */
+public class MongoMKCommitMoveTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void moveNode() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+
+        mk.commit("/", ">\"a\" : \"b\"", null, null);
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/b", null));
+    }
+
+    @Test
+    public void moveUnderSourcePath() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {} }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+
+        try {
+            mk.commit("/", ">\"b\" : \"a\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void moveNodeWithChild() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {} }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+
+        mk.commit("/", ">\"a\" : \"c\"", null, null);
+        assertFalse(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+        assertTrue(mk.nodeExists("/c/b", null));
+    }
+
+    @Test
+    public void moveNodeWithChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {},  \"c\" : {}, \"d\" : {}}", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/a/c", null));
+        assertTrue(mk.nodeExists("/a/d", null));
+
+        mk.commit("/", ">\"a\" : \"e\"", null, null);
+        assertFalse(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertFalse(mk.nodeExists("/a/c", null));
+        assertFalse(mk.nodeExists("/a/d", null));
+        assertTrue(mk.nodeExists("/e", null));
+        assertTrue(mk.nodeExists("/e/b", null));
+        assertTrue(mk.nodeExists("/e/c", null));
+        assertTrue(mk.nodeExists("/e/d", null));
+    }
+
+    @Test
+    public void moveNodeWithNestedChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : { \"c\" : { \"d\" : {} } } }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/a/b/c", null));
+        assertTrue(mk.nodeExists("/a/b/c/d", null));
+
+        mk.commit("/", ">\"a\" : \"e\"", null, null);
+        assertFalse(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertFalse(mk.nodeExists("/a/b/c", null));
+        assertFalse(mk.nodeExists("/a/b/c/d", null));
+        assertTrue(mk.nodeExists("/e", null));
+        assertTrue(mk.nodeExists("/e/b", null));
+        assertTrue(mk.nodeExists("/e/b/c", null));
+        assertTrue(mk.nodeExists("/e/b/c/d", null));
+
+        mk.commit("/", ">\"e/b\" : \"f\"", null, null);
+        assertTrue(mk.nodeExists("/e", null));
+        assertFalse(mk.nodeExists("/e/b", null));
+        assertFalse(mk.nodeExists("/e/b/c", null));
+        assertFalse(mk.nodeExists("/e/b/c/d", null));
+        assertTrue(mk.nodeExists("/f", null));
+        assertTrue(mk.nodeExists("/f/c", null));
+        assertTrue(mk.nodeExists("/f/c/d", null));
+    }
+
+    @Test
+    public void moveNodeWithProperties() throws Exception {
+        mk.commit("/", "+\"a\" : { \"key1\" : \"value1\" }", null, null);
+        assertTrue(mk.nodeExists("/a", null));
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "a/key1", "value1");
+
+        mk.commit("/", ">\"a\" : \"c\"", null, null);
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/c", null));
+        nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "c/key1", "value1");
+    }
+
+    @Test
+    public void moveFromNonExistentNode() throws Exception {
+        try {
+            mk.commit("/", ">\"b\" : \"c\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void moveToAnExistentNode() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\" : {} }", null, null);
+        mk.commit("/", "+\"c\" : {}", null, null);
+
+        try {
+            mk.commit("/", ">\"c\" : \"a/b\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void addNodeAndMove() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"a/b\": {}\n"
+                     + ">\"a/b\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/c", null));
+    }
+
+    @Test
+    public void addNodeWithChildrenAndMove() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"a/b\":{ \"c\" : {}, \"d\" : {} }\n"
+                     + ">\"a/b\":\"e\"", null, null);
+
+        assertTrue(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertFalse(mk.nodeExists("/a/b/c", null));
+        assertFalse(mk.nodeExists("/a/b/d", null));
+
+        assertTrue(mk.nodeExists("/e", null));
+        assertTrue(mk.nodeExists("/e/c", null));
+        assertTrue(mk.nodeExists("/e/d", null));
+    }
+
+    @Test
+    public void addNodeWithNestedChildrenAndMove() {
+        mk.commit("/", "+\"a\":{ \"b\" : { \"c\" : { } } }", null, null);
+        mk.commit("/", "+\"a/b/c/d\":{}\n"
+                     + ">\"a\":\"e\"", null, null);
+
+        assertFalse(mk.nodeExists("/a/b/c/d", null));
+        assertTrue(mk.nodeExists("/e/b/c/d", null));
+    }
+
+    @Test
+    public void addNodeAndMoveParent() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"a/b\":{}\n" +
+                        ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+        assertTrue(mk.nodeExists("/c/b", null));
+    }
+
+    @Test
+    public void removeNodeAndMove() {
+        mk.commit("/", "+\"a\":{ \"b\" : {} }", null, null);
+
+        try {
+            mk.commit("/", "-\"a/b\"\n"
+                         + ">\"a/b\":\"c\"", null, null);
+            fail("Expected expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void removeNodeWithNestedChildrenAndMove() {
+        mk.commit("/", "+\"a\":{ \"b\" : { \"c\" : { \"d\" : {} } } }", null, null);
+        mk.commit("/", "-\"a/b/c/d\"\n"
+                     + ">\"a\" : \"e\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/e/b/c", null));
+        assertFalse(mk.nodeExists("/e/b/c/d", null));
+    }
+
+    @Test
+    public void removeNodeAndMoveParent() {
+        mk.commit("/", "+\"a\":{ \"b\" : {} }", null, null);
+        mk.commit("/", "-\"a/b\"\n"
+                     + ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+        assertFalse(mk.nodeExists("/c/b", null));
+    }
+
+    @Test
+    public void setPropertyAndMove() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "^\"a/key1\": \"value1\"\n" +
+                        ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/c", null));
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "c/key1", "value1");
+    }
+
+    @Test
+    public void setNestedPropertyAndMove() {
+        mk.commit("/", "+\"a\":{ \"b\" : {} }", null, null);
+        mk.commit("/", "^\"a/b/key1\": \"value1\"\n" +
+                        ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+        assertTrue(mk.nodeExists("/c/b", null));
+
+        String nodes = mk.getNodes("/", null, 2 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "c/b/key1", "value1");
+    }
+
+    @Test
+    public void modifyParentAddPropertyAndMove() {
+        mk.commit("/", "+\"a\":{}", null, null);
+        mk.commit("/", "+\"b\" : {}\n"
+                     + "^\"a/key1\": \"value1\"\n"
+                     + ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyValue(obj, "c/key1", "value1");
+    }
+
+    @Test
+    public void removePropertyAndMove() {
+        mk.commit("/", "+\"a\":{ \"b\" : { \"key1\" : \"value1\" } }", null, null);
+        mk.commit("/", "^\"a/b/key1\": null\n"
+                     + ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertFalse(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+        assertTrue(mk.nodeExists("/c/b", null));
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyNotExists(obj, "c/b/key1");
+    }
+
+    @Test
+    public void removeNestedPropertyAndMove() {
+        mk.commit("/", "+\"a\":{ \"key1\" : \"value1\"}", null, null);
+        mk.commit("/", "^\"a/key1\" : null\n"
+                     + ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/c", null));
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyNotExists(obj, "c/key1");
+    }
+
+    @Test
+    public void modifyParentRemovePropertyAndMove() {
+        mk.commit("/", "+\"a\":{ \"key1\" : \"value1\"}", null, null);
+        mk.commit("/", "+\"b\" : {}\n"
+                     + "^\"a/key1\" : null\n"
+                     + ">\"a\":\"c\"", null, null);
+
+        assertFalse(mk.nodeExists("/a", null));
+        assertTrue(mk.nodeExists("/b", null));
+        assertTrue(mk.nodeExists("/c", null));
+
+        String nodes = mk.getNodes("/", null, 1 /*depth*/, 0 /*offset*/, -1 /*maxChildNodes*/, null /*filter*/);
+        JSONObject obj = parseJSONObject(nodes);
+        assertPropertyNotExists(obj, "c/key1");
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,34 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
+ * with emphasis on remove node and property operations.
+ */
+public class MongoMKCommitRemoveTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void removeSingleNode() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+
+        mk.commit("/", "-\"a\"", null, null);
+        childCount = mk.getChildNodeCount("/", null);
+        assertEquals(0, childCount);
+    }
+
+    @Test
+    public void removeNonExistentNode() throws Exception {
+        try {
+            mk.commit("/", "-\"a\"", null, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,220 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
+/**
+ * Tests for MicroKernel#diff
+ */
+public class MongoMKDiffTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void addPathOneLevel() {
+        String rev0 = mk.getHeadRevision();
+
+        String rev1 = mk.commit("/", "+\"level1\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        mk.commit("", reverseDiff, null, null);
+        assertFalse(mk.nodeExists("/level1", null));
+    }
+
+    @Test
+    public void addPathTwoLevels() {
+        String rev0 = mk.getHeadRevision();
+
+        String rev1 = mk.commit("/", "+\"level1\":{}", null, null);
+        rev1 = mk.commit("/", "+\"level1/level2\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        mk.commit("", reverseDiff, null, null);
+        assertFalse(mk.nodeExists("/level1", null));
+        assertFalse(mk.nodeExists("/level1/level2", null));
+    }
+
+    @Test
+    public void addPathTwoSameLevels() {
+        String rev0 = mk.getHeadRevision();
+
+        String rev1 = mk.commit("/", "+\"level1a\":{}", null, null);
+        rev1 = mk.commit("/", "+\"level1b\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1a", null));
+        assertTrue(mk.nodeExists("/level1b", null));
+
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        mk.commit("", reverseDiff, null, null);
+        assertFalse(mk.nodeExists("/level1a", null));
+        assertFalse(mk.nodeExists("/level1b", null));
+    }
+
+    @Test
+    public void removePath() {
+        // Add level1 & level1/level2
+        String rev0 = mk.commit("/","+\"level1\":{}" +
+                "+\"level1/level2\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+
+        // Remove level1/level2
+        String rev1 = mk.commit("/", "-\"level1/level2\"", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertFalse(mk.nodeExists("/level1/level2", null));
+
+        // Generate reverseDiff from rev1 to rev0
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        // Commit the reverseDiff and check rev0 state is restored
+        mk.commit("", reverseDiff, null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+
+        // Remove level1 at rev0
+        String rev2 = mk.commit("/", "-\"level1\"", rev0, null);
+        assertFalse(mk.nodeExists("/level1", null));
+        assertFalse(mk.nodeExists("/level1/level2", null));
+
+        // Generate reverseDiff from rev2 to rev0
+        reverseDiff = mk.diff(rev2, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        // Commit the reverseDiff and check rev0 state is restored
+        mk.commit("", reverseDiff, null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+    }
+
+    @Test
+    public void movePath() {
+        String rev1 = mk.commit("/", "+\"level1\":{}", null, null);
+        rev1 = mk.commit("/", "+\"level1/level2\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+
+        String rev2 = mk.commit("/", ">\"level1\" : \"level1new\"", null, null);
+        assertFalse(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1new", null));
+        assertTrue(mk.nodeExists("/level1new/level2", null));
+
+        String reverseDiff = mk.diff(rev2, rev1, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        mk.commit("", reverseDiff, null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+        assertFalse(mk.nodeExists("/level1new", null));
+        assertFalse(mk.nodeExists("/level1new/level2", null));
+    }
+
+    @Test
+    public void copyPath() {
+        String rev1 = mk.commit("/", "+\"level1\":{}", null, null);
+        rev1 = mk.commit("/", "+\"level1/level2\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+
+        String rev2 = mk.commit("/", "*\"level1\" : \"level1new\"", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1new", null));
+        assertTrue(mk.nodeExists("/level1new/level2", null));
+
+        String reverseDiff = mk.diff(rev2, rev1, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        mk.commit("", reverseDiff, null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        assertTrue(mk.nodeExists("/level1/level2", null));
+        assertFalse(mk.nodeExists("/level1new", null));
+        assertFalse(mk.nodeExists("/level1new/level2", null));
+    }
+
+    @Test
+    public void setProperty() {
+        String rev0 = mk.commit("/", "+\"level1\":{}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+
+        // Add property.
+        String rev1 = mk.commit("/", "^\"level1/prop1\": \"value1\"", null, null);
+        JSONObject obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyExists(obj, "prop1");
+
+        // Generate reverseDiff from rev1 to rev0
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        // Commit the reverseDiff and check property is gone.
+        mk.commit("", reverseDiff, null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyNotExists(obj, "prop1");
+    }
+
+    @Test
+    public void removeProperty() {
+        String rev0 = mk.commit("/", "+\"level1\":{ \"prop1\" : \"value\"}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        JSONObject obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyExists(obj, "prop1");
+
+        // Remove property
+        String rev1 = mk.commit("/", "^\"level1/prop1\" : null", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyNotExists(obj, "prop1");
+
+        // Generate reverseDiff from rev1 to rev0
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        // Commit the reverseDiff and check property is added back.
+        mk.commit("", reverseDiff, null, null);
+        obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyExists(obj, "prop1");
+    }
+
+    @Test
+    public void changeProperty() {
+        String rev0 = mk.commit("/", "+\"level1\":{ \"prop1\" : \"value1\"}", null, null);
+        assertTrue(mk.nodeExists("/level1", null));
+        JSONObject obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyValue(obj, "prop1", "value1");
+
+        // Change property
+        String rev1 = mk.commit("/", "^\"level1/prop1\" : \"value2\"", null, null);
+        obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyValue(obj, "prop1", "value2");
+
+        // Generate reverseDiff from rev1 to rev0
+        String reverseDiff = mk.diff(rev1, rev0, null, -1);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        // Commit the reverseDiff and check property is set back.
+        mk.commit("", reverseDiff, null, null);
+        obj = parseJSONObject(mk.getNodes("/level1", null, 1, 0, -1, null));
+        assertPropertyValue(obj, "prop1", "value1");
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,77 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MongoMicroKernel#getChildNodeCount(String, String)}
+ */
+public class MongoMKGetChildCountTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void noChild() throws Exception {
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(0, childCount);
+    }
+
+    @Test
+    public void singleChild() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+    }
+
+    @Test
+    public void multipleChilden() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\": {}, \"c\": {}, \"d\" : {} }", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+
+        childCount = mk.getChildNodeCount("/a", null);
+        assertEquals(3, childCount);
+
+        childCount = mk.getChildNodeCount("/a/b", null);
+        assertEquals(0, childCount);
+
+        childCount = mk.getChildNodeCount("/a/c", null);
+        assertEquals(0, childCount);
+
+        childCount = mk.getChildNodeCount("/a/d", null);
+        assertEquals(0, childCount);
+    }
+
+    @Test
+    public void multipleNestedChildren() throws Exception {
+        mk.commit("/", "+\"a\" : { \"b\": { \"c\" : { \"d\" : {} } } }", null, null);
+
+        long childCount = mk.getChildNodeCount("/", null);
+        assertEquals(1, childCount);
+
+        childCount = mk.getChildNodeCount("/a", null);
+        assertEquals(1, childCount);
+
+        childCount = mk.getChildNodeCount("/a/b", null);
+        assertEquals(1, childCount);
+
+        childCount = mk.getChildNodeCount("/a/b/c", null);
+        assertEquals(1, childCount);
+
+        childCount = mk.getChildNodeCount("/a/b/c/d", null);
+        assertEquals(0, childCount);
+    }
+
+    @Test
+    public void nonExistingPath() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+
+        try {
+            mk.getChildNodeCount("/nonexisting", null);
+            fail("Expected: non-existing path exception");
+        } catch (Exception expected){}
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Copied: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java (from r1407101, jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java&r1=1407101&r2=1407119&rev=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/query/FetchHeadQuery.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java Thu Nov  8 15:17:50 2012
@@ -14,32 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk.query;
+package org.apache.jackrabbit.mongomk.impl;
 
-import org.apache.jackrabbit.mongomk.impl.MongoConnection;
-import org.apache.jackrabbit.mongomk.model.HeadMongo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 
-import com.mongodb.DBCollection;
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.junit.Test;
 
 /**
- * An query for fetching the current head.
- *
- * @author <a href="mailto:pmarx@adobe.com>Philipp Marx</a>
+ * Tests for {@code MongoMicroKernel#getHeadRevision()}.
  */
-public class FetchHeadQuery extends AbstractQuery<HeadMongo> {
+public class MongoMKGetHeadRevisionTest extends BaseMongoMicroKernelTest {
 
-    /**
-     * Constructs a new {@code FetchHeadQuery}.
-     *
-     * @param mongoConnection The {@link MongoConnection}.
-     */
-    public FetchHeadQuery(MongoConnection mongoConnection) {
-        super(mongoConnection);
-    }
+    @Test
+    public void simple() throws Exception {
+        SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
+        String rev1 = scenario.create();
+
+        String rev2 = mk.getHeadRevision();
+        assertEquals(rev1, rev2);
 
-    @Override
-    public HeadMongo execute() throws Exception {
-        DBCollection headCollection = mongoConnection.getHeadCollection();
-        return (HeadMongo)headCollection.findOne();
+        String rev3 = scenario.delete_A();
+        assertFalse(rev3 == rev2);
     }
-}
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetJournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetJournalTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetJournalTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetJournalTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,41 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
+/**
+ * Tests for {@code MongoMicroKernel#getJournal(String, String, String)}
+ */
+public class MongoMKGetJournalTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void simple() throws Exception {
+        String fromDiff = "+\"a\" : {}";
+        String fromMsg = "Add /a";
+        String fromRev = mk.commit("/", fromDiff, null, fromMsg);
+
+        String toDiff = "+\"b\" : {}";
+        String toMsg = "Add /b";
+        String toRev = mk.commit("/", toDiff, null, toMsg);
+
+        JSONArray array = parseJSONArray(mk.getJournal(fromRev, toRev, "/"));
+        assertEquals(2, array.size());
+
+        JSONObject rev = getObjectArrayEntry(array, 0);
+        assertPropertyExists(rev, "id", String.class);
+        assertPropertyExists(rev, "ts", Long.class);
+        assertPropertyValue(rev, "msg", fromMsg);
+        assertPropertyValue(rev, "changes", fromDiff);
+
+        rev = getObjectArrayEntry(array, 1);
+        assertPropertyExists(rev, "id", String.class);
+        assertPropertyExists(rev, "ts", Long.class);
+        assertPropertyValue(rev, "msg", toMsg);
+        assertPropertyValue(rev, "changes", toDiff);
+    }
+
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetJournalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetJournalTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Copied: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthGridFSTest.java (from r1407101, jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthGridFSTest.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthGridFSTest.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java&r1=1407101&r2=1407119&rev=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthGridFSTest.java Thu Nov  8 15:17:50 2012
@@ -14,46 +14,54 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk.command;
+package org.apache.jackrabbit.mongomk.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 
-import org.apache.jackrabbit.mongomk.BaseMongoTest;
-import org.apache.jackrabbit.mongomk.command.GetBlobLengthCommandMongo;
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
 import org.junit.Test;
 
-import com.mongodb.gridfs.GridFS;
-import com.mongodb.gridfs.GridFSInputFile;
+/**
+ * Tests for {@code MongoMicroKernel#getLength(String)}
+ */
+public class MongoMKGetLengthGridFSTest extends BaseMongoMicroKernelTest {
 
-public class GetBlobLengthCommandMongoTest extends BaseMongoTest {
+    @Test
+    public void nonExistent() throws Exception {
+        try {
+            mk.getLength("nonExistentBlob");
+            fail("Exception expected");
+        } catch (Exception expected) {
+        }
+    }
 
     @Test
-    public void testGetBlobLength() throws Exception {
-        int blobLength = 100;
-        String blobId = createAndWriteBlob(blobLength);
+    public void small() throws Exception {
+        getLength(1024);
+    }
 
-        GetBlobLengthCommandMongo command = new GetBlobLengthCommandMongo(mongoConnection, blobId);
-        long length = command.execute();
-        assertEquals(blobLength, length);
+    @Test
+    public void medium() throws Exception {
+        getLength(1024 * 1024);
     }
 
     @Test
-    public void testNonExistantBlobLength() throws Exception {
-        GetBlobLengthCommandMongo command = new GetBlobLengthCommandMongo(mongoConnection,
-                "nonExistantBlobId");
-        try {
-            command.execute();
-            fail("Exception expected");
-        } catch (Exception expected) {
-        }
+    public void large() throws Exception {
+        getLength(20 * 1024 * 1024);
+    }
+
+    private void getLength(int blobLength) throws Exception {
+        String blobId = createAndWriteBlob(blobLength);
+        long length = mk.getLength(blobId);
+        assertEquals(blobLength, length);
     }
 
     private String createAndWriteBlob(int blobLength) {
         byte[] blob = createBlob(blobLength);
-        return writeBlob(blob);
+        return mk.write(new ByteArrayInputStream(blob));
     }
 
     private byte[] createBlob(int blobLength) {
@@ -63,11 +71,4 @@ public class GetBlobLengthCommandMongoTe
         }
         return blob;
     }
-
-    private String writeBlob(byte[] blob) {
-        GridFS gridFS = mongoConnection.getGridFS();
-        GridFSInputFile gridFSInputFile = gridFS.createFile(new ByteArrayInputStream(blob), true);
-        gridFSInputFile.save();
-        return gridFSInputFile.getMD5();
-    }
-}
+}
\ No newline at end of file

Copied: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthTest.java (from r1407101, jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthTest.java?p2=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthTest.java&p1=jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java&r1=1407101&r2=1407119&rev=1407119&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/command/GetBlobLengthCommandMongoTest.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthTest.java Thu Nov  8 15:17:50 2012
@@ -14,46 +14,73 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mongomk.command;
+package org.apache.jackrabbit.mongomk.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
 
-import org.apache.jackrabbit.mongomk.BaseMongoTest;
-import org.apache.jackrabbit.mongomk.command.GetBlobLengthCommandMongo;
+import org.apache.jackrabbit.mk.blobs.BlobStore;
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.apache.jackrabbit.mongomk.MongoAssert;
+import org.apache.jackrabbit.mongomk.impl.blob.MongoBlobStore;
+import org.junit.Before;
 import org.junit.Test;
 
-import com.mongodb.gridfs.GridFS;
-import com.mongodb.gridfs.GridFSInputFile;
+import com.mongodb.DB;
 
-public class GetBlobLengthCommandMongoTest extends BaseMongoTest {
-
-    @Test
-    public void testGetBlobLength() throws Exception {
-        int blobLength = 100;
-        String blobId = createAndWriteBlob(blobLength);
+/**
+ * Tests for {@code MongoMicroKernel#getLength(String)}
+ */
+public class MongoMKGetLengthTest extends BaseMongoMicroKernelTest {
 
-        GetBlobLengthCommandMongo command = new GetBlobLengthCommandMongo(mongoConnection, blobId);
-        long length = command.execute();
-        assertEquals(blobLength, length);
+    // Override to set the right blob store.
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        DB db = mongoConnection.getDB();
+        dropCollections(db);
+
+        MongoNodeStore nodeStore = new MongoNodeStore(db);
+        MongoAssert.setNodeStore(nodeStore);
+        BlobStore blobStore = new MongoBlobStore(db);
+        mk = new MongoMicroKernel(mongoConnection, nodeStore, blobStore);
     }
 
     @Test
-    public void testNonExistantBlobLength() throws Exception {
-        GetBlobLengthCommandMongo command = new GetBlobLengthCommandMongo(mongoConnection,
-                "nonExistantBlobId");
+    public void nonExistent() throws Exception {
         try {
-            command.execute();
+            mk.getLength("nonExistentBlob");
             fail("Exception expected");
         } catch (Exception expected) {
         }
     }
 
+    @Test
+    public void small() throws Exception {
+        getLength(1024);
+    }
+
+    @Test
+    public void medium() throws Exception {
+        getLength(1024 * 1024);
+    }
+
+    @Test
+    public void large() throws Exception {
+        getLength(20 * 1024 * 1024);
+    }
+
+    private void getLength(int blobLength) throws Exception {
+        String blobId = createAndWriteBlob(blobLength);
+        long length = mk.getLength(blobId);
+        assertEquals(blobLength, length);
+    }
+
     private String createAndWriteBlob(int blobLength) {
         byte[] blob = createBlob(blobLength);
-        return writeBlob(blob);
+        return mk.write(new ByteArrayInputStream(blob));
     }
 
     private byte[] createBlob(int blobLength) {
@@ -63,11 +90,4 @@ public class GetBlobLengthCommandMongoTe
         }
         return blob;
     }
-
-    private String writeBlob(byte[] blob) {
-        GridFS gridFS = mongoConnection.getGridFS();
-        GridFSInputFile gridFSInputFile = gridFS.createFile(new ByteArrayInputStream(blob), true);
-        gridFSInputFile.save();
-        return gridFSInputFile.getMD5();
-    }
-}
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetLengthTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.fail;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONObject;
+import org.junit.Test;
+
+/**
+ * Tests for {@code MongoMicroKernel#getHeadRevision()}.
+ */
+public class MongoMKGetNodesTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void invalidRevision() throws Exception {
+        try {
+            mk.getNodes("/", "invalid", 1, 0, -1, null);
+            fail("Exception expected");
+        } catch (Exception expected) {}
+    }
+
+    @Test
+    public void afterDelete() throws Exception {
+        SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
+        scenario.create();
+
+        JSONObject root = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, null));
+        assertPropertyValue(root, ":childNodeCount", 1L);
+
+        JSONObject a = resolveObjectValue(root, "a");
+        assertPropertyValue(a, ":childNodeCount", 2L);
+
+        scenario.delete_A();
+        root = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, null));
+        assertPropertyValue(root, ":childNodeCount", 0L);
+    }
+
+    @Test
+    public void depthNegative() throws Exception {
+        SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
+        scenario.create();
+
+        JSONObject root = parseJSONObject(mk.getNodes("/", null, -1, 0, -1, null));
+        assertPropertyValue(root, ":childNodeCount", 1L);
+    }
+
+    @Test
+    public void depthZero() throws Exception {
+        SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
+        scenario.create();
+
+        JSONObject root = parseJSONObject(mk.getNodes("/", null, 0, 0, -1, null));
+        assertPropertyValue(root, ":childNodeCount", 1L);
+
+        JSONObject a = resolveObjectValue(root, "a");
+        assertPropertyNotExists(a, "int");
+    }
+
+    @Test
+    public void depthOne() throws Exception {
+        SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
+        scenario.create();
+
+        JSONObject root = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, null));
+        assertPropertyValue(root, ":childNodeCount", 1L);
+
+        JSONObject a = resolveObjectValue(root, "a");
+        assertPropertyValue(a, ":childNodeCount", 2L);
+        assertPropertyValue(a, "int", 1L);
+
+        JSONObject b = resolveObjectValue(a, "b");
+        assertPropertyNotExists(b, "string");
+
+        JSONObject c = resolveObjectValue(a, "c");
+        assertPropertyNotExists(c, "bool");
+    }
+
+    @Test
+    public void depthLimitless() throws Exception {
+        SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
+        scenario.create();
+
+        //JSONObject root = parseJSONObject(mk.getNodes("/", null, 3450, 0, -1, null));
+        JSONObject root = parseJSONObject(mk.getNodes("/", null, Integer.MAX_VALUE, 0, -1, null));
+        assertPropertyValue(root, ":childNodeCount", 1L);
+
+        JSONObject a = resolveObjectValue(root, "a");
+        assertPropertyValue(a, ":childNodeCount", 2L);
+        assertPropertyValue(a, "int", 1L);
+
+        JSONObject b = resolveObjectValue(a, "b");
+        assertPropertyValue(b, "string", "foo");
+
+        JSONObject c = resolveObjectValue(a, "c");
+        assertPropertyValue(c, "bool", true);
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,87 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.json.simple.JSONArray;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MongoMicroKernel#getRevisionHistory(long, int, String)}
+ */
+public class MongoMKGetRevisionHistoryTest extends BaseMongoMicroKernelTest {
+
+    @Test
+    public void maxEntriesZero() throws Exception {
+        mk.commit("/", "+\"a\" : {}", null, null);
+        JSONArray array = parseJSONArray(mk.getRevisionHistory(0, 0, "/"));
+        assertEquals(0, array.size());
+    }
+
+    @Test
+    public void maxEntriesLimitless() throws Exception {
+        int count = 10;
+        for (int i = 0; i < count; i++) {
+            mk.commit("/", "+\"a" + i + "\" : {}", null, null);
+        }
+        JSONArray array = parseJSONArray(mk.getRevisionHistory(0, -1, "/"));
+        assertEquals(count + 1, array.size());
+    }
+
+    @Test
+    public void maxEntriesLimited() throws Exception {
+        int count = 10;
+        int limit = 4;
+
+        for (int i = 0; i < count; i++) {
+            mk.commit("/", "+\"a" + i + "\" : {}", null, null);
+        }
+        JSONArray array = parseJSONArray(mk.getRevisionHistory(0, limit, "/"));
+        assertEquals(limit, array.size());
+    }
+
+    @Test
+    public void path() throws Exception {
+        int count1 = 5;
+        for (int i = 0; i < count1; i++) {
+            mk.commit("/", "+\"a" + i + "\" : {}", null, null);
+        }
+        JSONArray array = parseJSONArray(mk.getRevisionHistory(0, -1, "/"));
+        assertEquals(count1 + 1, array.size());
+
+
+        int count2 = 5;
+        for (int i = 0; i < count2; i++) {
+            mk.commit("/a1", "+\"b" + i + "\" : {}", null, null);
+        }
+        array = parseJSONArray(mk.getRevisionHistory(0, -1, "/"));
+        assertEquals(count1 + 1 + count2, array.size());
+
+        array = parseJSONArray(mk.getRevisionHistory(0, -1, "/a1"));
+        assertEquals(count2 + 1, array.size());
+    }
+
+    @Test
+    public void since() throws Exception {
+        Thread.sleep(100); // To make sure there's a little delay since the initial commit.
+        long since1 = System.currentTimeMillis();
+        int count1 = 6;
+        for (int i = 0; i < count1; i++) {
+            mk.commit("/", "+\"a" + i + "\" : {}", null, null);
+        }
+        JSONArray array = parseJSONArray(mk.getRevisionHistory(since1, -1, "/"));
+        assertEquals(count1, array.size());
+
+
+        long since2 = System.currentTimeMillis();
+        int count2 = 4;
+        for (int i = 0; i < count2; i++) {
+            mk.commit("/", "+\"b" + i + "\" : {}", null, null);
+        }
+        array = parseJSONArray(mk.getRevisionHistory(since2, -1, "/"));
+        assertEquals(count2, array.size());
+
+        array = parseJSONArray(mk.getRevisionHistory(since1, -1, "/"));
+        assertEquals(count1 + count2, array.size());
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKLimitsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKLimitsTest.java?rev=1407119&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKLimitsTest.java (added)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKLimitsTest.java Thu Nov  8 15:17:50 2012
@@ -0,0 +1,68 @@
+package org.apache.jackrabbit.mongomk.impl;
+
+import java.util.Arrays;
+
+import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * FIXME - Look into these tests and see if we want to fix them somehow.
+ *
+ * Tests for MongoMicroKernel limits.
+ */
+public class MongoMKLimitsTest extends BaseMongoMicroKernelTest {
+
+    /**
+     * This test currently fails due to 1000 char limit in property sizes in
+     * MongoDB which affects path property. It also slows down as the test
+     * progresses.
+     */
+    @Test
+    @Ignore
+    public void pathLimit() throws Exception {
+        String path = "/";
+        String baseNodeName = "testingtestingtesting";
+        int numberOfCommits = 100;
+        String jsonDiff;
+        String message;
+
+        for (int i = 0; i < numberOfCommits; i++) {
+            jsonDiff = "+\"" + baseNodeName + i + "\" : {}";
+            message = "Add node n" + i;
+            mk.commit(path, jsonDiff, null, message);
+            if (!PathUtils.denotesRoot(path)) {
+                path += "/";
+            }
+            path += baseNodeName + i;
+        }
+    }
+
+    /**
+     * This currently fails due to 16MB DBObject size limitation from Mongo
+     * database.
+     */
+    @Test
+    @Ignore
+    public void overMaxBSONLimit() throws Exception {
+        String path = "/";
+        String baseNodeName = "N";
+        StringBuilder jsonDiff = new StringBuilder();
+        String message;
+        // create a 1 MB property
+        char[] chars = new char[1024 * 1024];
+
+        Arrays.fill(chars, '0');
+        String content = new String(chars);
+        // create 16+ MB diff
+        for (int i = 0; i < 16; i++) {
+            jsonDiff.append("+\"" + baseNodeName + i + "\" : {\"key\":\""
+                    + content + "\"}\n");
+        }
+        String diff = jsonDiff.toString();
+        message = "Commit diff size " + diff.getBytes().length;
+        System.out.println(message);
+        mk.commit(path, diff, null, message);
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKLimitsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKLimitsTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message