You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2013/07/11 09:49:53 UTC

svn commit: r1502138 - in /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk: IsolationTest.java MongoMKRebaseTest.java

Author: mreutegg
Date: Thu Jul 11 07:49:53 2013
New Revision: 1502138

URL: http://svn.apache.org/r1502138
Log:
OAK-893: MongoMK may fail with MicroKernelException under concurrent commits
- Move tests to separate class

Added:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/IsolationTest.java   (with props)
Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKRebaseTest.java

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/IsolationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/IsolationTest.java?rev=1502138&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/IsolationTest.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/IsolationTest.java Thu Jul 11 07:49:53 2013
@@ -0,0 +1,66 @@
+/*
+ * 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.oak.plugins.mongomk;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests if commits to branches and trunk are properly isolated and repository
+ * state on a given revision is stable.
+ */
+@Ignore("OAK-893")
+public class IsolationTest extends BaseMongoMKTest {
+
+    @Test
+    public void phantomReadOnBranch() {
+        String base = mk.commit("/", "+\"test\":{}", null, null);
+        String branchRev1 = mk.branch(base);
+        String branchRev2 = mk.branch(base);
+        branchRev1 = mk.commit("/test", "+\"node1\":{}", branchRev1, null);
+        branchRev2 = mk.commit("/test", "+\"node2\":{}", branchRev2, null);
+        String r = mk.commit("/test", "+\"node3\":{}", null, null);
+        // branchRev1 must not see node3 at this point
+        assertNodesNotExist(branchRev1, "/test/node3");
+
+        // this will make node3 visible to branchRev1
+        branchRev1 = mk.rebase(branchRev1, r);
+        assertNodesExist(branchRev1, "/test/node1", "/test/node3");
+        assertNodesNotExist(branchRev1, "/test/node2");
+
+        // merging second branch must not have an effect on
+        // rebased first branch
+        mk.merge(branchRev2, null);
+        assertNodesExist(branchRev1, "/test/node1", "/test/node3");
+        assertNodesNotExist(branchRev1, "/test/node2");
+    }
+
+    @Test
+    public void phantomReadOnTrunk() {
+        String base = mk.commit("/", "+\"test\":{}", null, null);
+        String branchRev1 = mk.branch(base);
+        branchRev1 = mk.commit("/test", "+\"node1\":{}", branchRev1, null);
+        String rev = mk.commit("/test", "+\"node2\":{}", null, null);
+        // rev must not see node1
+        assertNodesNotExist(rev, "/test/node1");
+
+        mk.merge(branchRev1, null);
+
+        // rev still must not see node1
+        assertNodesNotExist(rev, "/test/node1");
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/IsolationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKRebaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKRebaseTest.java?rev=1502138&r1=1502137&r2=1502138&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKRebaseTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMKRebaseTest.java Thu Jul 11 07:49:53 2013
@@ -181,22 +181,6 @@ public class MongoMKRebaseTest extends B
     }
 
     @Test
-    @Ignore("OAK-893")
-    public void phantomRead() {
-        String base = mk.commit("/", "+\"test\":{}", null, null);
-        String branchRev1 = mk.branch(base);
-        String branchRev2 = mk.branch(base);
-        branchRev1 = mk.commit("/test", "+\"node1\":{}", branchRev1, null);
-        branchRev2 = mk.commit("/test", "+\"node2\":{}", branchRev2, null);
-        String r = mk.commit("/test", "+\"node3\":{}", null, null);
-        branchRev1 = mk.rebase(branchRev1, r);
-        mk.merge(branchRev2, null);
-
-        assertNodesExist(branchRev1, "/test/node1", "/test/node3");
-        assertNodesNotExist(branchRev1, "/test/node2");
-    }
-
-    @Test
     @Ignore("Conflict handling")
     public void rebaseAddExistingNode() {
         mk.commit("", "+\"/x\":{}", null, null);