jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1133916 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/ test/java/org/apache/jackrabbit/spi2microkernel/
Date Thu, 09 Jun 2011 15:12:03 GMT
Author: thomasm
Date: Thu Jun  9 15:12:03 2011
New Revision: 1133916

URL: http://svn.apache.org/viewvc?rev=1133916&view=rev
Log:
Quote path.

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1133916&r1=1133915&r2=1133916&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Thu Jun  9 15:12:03 2011
@@ -131,7 +131,7 @@ public class RepositoryServiceImpl exten
         final List<String> workspaces = new ArrayList<String>();
 
         try {
-            String json = microKernel.getNodes("/", 0, rev);
+            String json = microKernel.getNodes("/", 1, rev);
             new JSONParser().parse(json, new JsonHandlerBase(){
                 public String currentKey;
 
@@ -340,7 +340,7 @@ public class RepositoryServiceImpl exten
                 }
             }
 
-            microKernel.commit("/", '+' + wspName + " : {}" , revisionId);
+            microKernel.commit("/", "+\"" + wspName + "\" : {}" , revisionId);
         }
         catch (MicroKernelException e) {
             throw new RepositoryException(e.getMessage(), e);
@@ -358,7 +358,7 @@ public class RepositoryServiceImpl exten
                 throw new NoSuchWorkspaceException("No such workspace: " + name);
             }
 
-            microKernel.commit("/", '-' + wspName + " : ", revisionId);
+            microKernel.commit("/", "-\"" + wspName + "\"", revisionId);
         }
         catch (MicroKernelException e) {
             throw new RepositoryException(e.getMessage(), e);
@@ -411,7 +411,7 @@ public class RepositoryServiceImpl exten
                 }
 
                 String path = target(nodeId);
-                jsop.append('-').append(path).append(" : \n");
+                jsop.append('-').append(path).append("\n");
             }
             else {
                 PropertyId propertyId = (PropertyId) itemId;
@@ -441,19 +441,21 @@ public class RepositoryServiceImpl exten
 
         public void commit() throws RepositoryException {
             String rev = getRevision(sessionInfo);
-            jsop.deleteCharAt(jsop.length() - 1); // remove trailing new line. DiffParser
messes up otherwise
+            // TODO ugly hack:
+            // remove training new line. DiffParser messes up otherwise
+            jsop.deleteCharAt(jsop.length() - 1);
             rev = microKernel.commit("/", jsop.toString(), rev);
             setRevision(sessionInfo, rev);
         }
 
         private String target(NodeId nodeId) throws RepositoryException {
-            return PathUtil.relativize("/", Paths.translateQPath(sessionInfo.getWorkspaceName(),
nodeId.getPath()));   
+            return "\"" + PathUtil.relativize("/", Paths.translateQPath(sessionInfo.getWorkspaceName(),
nodeId.getPath())) + "\"";
         }
 
         private String target(NodeId parentId, Name itemName) throws RepositoryException
{
             String path = Paths.translateQPath(sessionInfo.getWorkspaceName(), parentId.getPath());
             String name = Paths.translateQName(itemName);
-            return PathUtil.concat(PathUtil.relativize("/", path), name);
+            return "\"" + PathUtil.concat(PathUtil.relativize("/", path), name) + "\"";
         }
 
         private void setProperty(NodeId parentId, Name propertyName, String jsonValue) throws
RepositoryException {

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java?rev=1133916&r1=1133915&r2=1133916&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/MicrokernelTest.java
Thu Jun  9 15:12:03 2011
@@ -133,9 +133,9 @@ public class MicrokernelTest {
         String head = mk.getHeadRevision();
         String node = "removeNode_" + System.currentTimeMillis();
 
-        head = mk.commit("/", '+' + node + " : {\"child\":{}}", head);
+        head = mk.commit("/", "+\"" + node + "\" : {\"child\":{}}", head);
 
-        head = mk.commit('/' + node, "-child : ", head);
+        head = mk.commit('/' + node, "-\"child\"", head);
         String json = mk.getNodes('/' + node, 2, head);
         assertEquals("{\":name\":\"" + node + "\",\":childNodeCount\":0}", json);
     }
@@ -147,9 +147,9 @@ public class MicrokernelTest {
         long t = System.currentTimeMillis();
         String node = "removeProperty_" + t;
 
-        head = mk.commit("/", '+' + node + " : {\"prop\":\"value\"}", head);
+        head = mk.commit("/", "+\"" + node + "\" : {\"prop\":\"value\"}", head);
 
-        head = mk.commit("/", '^' + node + "/prop : null", head);
+        head = mk.commit("/", "^\"" + node + "/prop\" : null", head);
         String json = mk.getNodes('/' + node, 2, head);
         assertEquals("{\":name\":\"removeProperty_" + t + "\",\":childNodeCount\":0}", json);
     }

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1133916&r1=1133915&r2=1133916&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Thu Jun  9 15:12:03 2011
@@ -48,6 +48,7 @@ import static org.junit.Assert.*;
 public class RepositoryTest {
 
     private static final String URL = "fs:target/repository-test/repository";
+    // private static final String URL = "mem:";
 
     private final String testNode = "node_" + System.currentTimeMillis();
     private final String testPath = '/' + testNode;
@@ -61,16 +62,16 @@ public class RepositoryTest {
 
         if (!mk.nodeExists("/default", head)) {
             head = mk.commit("/",
-                "+default : {" +
+                "+\"default\" : {" +
                     "\"{}foo\" : {" +
                         "\"{}stringProp\":\"stringVal\"," +
                         "\"{}intProp\":42," +
-                        "\"{}mvProp\":[1,2,3]} " +
+                        "\"{}mvProp\":[1,2,3]}, " +
                     "\"{}bar\" : {}}", head);
         }
 
         if (!mk.nodeExists("/default/{}" + testNode, head)) {
-            mk.commit("/default", "+{}" + testNode + " : {}", head);
+            mk.commit("/default", "+\"{}" + testNode + "\" : {}", head);
         }
 
         mk.dispose();



Mime
View raw message