jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1466838 - in /jackrabbit/oak/trunk/oak-mongomk/src: main/java/org/apache/jackrabbit/mongomk/osgi/ test/java/org/apache/jackrabbit/mongomk/ test/java/org/apache/jackrabbit/mongomk/impl/ test/java/org/apache/jackrabbit/mongomk/impl/command/
Date Thu, 11 Apr 2013 11:32:31 GMT
Author: thomasm
Date: Thu Apr 11 11:32:30 2013
New Revision: 1466838

URL: http://svn.apache.org/r1466838
Log:
OAK-619 MongoMK: remove duplicate tests, fix checkstyle warnings

Removed:
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchMergeTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKBranchTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitMoveTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKDiffTest.java
Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/osgi/MongoMicroKernelService.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/AbstractMongoConnectionTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BlobTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoDocumentStoreTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKBranchMergeTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKCommitMoveTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKDiffTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/RandomizedClusterTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKNodeExistsTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKRebaseTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKWaitForCommitTest.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/SimpleNodeScenario.java
    jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/ConcurrentWriteMultipleMkMongoTest.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/osgi/MongoMicroKernelService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/osgi/MongoMicroKernelService.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/osgi/MongoMicroKernelService.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/osgi/MongoMicroKernelService.java
Thu Apr 11 11:32:30 2013
@@ -38,7 +38,9 @@ import org.slf4j.LoggerFactory;
 
 import com.mongodb.DB;
 
