jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1225518 - in /jackrabbit/sandbox/jackrabbit-microkernel/src: main/java/org/apache/jackrabbit/state/NodeState.java test/java/org/apache/jackrabbit/RepositoryTest.java
Date Thu, 29 Dec 2011 12:58:09 GMT
Author: mduerig
Date: Thu Dec 29 12:58:09 2011
New Revision: 1225518

URL: http://svn.apache.org/viewvc?rev=1225518&view=rev
Log:
Microkernel based prototype of JCR implementation (WIP)
- don't try to resolve persistent state for transient nodes

Modified:
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/NodeState.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/NodeState.java?rev=1225518&r1=1225517&r2=1225518&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/NodeState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/state/NodeState.java
Thu Dec 29 12:58:09 2011
@@ -204,7 +204,7 @@ public class NodeState {
         }
 
         return getPersistedPropertyValue(name);
-    }    
+    }
 
     private JsonValue getPersistedPropertyValue(String name) {
         JsonValue value = getJsonObject().get(name);
@@ -217,11 +217,17 @@ public class NodeState {
     }
 
     private synchronized JsonObject getJsonObject() {
+        Path path = nodeDelta.getPersistentPath();
         String baseRevision = sessionContext.getRevision();
         if (jsonObject == null || !revision.equals(baseRevision)) {
             revision =  baseRevision;
-            String json = sessionContext.getMicrokernel().getNodes(nodeDelta.getPersistentPath().toMkPath(),
revision);
-            jsonObject = FullJsonParser.parseObject(new UnescapingJsonTokenizer(json));
+            if (path == null) {
+                jsonObject = JsonObject.EMPTY;
+            }
+            else {
+                String json = sessionContext.getMicrokernel().getNodes(nodeDelta.getPersistentPath().toMkPath(),
revision);
+                jsonObject = FullJsonParser.parseObject(new UnescapingJsonTokenizer(json));
+            }
         }
 
         return jsonObject;

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java?rev=1225518&r1=1225517&r2=1225518&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/test/java/org/apache/jackrabbit/RepositoryTest.java
Thu Dec 29 12:58:09 2011
@@ -865,6 +865,24 @@ public class RepositoryTest {
             session2.logout();
         }
     }
+    
+    @Test 
+    public void transientChanges() throws RepositoryException {
+        Node parentNode = getNode(TEST_PATH);
+
+        Node node = parentNode.addNode("test");
+
+        assertFalse(node.hasProperty("p"));
+        node.setProperty("p", "pv");
+        assertTrue(node.hasProperty("p"));
+
+        assertFalse(node.hasNode("n"));
+        node.addNode("n");
+        assertTrue(node.hasNode("n"));
+        
+        assertTrue(node.hasProperties());
+        assertTrue(node.hasNodes());
+    }
 
     @Test
     public void setStringProperty() throws RepositoryException, IOException {



Mime
View raw message