jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1350198 - /jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
Date Thu, 14 Jun 2012 11:35:49 GMT
Author: stefan
Date: Thu Jun 14 11:35:49 2012
New Revision: 1350198

URL: http://svn.apache.org/viewvc?rev=1350198&view=rev
Log:
OAK-130: Unexpected result of MicroKernel#getJournal after MicroKernel#merge

extended test case

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=1350198&r1=1350197&r2=1350198&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
Thu Jun 14 11:35:49 2012
@@ -937,6 +937,7 @@ public class MicroKernelIT extends Abstr
 
         // create a branch on head
         String branchRev = mk.branch(null);
+        String branchRootRev = branchRev;
 
         // add a node /branch in branchRev
         branchRev = mk.commit("", "+\"/branch\":{}", branchRev, "");
@@ -950,8 +951,8 @@ public class MicroKernelIT extends Abstr
 
         // make sure branchRev doesn't show up in revision history
         String hist = mk.getRevisionHistory(0, -1, null);
-        JSONArray ar = parseJSONArray(hist);
-        for (Object entry : ar) {
+        JSONArray array = parseJSONArray(hist);
+        for (Object entry : array) {
             assertTrue(entry instanceof JSONObject);
             JSONObject rev = (JSONObject) entry;
             assertFalse(branchRev.equals(rev.get("id")));
@@ -963,11 +964,34 @@ public class MicroKernelIT extends Abstr
         assertFalse(mk.nodeExists("/test123", branchRev));
 
         // merge branchRev with head
-        mk.merge(branchRev, "");
+        String newHead = mk.merge(branchRev, "");
         // make sure /test123 still exists in head
         assertTrue(mk.nodeExists("/test123", null));
         // make sure /branch/foo does now exist in head
         assertTrue(mk.nodeExists("/branch/foo", null));
+
+        try {
+            mk.getJournal(branchRootRev, null, "/");
+            fail("getJournal should throw for branch revisions");
+        } catch (MicroKernelException e) {
+            // expected
+        }
+        try {
+            mk.getJournal(branchRootRev, branchRev, "/");
+            fail("getJournal should throw for branch revisions");
+        } catch (MicroKernelException e) {
+            // expected
+        }
+
+        String jrnl = mk.getJournal(newHead, newHead, "/");
+        array = parseJSONArray(jrnl);
+        assertEquals(1, array.size());
+        JSONObject rev = getObjectArrayEntry(array, 0);
+        assertPropertyValue(rev, "id", newHead);
+        String diff = (String) resolveValue(rev, "changes");
+        // TODO properly verify json diff format
+        // make sure json diff contains +"/branch":{...}
+        assertTrue(diff.matches("\\s*\\+\\s*\"/branch\"\\s*:\\s*\\{\\s*\"foo\"\\s*:\\s*\\{\\s*\\}\\s*\\}\\s*"));
     }
 
     @Test



Mime
View raw message