-
+/**
+ * The OSGi service to start/stop a MongoMK instance.
+ */
 @Component(metatype = true,
         label = "%oak.mongomk.label",
         description = "%oak.mongomk.description",

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/AbstractMongoConnectionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/AbstractMongoConnectionTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/AbstractMongoConnectionTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/AbstractMongoConnectionTest.java
Thu Apr 11 11:32:30 2013
@@ -43,10 +43,10 @@ public class AbstractMongoConnectionTest
 
     protected static Boolean mongoAvailable;
 
+    private static Exception mongoException;
+    
     protected MongoConnection mongoConnection;
 
-    private static Exception mongoException = null;
-
     @BeforeClass
     public static void setUpBeforeClass() throws Exception {
         if (mongoAvailable == null) {

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BlobTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BlobTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BlobTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/BlobTest.java
Thu Apr 11 11:32:30 2013
@@ -22,6 +22,8 @@ import java.util.ArrayList;
 import java.util.Random;
 
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.mongodb.DB;
 
@@ -29,6 +31,8 @@ import com.mongodb.DB;
  * Tests the blob store.
  */
 public class BlobTest {
+    
+    private static final Logger LOG = LoggerFactory.getLogger(RandomizedClusterTest.class);
 
 //     private static final boolean MONGO_DB = true;
 //     private static final long TOTAL_SIZE = 1 * 1024 * 1024 * 1024;
@@ -68,10 +72,7 @@ public class BlobTest {
     }
     
     private static void log(String s) {
-        if (TOTAL_SIZE < 10 * 1024 * 1024) {
-            return;
-        }
-        System.out.println(s);
+        LOG.info(s);
     }
     
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoDocumentStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoDocumentStoreTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoDocumentStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoDocumentStoreTest.java
Thu Apr 11 11:32:30 2013
@@ -29,6 +29,8 @@ import java.util.concurrent.TimeUnit;
 import org.apache.jackrabbit.mongomk.DocumentStore.Collection;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.mongodb.BasicDBObject;
 import com.mongodb.DBCollection;
@@ -39,6 +41,8 @@ import com.mongodb.WriteResult;
  * Tests the document store.
  */
 public class MongoDocumentStoreTest {
+    
+    private static final Logger LOG = LoggerFactory.getLogger(MongoDocumentStoreTest.class);
 
 //    private static final boolean MONGO_DB = true;
 //    private static final int NODE_COUNT = 2000;
@@ -182,10 +186,7 @@ public class MongoDocumentStoreTest {
     }
 
     private static void log(String s) {
-        if (NODE_COUNT < 100) {
-            return;
-        }
-        System.out.println(s);
+        LOG.info(s);
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKBranchMergeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKBranchMergeTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKBranchMergeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKBranchMergeTest.java
Thu Apr 11 11:32:30 2013
@@ -296,7 +296,9 @@ public class MongoMKBranchMergeTest exte
         try {
             mk.merge(branchRev, "");
             fail("Expected: Concurrent modification exception");
-        } catch (Exception expected){}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -309,7 +311,9 @@ public class MongoMKBranchMergeTest exte
         try {
             branchRev = addNodes(branchRev, "/root");
             fail("Should not be able to add the same root node twice");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -325,7 +329,9 @@ public class MongoMKBranchMergeTest exte
         try {
             branchRev = addNodes(branchRev, "/root/child1");
             fail("Should not be able to add the same root node twice");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -350,7 +356,9 @@ public class MongoMKBranchMergeTest exte
         try {
             mk.merge(rev, "");
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKCommitMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKCommitMoveTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKCommitMoveTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKCommitMoveTest.java
Thu Apr 11 11:32:30 2013
@@ -49,7 +49,9 @@ public class MongoMKCommitMoveTest exten
         try {
             mk.commit("/", ">\"b\" : \"a\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -133,7 +135,9 @@ public class MongoMKCommitMoveTest exten
         try {
             mk.commit("/", ">\"b\" : \"c\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -144,7 +148,9 @@ public class MongoMKCommitMoveTest exten
         try {
             mk.commit("/", ">\"c\" : \"a/b\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -215,7 +221,9 @@ public class MongoMKCommitMoveTest exten
             mk.commit("/", "-\"a/b\"\n"
                          + ">\"a/b\":\"c\"", null, null);
             fail("Expected expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKDiffTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKDiffTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKDiffTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/MongoMKDiffTest.java
Thu Apr 11 11:32:30 2013
@@ -30,7 +30,7 @@ import static org.junit.Assert.assertTru
 public class MongoMKDiffTest extends BaseMongoMKTest {
 
     @Test
-    public void oak_596() {
+    public void oak596() {
         String rev1 = mk.commit("/", "+\"node1\":{\"node2\":{\"prop1\":\"val1\",\"prop2\":\"val2\"}}",
null, null);
         String rev2 = mk.commit("/", "^\"node1/node2/prop1\":\"val1 new\" ^\"node1/node2/prop2\":null",
null, null);
 
@@ -94,7 +94,8 @@ public class MongoMKDiffTest extends Bas
     @Ignore("New MongoMK only supports depth 0")
     public void removePath() {
         // Add level1 & level1/level2
-        String rev0 = mk.commit("/","+\"level1\":{}" +
+        String rev0 = mk.commit("/", 
+                "+\"level1\":{}" +
                 "+\"level1/level2\":{}", null, null);
         assertTrue(mk.nodeExists("/level1", null));
         assertTrue(mk.nodeExists("/level1/level2", null));

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/RandomizedClusterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/RandomizedClusterTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/RandomizedClusterTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/RandomizedClusterTest.java
Thu Apr 11 11:32:30 2013
@@ -176,8 +176,6 @@ int todo2;                
     private void log(String msg) {
         msg = opId + ": [" + mkId + "] " + msg + "\n";
         log.append(msg);
-int test;        
-System.out.print(msg);
     }
     
     private void get(String node) {

Modified: 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=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitAddTest.java
Thu Apr 11 11:32:30 2013
@@ -30,8 +30,7 @@ import com.jamonapi.Monitor;
 import com.jamonapi.MonitorFactory;
 
 /**
- * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
- * with emphasis on add node and property operations.
+ * Tests for add node and property operations.
  */
 public class MongoMKCommitAddTest extends BaseMongoMicroKernelTest {
 
@@ -52,20 +51,20 @@ public class MongoMKCommitAddTest extend
     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));
+        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));
+        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
@@ -75,9 +74,9 @@ public class MongoMKCommitAddTest extend
         mk.commit("/a/b", "+\"c\" : {}", null, null);
         mk.commit("/a", "+\"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", null));
+        assertTrue(mk.nodeExists("/a/b", null));
+        assertTrue(mk.nodeExists("/a/b/c", null));
         assertTrue(mk.nodeExists("/a/d", null));
     }
 
@@ -111,7 +110,9 @@ public class MongoMKCommitAddTest extend
         try {
             mk.commit("/", "+\"a\" : {}", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -175,7 +176,9 @@ public class MongoMKCommitAddTest extend
         try {
             mk.commit("/", "^\"a/key1\" : \"value1\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -203,12 +206,18 @@ public class MongoMKCommitAddTest extend
         for (int i = 0; i < 1000; i++) {
             commitMonitor.start();
             String diff = "+\"a"+i+"\" : {} +\"b"+i+"\" : {} +\"c"+i+"\" : {}";
-            if (debug) System.out.println("Committing: " + diff);
+            if (debug) {
+                System.out.println("Committing: " + diff);
+            }
             mk.commit("/", diff, null, null);
             commitMonitor.stop();
-            if (debug) System.out.println("Committed in " + commitMonitor.getLastValue()
+ "ms");
+            if (debug) {
+                System.out.println("Committed in " + commitMonitor.getLastValue() + "ms");
+            }
+        }
+        if (debug) {
+            System.out.println("Final Result:" + commitMonitor);
         }
-        if (debug) System.out.println("Final Result:" + commitMonitor);
     }
 
     @Test

Modified: 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=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitCopyTest.java
Thu Apr 11 11:32:30 2013
@@ -26,8 +26,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 /**
- * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
- * with emphasis on copy operations.
+ * Tests with emphasis on copy operations.
  */
 public class MongoMKCommitCopyTest extends BaseMongoMicroKernelTest {
 
@@ -113,7 +112,9 @@ public class MongoMKCommitCopyTest exten
         try {
             mk.commit("/", "*\"b\" : \"c\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -124,7 +125,9 @@ public class MongoMKCommitCopyTest exten
         try {
             mk.commit("/", "*\"c\" : \"a/b\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -192,7 +195,9 @@ public class MongoMKCommitCopyTest exten
             mk.commit("/", "-\"a/b\"\n" +
                     "*\"a/b\":\"c\"", null, null);
             fail("Expected expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test

Modified: 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=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKCommitRemoveTest.java
Thu Apr 11 11:32:30 2013
@@ -26,8 +26,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 /**
- * Tests for {@link MongoMicroKernel#commit(String, String, String, String)}
- * with emphasis on remove node and property operations.
+ * Tests with emphasis on remove node and property operations.
  */
 public class MongoMKCommitRemoveTest extends BaseMongoMicroKernelTest {
 
@@ -49,7 +48,9 @@ public class MongoMKCommitRemoveTest ext
         try {
             mk.commit("/", "-\"a\"", null, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test

Modified: 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=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetChildCountTest.java
Thu Apr 11 11:32:30 2013
@@ -24,7 +24,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 /**
- * Tests for {@link MongoMicroKernel#getChildNodeCount(String, String)}
+ * Tests getChildNodeCount.
  */
 public class MongoMKGetChildCountTest extends BaseMongoMicroKernelTest {
 
@@ -93,6 +93,8 @@ public class MongoMKGetChildCountTest ex
         try {
             mk.getChildNodeCount("/nonexisting", null);
             fail("Expected: non-existing path exception");
-        } catch (Exception expected){}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetHeadRevisionTest.java
Thu Apr 11 11:32:30 2013
@@ -35,7 +35,7 @@ public class MongoMKGetHeadRevisionTest 
         String rev2 = mk.getHeadRevision();
         assertEquals(rev1, rev2);
 
-        String rev3 = scenario.delete_A();
+        String rev3 = scenario.deleteA();
         assertFalse(rev3.equals(rev2));
     }
 }
\ No newline at end of file

Modified: 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=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetNodesTest.java
Thu Apr 11 11:32:30 2013
@@ -24,7 +24,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 /**
- * Tests for {@code MongoMicroKernel#getHeadRevision()}.
+ * Tests for getHeadRevision().
  */
 public class MongoMKGetNodesTest extends BaseMongoMicroKernelTest {
 
@@ -33,7 +33,9 @@ public class MongoMKGetNodesTest extends
         try {
             mk.getNodes("/", "123", 1, 0, -1, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -41,7 +43,9 @@ public class MongoMKGetNodesTest extends
         try {
             mk.getNodes("/", "invalid", 1, 0, -1, null);
             fail("Exception expected");
-        } catch (Exception expected) {}
+        } catch (Exception expected) {
+            // expected
+        }
     }
 
     @Test
@@ -56,7 +60,7 @@ public class MongoMKGetNodesTest extends
         JSONObject a = resolveObjectValue(root, "a");
         assertPropertyValue(a, ":childNodeCount", 2L);
 
-        scenario.delete_A();
+        scenario.deleteA();
         root = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, null));
         assertPropertyValue(root, ":childNodeCount", 0L);
     }

Modified: 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=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKGetRevisionHistoryTest.java
Thu Apr 11 11:32:30 2013
@@ -24,7 +24,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 /**
- * Tests for {@link MongoMicroKernel#getRevisionHistory(long, int, String)}
+ * Tests for getRevisionHistory
  */
 public class MongoMKGetRevisionHistoryTest extends BaseMongoMicroKernelTest {
 
@@ -85,7 +85,8 @@ public class MongoMKGetRevisionHistoryTe
     @Test
     @Ignore    
     public void since() throws Exception {
-        Thread.sleep(100); // To make sure there's a little delay since the initial commit.
+        // To make sure there's a little delay since the initial commit.
+        Thread.sleep(100); 
         long since1 = System.currentTimeMillis();
         int count1 = 6;
         for (int i = 0; i < count1; i++) {

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKNodeExistsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKNodeExistsTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKNodeExistsTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKNodeExistsTest.java
Thu Apr 11 11:32:30 2013
@@ -24,7 +24,7 @@ import org.apache.jackrabbit.mongomk.Bas
 import org.junit.Test;
 
 /**
- * Tests for {@code MongoMicroKernel#nodeExists(String, String)}
+ * Tests for nodeExists.
  */
 public class MongoMKNodeExistsTest extends BaseMongoMicroKernelTest {
 
@@ -39,7 +39,7 @@ public class MongoMKNodeExistsTest exten
         exists = mk.nodeExists("/a/b", revisionId);
         assertTrue(exists);
 
-        revisionId = scenario.delete_A();
+        revisionId = scenario.deleteA();
 
         exists = mk.nodeExists("/a", revisionId);
         assertFalse(exists);
@@ -56,7 +56,7 @@ public class MongoMKNodeExistsTest exten
         boolean exists = mk.nodeExists("/a", null);
         assertTrue(exists);
 
-        scenario.delete_A();
+        scenario.deleteA();
 
         exists = mk.nodeExists("/a", null);
         assertFalse(exists);
@@ -71,6 +71,7 @@ public class MongoMKNodeExistsTest exten
             mk.nodeExists("/a", "123456789");
             fail("Expected: Invalid revision id exception");
         } catch (Exception expected) {
+            // expected
         }
     }
 
@@ -82,7 +83,7 @@ public class MongoMKNodeExistsTest exten
         boolean exists = mk.nodeExists("/a/b", null);
         assertTrue(exists);
 
-        scenario.delete_A();
+        scenario.deleteA();
         exists = mk.nodeExists("/a/b", null);
         assertFalse(exists);
     }
@@ -111,7 +112,7 @@ public class MongoMKNodeExistsTest exten
     public void existsInOldRevNotInNewRev() throws Exception {
         SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
         String rev1 = scenario.create();
-        String rev2 = scenario.delete_A();
+        String rev2 = scenario.deleteA();
 
         boolean exists = mk.nodeExists("/a", rev1);
         assertTrue(exists);
@@ -125,7 +126,7 @@ public class MongoMKNodeExistsTest exten
         SimpleNodeScenario scenario = new SimpleNodeScenario(mk);
         scenario.create();
 
-        scenario.delete_B();
+        scenario.deleteB();
         boolean exists = mk.nodeExists("/a/b", null);
         assertFalse(exists);
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKRebaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKRebaseTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKRebaseTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKRebaseTest.java
Thu Apr 11 11:32:30 2013
@@ -57,7 +57,7 @@ public class MongoMKRebaseTest extends B
         assertEquals("{\":childNodeCount\":1,\"a\":{}}", mk.getNodes("/", rebased, 0, 0,
-1, null));
         assertEquals("{\":childNodeCount\":1,\"a\":{}}", mk.getNodes("/", null, 0, 0, -1,
null));
         assertEquals(trunk, mk.getHeadRevision());
-        assertFalse((trunk.equals(rebased)));
+        assertFalse(trunk.equals(rebased));
     }
 
     @Test
@@ -66,7 +66,7 @@ public class MongoMKRebaseTest extends B
         mk.commit("", "+\"/x\":{}", null, null);
         String branch = mk.branch(null);
         branch = mk.commit("", "+\"/x/b\":{}", branch, null);
-        String trunk = mk.commit("", "+\"/x/a\":{}", null, null);
+        mk.commit("", "+\"/x/a\":{}", null, null);
         String rebased = mk.rebase(branch, null);
 
         assertEquals(1, mk.getChildNodeCount("/x", null));
@@ -86,7 +86,7 @@ public class MongoMKRebaseTest extends B
         mk.commit("", "+\"/x\":{\"y\":{}}", null, null);
         String branch = mk.branch(null);
         branch = mk.commit("", "-\"/x/y\"", branch, null);
-        String trunk = mk.commit("", "+\"/x/a\":{}", null, null);
+        mk.commit("", "+\"/x/a\":{}", null, null);
         String rebased = mk.rebase(branch, null);
 
         assertEquals(2, mk.getChildNodeCount("/x", null));
@@ -105,7 +105,7 @@ public class MongoMKRebaseTest extends B
         mk.commit("", "+\"/x\":{\"y\":{}}", null, null);
         String branch = mk.branch(null);
         branch = mk.commit("", "^\"/x/y/p\":42", branch, null);
-        String trunk = mk.commit("", "^\"/x/y/q\":99", null, null);
+        mk.commit("", "^\"/x/y/q\":99", null, null);
         String rebased = mk.rebase(branch, null);
 
         String branchNode = mk.getNodes("/x/y", branch, 0, 0, -1, null);
@@ -127,7 +127,7 @@ public class MongoMKRebaseTest extends B
         mk.commit("", "+\"/x\":{\"y\":{\"p\":42}}", null, null);
         String branch = mk.branch(null);
         branch = mk.commit("", "^\"/x/y/p\":null", branch, null);
-        String trunk = mk.commit("", "^\"/x/y/q\":99", null, null);
+        mk.commit("", "^\"/x/y/q\":99", null, null);
         String rebased = mk.rebase(branch, null);
 
         String branchNode = mk.getNodes("/x/y", branch, 0, 0, -1, null);
@@ -149,7 +149,7 @@ public class MongoMKRebaseTest extends B
         mk.commit("", "+\"/x\":{\"y\":{\"p\":42}}", null, null);
         String branch = mk.branch(null);
         branch = mk.commit("", "^\"/x/y/p\":41", branch, null);
-        String trunk = mk.commit("", "^\"/x/y/q\":99", null, null);
+        mk.commit("", "^\"/x/y/q\":99", null, null);
         String rebased = mk.rebase(branch, null);
 
         String branchNode = mk.getNodes("/x/y", branch, 0, 0, -1, null);
@@ -170,8 +170,8 @@ public class MongoMKRebaseTest extends B
         mk.commit("", "+\"/x\":{\"y\":{\"p\":42}}", null, null);
         String branch = mk.branch(null);
         branch = mk.commit("", "^\"/x/y/p\":99", branch, null);
-        String trunk = mk.commit("", "^\"/x/y/p\":99", null, null);
-        String rebased = mk.rebase(branch, null);
+        mk.commit("", "^\"/x/y/p\":99", null, null);
+        mk.rebase(branch, null);
 
         String branchNode = mk.getNodes("/x/y", branch, 0, 0, -1, null);
         assertTrue(branchNode.contains("\"p\":99"));
@@ -339,7 +339,7 @@ public class MongoMKRebaseTest extends B
     public void mergeRebased() {
         mk.commit("", "+\"/x\":{\"y\":{}}", null, null);
         String branch = mk.branch(null);
-        String trunk = mk.commit("", "^\"/x/p\":42", null, null);
+        mk.commit("", "^\"/x/p\":42", null, null);
         branch = mk.commit("", "^\"/x/q\":43", branch, null);
         branch = mk.rebase(branch, null);
 

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKWaitForCommitTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKWaitForCommitTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKWaitForCommitTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/MongoMKWaitForCommitTest.java
Thu Apr 11 11:32:30 2013
@@ -58,7 +58,8 @@ public class MongoMKWaitForCommitTest ex
         String rev = mk2.waitForCommit(null, -1);
         long after = System.currentTimeMillis();
         assertEquals(headRev, rev);
-        assertTrue(after - before < 100); // Basically no wait.
+        // Basically no wait.
+        assertTrue(after - before < 100); 
     }
 
     @Test
@@ -120,7 +121,8 @@ public class MongoMKWaitForCommitTest ex
         long after = System.currentTimeMillis();
         assertEquals(headRev, rev);
         assertEquals(headRev, rev);
-        assertTrue(after - before < 10); // Basically no wait.
+        // Basically no wait.
+        assertTrue(after - before < 10); 
     }
 
     private ScheduledFuture<String> scheduleCommit(long delay, final String revisionId)
{

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/SimpleNodeScenario.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/SimpleNodeScenario.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/SimpleNodeScenario.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/SimpleNodeScenario.java
Thu Apr 11 11:32:30 2013
@@ -18,6 +18,9 @@ package org.apache.jackrabbit.mongomk.im
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
 
+/**
+ * A class that can perform simple operations.
+ */
 public class SimpleNodeScenario {
 
     private final MicroKernel mk;
@@ -41,22 +44,12 @@ public class SimpleNodeScenario {
         return revisionId;
     }
 
-    public String delete_A() throws Exception {
+    public String deleteA() throws Exception {
         return mk.commit("/", "-\"a\"", null, "Commit with deleted /a");
     }
 
-    public String delete_B() throws Exception {
+    public String deleteB() throws Exception {
         return mk.commit("/a", "-\"b\"", null, "Commit with deleted /a/b");
     }
-
-    public String update_A_and_add_D_and_E() throws Exception {
-        StringBuilder diff = new StringBuilder();
-        diff.append("+\"a/d\" : {}");
-        diff.append("+\"a/b/e\" : {}");
-        diff.append("^\"a/double\" : 0.123");
-        diff.append("^\"a/d/int\" :  2");
-        diff.append("^\"a/b/e/array\" : [ 123, null, 123.456, \"for:bar\", true ]");
-        return mk.commit("/", diff.toString(), null,
-                "Commit with updated /a and added /a/d and /a/b/e");
-    }
+    
 }

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/ConcurrentWriteMultipleMkMongoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/ConcurrentWriteMultipleMkMongoTest.java?rev=1466838&r1=1466837&r2=1466838&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/ConcurrentWriteMultipleMkMongoTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/impl/command/ConcurrentWriteMultipleMkMongoTest.java
Thu Apr 11 11:32:30 2013
@@ -26,8 +26,6 @@ import org.apache.jackrabbit.mongomk.Mon
 import org.junit.Ignore;
 import org.junit.Test;
 
-import com.mongodb.DB;
-
 /**
  * Tests for multiple MongoMKs writing against the same DB in separate trees.
  */
@@ -39,7 +37,8 @@ public class ConcurrentWriteMultipleMkMo
     }
 
     @Test
-    @Ignore // Ignored only because it takes a while to complete.
+    // Ignored only because it takes a while to complete.
+    @Ignore 
     public void testLarge() throws Exception {
         doTest(10000);
     }
@@ -54,8 +53,6 @@ public class ConcurrentWriteMultipleMkMo
         for (int i = 0; i < numberOfMks; i++) {
             String diff = buildPyramidDiff("/", 0, numberOfChildren,
                     numberOfNodes, prefixes[i], new StringBuilder()).toString();
-            //System.out.println(diff);
-            DB db = mongoConnection.getDB();
             MongoMK mk = new MongoMK.Builder().open();
             GenericWriteTask task = new GenericWriteTask("mk-" + i, mk, diff, 10);
             executor.execute(task);
@@ -68,8 +65,9 @@ public class ConcurrentWriteMultipleMkMo
             int index, int numberOfChildren, long nodesNumber,
             String nodePrefixName, StringBuilder diff) {
         if (numberOfChildren == 0) {
-            for (long i = 0; i < nodesNumber; i++)
+            for (long i = 0; i < nodesNumber; i++) {
                 diff.append(addNodeToDiff(startingPoint, nodePrefixName + i));
+            }
             return diff;
         }
 
@@ -79,8 +77,9 @@ public class ConcurrentWriteMultipleMkMo
 
         diff.append(addNodeToDiff(startingPoint, nodePrefixName + index));
         for (int i = 1; i <= numberOfChildren; i++) {
-            if (!startingPoint.endsWith("/"))
+            if (!startingPoint.endsWith("/")) {
                 startingPoint = startingPoint + "/";
+            }
             buildPyramidDiff(startingPoint + nodePrefixName + index, index
                     * numberOfChildren + i, numberOfChildren, nodesNumber,
                     nodePrefixName, diff);
@@ -88,13 +87,16 @@ public class ConcurrentWriteMultipleMkMo
         return diff;
     }
 
-    private String addNodeToDiff(String startingPoint, String nodeName) {
+    private static String addNodeToDiff(String startingPoint, String nodeName) {
         if (!startingPoint.endsWith("/")) {
             startingPoint = startingPoint + "/";
         }
-        return ("+\"" + startingPoint + nodeName + "\" : {} \n");
+        return "+\"" + startingPoint + nodeName + "\" : {} \n";
     }
 
+    /**
+     * A simple write task.
+     */
     private static class GenericWriteTask implements Runnable {
 
         private String id;
@@ -109,6 +111,10 @@ public class ConcurrentWriteMultipleMkMo
             this.diff = diff;
             this.nodesPerCommit = nodesPerCommit;
         }
+        
+        public String toString() {
+            return id;
+        }
 
         @Override
         public void run() {
@@ -125,15 +131,16 @@ public class ConcurrentWriteMultipleMkMo
                 i++;
                 if (i == nodesPerCommit) {
                     //System.out.println("[" + id + "] Committing: " + currentCommit.toString());
-                    String rev = mk.commit("", currentCommit.toString(), null, null);
+                    mk.commit("", currentCommit.toString(), null, null);
                     //System.out.println("[" + id + "] Committed-" + rev + ":" + currentCommit.toString());
                     currentCommit.setLength(0);
                     i = 0;
                 }
             }
             // Commit remaining nodes
-            if (currentCommit.length() > 0)
+            if (currentCommit.length() > 0) {
                 mk.commit("", currentCommit.toString(), null, null);
+            }
         }
     }
 }
\ No newline at end of file



Mime
View raw message