jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1433995 - /jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
Date Wed, 16 Jan 2013 15:47:49 GMT
Author: mreutegg
Date: Wed Jan 16 15:47:49 2013
New Revision: 1433995

URL: http://svn.apache.org/viewvc?rev=1433995&view=rev
Log:
OAK-535: MergeCommand reads complete tree into memory
- additional test

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java

Modified: 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=1433995&r1=1433994&r2=1433995&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
Wed Jan 16 15:47:49 2013
@@ -1,10 +1,15 @@
 package org.apache.jackrabbit.mongomk.impl;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 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.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mongomk.BaseMongoMicroKernelTest;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -338,6 +343,42 @@ public class MongoMKBranchMergeTest exte
         assertPropExists(rev, "/a/b", "p");
     }
 
+    @Test
+    @Ignore("OAK-535")
+    public void concurrentNonConflictingMerges() throws Exception {
+        int numThreads = 5;
+        mk.commit("/", "+\"test\":{}", null, null);
+        List<Thread> workers = new ArrayList<Thread>();
+        final List<Exception> exceptions = Collections.synchronizedList(new ArrayList<Exception>());
+        for (int i = 0; i < numThreads; i++) {
+            final String path = "/test/t" + i;
+            mk.commit("", "+\"" + path + "\":{}", null, null);
+            workers.add(new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        for (int i = 0; i < 100; i++) {
+                            String branchRev = mk.branch(null);
+                            branchRev = mk.commit(path, "+\"node" + i + "\":{}", branchRev,
null);
+                            mk.merge(branchRev, null);
+                        }
+                    } catch (MicroKernelException e) {
+                        exceptions.add(e);
+                    }
+                }
+            }));
+        }
+        for (Thread t : workers) {
+            t.start();
+        }
+        for (Thread t : workers) {
+            t.join();
+        }
+        if (!exceptions.isEmpty()) {
+            throw exceptions.get(0);
+        }
+    }
+
     private String addNodes(String rev, String...nodes) {
         for (String node : nodes) {
             rev = mk.commit("", "+\"" + node + "\":{}", rev, "");



Mime
View raw message