jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1158639 - /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Date Wed, 17 Aug 2011 11:36:15 GMT
Author: mduerig
Date: Wed Aug 17 11:36:15 2011
New Revision: 1158639

URL: http://svn.apache.org/viewvc?rev=1158639&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
- tests

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1158639&r1=1158638&r2=1158639&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Wed Aug 17 11:36:15 2011
@@ -88,30 +88,45 @@ public class RepositoryTest {
     @Before
     public void setup() {
         MicroKernel mk = MicroKernelFactory.getInstance(URL + ";clean");
-        String head = mk.getHeadRevision();
 
-        String ptUnstructured = '\"' + JsonBuilder.escape(Paths.nameToString(NameConstants.JCR_PRIMARYTYPE))
+ "\":" +
-                "\"7:" + NodeType.NT_UNSTRUCTURED + '\"';
+        try {
+            String head = mk.getHeadRevision();
+            String ptUnstructured = '\"' + JsonBuilder.escape(Paths.nameToString(NameConstants.JCR_PRIMARYTYPE))
+ "\":" +
+                    "\"7:" + NodeType.NT_UNSTRUCTURED + '\"';
+
+            if (!mk.nodeExists("/default", head)) {
+                head = mk.commit("/",
+                    "+\"default\" : {" +
+                        "\"{}foo\" : {" +
+                            "\"{}stringProp\":\"stringVal\"," +
+                            "\"{}intProp\":42," +
+                            "\"{}mvProp\":[1,2,3]}, " +
+                        "\"{}bar\" : {}}", head, "");
+            }
 
-        if (!mk.nodeExists("/default", head)) {
-            head = mk.commit("/",
-                "+\"default\" : {" +
-                    "\"{}foo\" : {" +
-                        "\"{}stringProp\":\"stringVal\"," +
-                        "\"{}intProp\":42," +
-                        "\"{}mvProp\":[1,2,3]}, " +
-                    "\"{}bar\" : {}}", head, "");
+            if (!mk.nodeExists("/default/{}" + testNode, head)) {
+                mk.commit("/default", "+\"{}" + testNode + "\" : {" + ptUnstructured + '}',
head, "");
+            }
         }
-
-        if (!mk.nodeExists("/default/{}" + testNode, head)) {
-            mk.commit("/default", "+\"{}" + testNode + "\" : {" + ptUnstructured + '}', head,
"");
+        finally {
+            mk.dispose();
         }
-
-        mk.dispose();
     }
 
     @After
     public void tearDown() {
+        MicroKernel mk = MicroKernelFactory.getInstance(URL + ";clean");
+        try {
+            String head = mk.getHeadRevision();
+
+            if (mk.nodeExists("/default/{}" + testNode, head)) {
+                mk.commit("/default", "-\"{}" + testNode + "\"", head, "");
+            }
+        }
+        finally {
+            mk.dispose();
+        }
+
         if (session != null) {
             session.logout();
             session = null;



Mime
View raw message