jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1331475 - /jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
Date Fri, 27 Apr 2012 15:47:30 GMT
Author: stefan
Date: Fri Apr 27 15:47:29 2012
New Revision: 1331475

URL: http://svn.apache.org/viewvc?rev=1331475&view=rev
Log:
OAK-12: Implement a test suite for the MicroKernel (WIP)

Modified:
    jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java

Modified: jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java?rev=1331475&r1=1331474&r2=1331475&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
(original)
+++ jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
Fri Apr 27 15:47:29 2012
@@ -130,6 +130,39 @@ public class MicroKernelIT extends Abstr
         assertEquals(array.size(), 0);
     }
 
+    @Test
+    public void diff() {
+        String rev0 = mk.getHeadRevision();
+
+        String rev1 = mk.commit("/test", "+\"enemenemuh\":{}", null, null);
+
+        // get reverse diff
+        String reverseDiff = mk.diff(rev1, rev0, null);
+        assertNotNull(reverseDiff);
+        assertTrue(reverseDiff.length() > 0);
+
+        // commit reverse diff
+        String rev2 = mk.commit("", reverseDiff, null, null);
+
+        // diff of rev0->rev2 should be empty
+        assertEquals(mk.diff(rev0, rev2, null), "");
+    }
+
+    @Test
+    public void snapshotIsolation() {
+        final int NUM_COMMITS = 1000;
+
+        String[] revs = new String[NUM_COMMITS];
+
+        // perform NUM_COMMITS commits
+        for (int i = 0; i < NUM_COMMITS; i++) {
+            revs[i] = mk.commit("/test", "^\"cnt\":" + i, null, null);
+        }
+        for (int i = 0; i < NUM_COMMITS; i++) {
+            JSONObject obj = parseJSONObject(mk.getNodes("/test", revs[i], 1, 0, -1, null));
+            assertPropertyValue(obj, "cnt", (long) i);
+        }
+    }
 
     @Test
     public void waitForCommit() {



Mime
View raw message