jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1453455 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Date Wed, 06 Mar 2013 17:50:36 GMT
Author: mduerig
Date: Wed Mar  6 17:50:36 2013
New Revision: 1453455

URL: http://svn.apache.org/r1453455
Log:
OAK-679: Allow read access to disconnected node builders

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java?rev=1453455&r1=1453454&r2=1453455&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilder.java
Wed Mar  6 17:50:36 2013
@@ -225,13 +225,13 @@ public class MemoryNodeBuilder implement
 
             return false;
         }
-        return writeState != null || baseState != null;
+        assert classInvariants();
+        return true;
     }
 
     @Nonnull
     private NodeState read() {
-        checkState(updateReadState(), "This node has been removed or is disconnected");
-        assert classInvariants();
+        updateReadState();
         return writeState != null ? writeState : baseState;
     }
 
@@ -473,6 +473,8 @@ public class MemoryNodeBuilder implement
         boolean modified = writeState != null && (writeState.base != baseState ||
writeState.nodes.containsKey(name));
         if (!hasBaseState(name) || modified) {
             builder.write(root.revision + 1, true);
+        } else {
+            builder.read();
         }
         return builder;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java?rev=1453455&r1=1453454&r2=1453455&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/memory/MemoryNodeBuilderTest.java
Wed Mar  6 17:50:36 2013
@@ -106,14 +106,15 @@ public class MemoryNodeBuilderTest {
         for (String name : new String[] {"x", "new"}) {
             NodeBuilder root = new MemoryNodeBuilder(BASE);
             NodeBuilder child = root.child(name);
+            child.child("q");
 
             root.removeNode(name);
+            assertEquals(1, child.getChildNodeCount());
+
             try {
-                child.getChildNodeCount();
+                child.setProperty("p", "v");
                 fail();
-            } catch (IllegalStateException e) {
-                // expected
-            }
+            } catch (IllegalStateException expected) {}
 
             root.child(name);
             assertEquals(0, child.getChildNodeCount()); // reconnect!
@@ -182,14 +183,4 @@ public class MemoryNodeBuilderTest {
         assertEquals(x.getBaseState(), x.getNodeState());
     }
 
-    @Test(expected = IllegalStateException.class)
-    public void testReadOnRemovedNode() {
-        NodeBuilder root = new MemoryNodeBuilder(BASE);
-        NodeBuilder m = root.child("m");
-        NodeBuilder n = m.child("n");
-
-        root.removeNode("m");
-        n.hasChildNode("any");
-    }
-
 }



Mime
View raw message