jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1166574 - in /jackrabbit/sandbox/microkernel/src: main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java
Date Thu, 08 Sep 2011 09:01:51 GMT
Author: thomasm
Date: Thu Sep  8 09:01:51 2011
New Revision: 1166574

URL: http://svn.apache.org/viewvc?rev=1166574&view=rev
Log:
Bugfix: getNodes was processed incorrectly

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java?rev=1166574&r1=1166573&r2=1166574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
Thu Sep  8 09:01:51 2011
@@ -169,7 +169,7 @@ public class MemoryKernelImpl implements
                 t.read('{');
                 NodeImpl n = NodeImpl.parse(nodeMap, t, rev);
                 data = data.cloneAndAddChildNode(from, false, null, n, rev);
-                n.append(diff, -1, 0, Integer.MAX_VALUE, false);
+                n.append(diff, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, false);
                 diff.newline();
                 break;
             case '-':

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java?rev=1166574&r1=1166573&r2=1166574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
Thu Sep  8 09:01:51 2011
@@ -205,10 +205,10 @@ public class NodeImpl {
                 for (Iterator<String> it = childNodes.getNames(offset, count); it.hasNext();)
{
                     String s = it.next();
                     json.key(s);
-                    if (depth == 0) {
+                    if (depth <= 0) {
                         json.object().endObject();
                     } else {
-                        getChildNode(s).append(json, depth - 1, 0, -1, childNodeCount);
+                        getChildNode(s).append(json, depth - 1, 0, count, childNodeCount);
                     }
                 }
             }

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java?rev=1166574&r1=1166573&r2=1166574&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java
Thu Sep  8 09:01:51 2011
@@ -44,6 +44,19 @@ public class LargeNodeTest extends TestC
         mk.dispose();
     }
 
+    public void testGetNodes() {
+        head = mk.commit("/", "+\"x0\" : {\"x\": 0, \"x1\":{\"x\":1, \"x2\": {\"x\": -3}}}",
head, null);
+        String s = mk.getNodes("/x0", head);
+        assertEquals("{\"x\":0,\":childNodeCount\":1,\"x1\":{\"x\":1,\":childNodeCount\":1,\"x2\":{}}}",
s);
+        s = mk.getNodes("/x0", head, 1, 0, -1);
+        assertEquals("{\"x\":0,\":childNodeCount\":1,\"x1\":{\"x\":1,\":childNodeCount\":1,\"x2\":{}}}",
s);
+        s = mk.getNodes("/x0", head, 0, 0, -1);
+        assertEquals("{\"x\":0,\":childNodeCount\":1,\"x1\":{}}", s);
+        s = mk.getNodes("/x0", head, 0, 0, 0);
+        assertEquals("{\"x\":0,\":childNodeCount\":1}", s);
+        head = mk.commit("/", "-\"x0\"", head, null);
+    }
+
     public void testVeryLargeNodeList() {
         if (URL.startsWith("mem:")) {
             int max = 2000;
@@ -96,7 +109,7 @@ public class LargeNodeTest extends TestC
         for (int i = 0; i < 100; i++) {
             head = mk.commit("/", "+ \"t" + i + "\": {\"x\":" + i + "}", head, "");
         }
-        assertEquals("{\":childNodeCount\":101,\"test\":{\":childNodeCount\":3}," +
+        assertEquals("{\":childNodeCount\":101,\"test\":{\":childNodeCount\":3,\"a\":{},\"b\":{},\"c\":{}},"
+
                 "\"t0\":{\"x\":0,\":childNodeCount\":0}," +
                 "\"t1\":{\"x\":1,\":childNodeCount\":0}," +
                 "\"t2\":{\"x\":2,\":childNodeCount\":0}," +



Mime
View raw message