jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1211552 - /jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
Date Wed, 07 Dec 2011 17:34:05 GMT
Author: stefan
Date: Wed Dec  7 17:34:05 2011
New Revision: 1211552

URL: http://svn.apache.org/viewvc?rev=1211552&view=rev
Log:
some test cases fail with mongodb because the tests assume an empty repository

Modified:
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java?rev=1211552&r1=1211551&r2=1211552&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
Wed Dec  7 17:34:05 2011
@@ -16,9 +16,15 @@
  */
 package org.apache.jackrabbit.mk;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.List;
+
 import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.json.JsopBuilder;
+import org.apache.jackrabbit.mk.json.JsopReader;
+import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runners.Parameterized.Parameters;
@@ -45,6 +51,29 @@ public class MultiMkTestBase {
     @Before
     public void setUp() throws Exception {
         mk = MicroKernelFactory.getInstance(url + ";clean");
+        // clean all existing content
+        String result = mk.getNodes("/", mk.getHeadRevision(), 0, 0, -1);
+        List<String> names = new ArrayList<String>();
+        JsopReader t = new JsopTokenizer(result);
+        t.read('{');
+        if (!t.matches('}')) {
+            do {
+                String key = t.readString();
+                if (key.charAt(0) != ':') {
+                    names.add(key);
+                }
+                t.read(':');
+                t.readRawValue();
+            } while (t.matches(','));
+            t.read('}');
+        }
+        if (!names.isEmpty()) {
+            StringBuilder buf = new StringBuilder();
+            for (String name : names) {
+                buf.append("- \"").append(name).append("\"\n");
+            }
+            mk.commit("/", buf.toString(), mk.getHeadRevision(), null);
+        }
     }
 
     @After



Mime
View raw message