jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1486598 - /jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ClusterTest.java
Date Mon, 27 May 2013 12:48:52 GMT
Author: thomasm
Date: Mon May 27 12:48:52 2013
New Revision: 1486598

URL: http://svn.apache.org/r1486598
Log:
OAK-762 MongoMK: addtional cluster test

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

Modified: jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ClusterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ClusterTest.java?rev=1486598&r1=1486597&r2=1486598&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ClusterTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/test/java/org/apache/jackrabbit/mongomk/ClusterTest.java
Mon May 27 12:48:52 2013
@@ -24,7 +24,6 @@ import org.apache.jackrabbit.mk.blobs.Me
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.Ignore;
 
 import com.mongodb.DB;
 
@@ -40,40 +39,63 @@ public class ClusterTest {
     private MemoryBlobStore bs;
     
     @Test
-    @Ignore
     public void threeNodes() throws Exception {
         MemoryDocumentStore ds = new MemoryDocumentStore();
         MemoryBlobStore bs = new MemoryBlobStore();
         MongoMK.Builder builder;
         
         builder = new MongoMK.Builder();
-        builder.setDocumentStore(ds).setBlobStore(bs);
+        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(0);
         MongoMK mk1 = builder.setClusterId(1).open();
         builder = new MongoMK.Builder();
-        builder.setDocumentStore(ds).setBlobStore(bs);
+        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(0);
         MongoMK mk2 = builder.setClusterId(2).open();
         builder = new MongoMK.Builder();
-        builder.setDocumentStore(ds).setBlobStore(bs);
+        builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(0);
         MongoMK mk3 = builder.setClusterId(3).open();
 
-        String r1 = mk1.commit("/", "+\"test\":{}", null, null);
-
+        mk1.commit("/", "+\"test\":{}", null, null);
         mk2.commit("/", "+\"a\":{}", null, null);
         mk3.commit("/", "+\"b\":{}", null, null);
+        mk2.backgroundWrite();
+        mk2.backgroundRead();
+        mk3.backgroundWrite();
+        mk3.backgroundRead();
+        mk1.backgroundWrite();
+        mk1.backgroundRead();
+        mk2.backgroundWrite();
+        mk2.backgroundRead();
+        mk3.backgroundWrite();
+        mk3.backgroundRead();
+        
         mk2.commit("/", "^\"test/x\":1", null, null);
+        String n3 = mk3.getNodes("/test", mk3.getHeadRevision(), 0, 0, 10, null);
+        // mk3 didn't see the previous change yet; 
+        // it is questionable if this should prevent any changes to this node
+        // (currently it does not)
+        assertEquals("{\":childNodeCount\":0}", n3);
         mk3.commit("/", "^\"test/y\":2", null, null);
 
-        String r2 = mk1.commit("/", "^\"b/x\":1", null, null);
-        String r3 = mk1.commit("/", "^\"a/x\":1", null, null);
-        
+        mk3.backgroundWrite();
+        mk3.backgroundRead();
+        mk1.backgroundWrite();
+        mk1.backgroundRead();
+
+        String r1 = mk1.getHeadRevision();
         String n1 = mk1.getNodes("/test", r1, 0, 0, 10, null);
-        String n2 = mk1.getNodes("/test", r2, 0, 0, 10, null);
-        String n3 = mk1.getNodes("/test", r3, 0, 0, 10, null);
+        // mk1 only sees the change of mk3 so far
+        assertEquals("{\"y\":2,\":childNodeCount\":0}", n1);
+
+        mk2.backgroundWrite();
+        mk2.backgroundRead();
+        mk1.backgroundWrite();
+        mk1.backgroundRead();
+
+        String r1b = mk1.getHeadRevision();
+        String n1b = mk1.getNodes("/test", r1b, 0, 0, 10, null);
+        // mk1 now sees both changes
+        assertEquals("{\"x\":1,\"y\":2,\":childNodeCount\":0}", n1b);
 
-        System.out.println(n1);
-        System.out.println(n2);
-        System.out.println(n3);
-        
         mk1.dispose();
         mk2.dispose();
         mk3.dispose();



Mime
View raw message