jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1213256 - in /jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large: DescendantCountTest.java LargeNodeTest.java
Date Mon, 12 Dec 2011 14:35:19 GMT
Author: thomasm
Date: Mon Dec 12 14:35:19 2011
New Revision: 1213256

URL: http://svn.apache.org/viewvc?rev=1213256&view=rev
Log:
Test.

Modified:
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/DescendantCountTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/DescendantCountTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/DescendantCountTest.java?rev=1213256&r1=1213255&r2=1213256&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/DescendantCountTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/DescendantCountTest.java
Mon Dec 12 14:35:19 2011
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.mk.json.fas
 import org.apache.jackrabbit.mk.mem.NodeImpl;
 import org.apache.jackrabbit.mk.mem.NodeMap;
 import org.apache.jackrabbit.mk.util.NodeCreator;
+import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -37,6 +38,15 @@ public class DescendantCountTest extends
         super(url);
     }
 
+    @After
+    public void tearDown() throws InterruptedException {
+        if (isMemoryKernel(mk)) {
+            mk.commit("/:root/head/config", "^ \"descendantCount\": false", mk.getHeadRevision(),
"");
+            mk.commit("/:root/head/config", "^ \"descendantCount\": null", mk.getHeadRevision(),
"");
+        }
+        super.tearDown();
+    }
+
     @Test
     public void test() throws Exception {
         if (!isMemoryKernel(mk)) {
@@ -48,7 +58,7 @@ public class DescendantCountTest extends
 
         NodeMap map = new NodeMap();
         NodeCreator c = new NodeCreator(mk);
-        for (int i = 1; i < 100; i++) {
+        for (int i = 1; i < 20; i++) {
             c.setNodeName("test" + i);
             c.setWidth(2);
             c.setTotalCount(i);
@@ -67,6 +77,12 @@ public class DescendantCountTest extends
                 if (count != descendants) {
                     assertEquals(json, count, descendants + 1);
                 }
+                d = o.get(NodeImpl.DESCENDANT_INLINE_COUNT);
+                long inline = Long.parseLong(d.toString());
+                if (inline <= 0) {
+                    // at least 1
+                    assertEquals(json, 1, inline);
+                }
             } else if (i > 10) {
                 fail();
             }

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=1213256&r1=1213255&r2=1213256&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
Mon Dec 12 14:35:19 2011
@@ -18,9 +18,8 @@ package org.apache.jackrabbit.mk.large;
 
 import junit.framework.Assert;
 import org.apache.jackrabbit.mk.MultiMkTestBase;
-import org.apache.jackrabbit.mk.mem.NodeImpl;
-import org.apache.jackrabbit.mk.mem.NodeMap;
 import org.apache.jackrabbit.mk.util.StopWatch;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -45,6 +44,15 @@ public class LargeNodeTest extends Multi
         commit("/", "+ \"test\": {\"a\":{}, \"b\":{}, \"c\":{}}");
     }
 
+    @After
+    public void tearDown() throws InterruptedException {
+        if (isMemoryKernel(mk)) {
+            head = mk.commit("/:root/head/config", "^ \"maxMemoryChildren\": " + Integer.MAX_VALUE,
head, "");
+            head = mk.commit("/:root/head/config", "^ \"maxMemoryChildren\": null", head,
"");
+        }
+        super.tearDown();
+    }
+
     @Test
     public void getNodes() {
         head = mk.commit("/", "+\"x0\" : {\"x\": 0, \"x1\":{\"x\":1, \"x2\": {\"x\": -3}}}",
head, null);
@@ -61,7 +69,7 @@ public class LargeNodeTest extends Multi
 
     @Test
     public void veryLargeNodeList() {
-        if (url.startsWith("mem:")) {
+        if (isMemoryKernel(mk)) {
             int max = 2000;
             Assert.assertEquals("{\":childNodeCount\":0}", mk.getNodes("/:root/head/config",
head));
             head = mk.commit("/:root/head/config", "^ \"maxMemoryChildren\":" + max, head,
"");
@@ -157,49 +165,4 @@ public class LargeNodeTest extends Multi
         return s;
     }
 
-    @Test
-    public void addChildNodes() {
-        NodeMap map = new NodeMap();
-
-        map.setMaxMemoryChildren(2);
-
-        NodeImpl n = new NodeImpl(map, 0);
-        Assert.assertEquals("n0={}", n.asString());
-        n.setId(255);
-        Assert.assertEquals("nff={}", n.asString());
-        n.setPath("/test");
-        Assert.assertEquals("nff={}/* /test */", n.toString());
-        n = n.createClone(10);
-        Assert.assertEquals("n0={}", n.asString());
-        NodeImpl a = new NodeImpl(map, 0);
-        NodeImpl b = new NodeImpl(map, 0);
-        NodeImpl c = new NodeImpl(map, 0);
-        NodeImpl d = new NodeImpl(map, 0);
-        n = n.cloneAndAddChildNode("a", false, null, a, 11);
-        n = n.cloneAndSetProperty("x", "1", 12);
-        n.setId(3);
-        Assert.assertEquals("n3={\"x\":1,\"a\":n1}", n.asString());
-        NodeImpl n2 = NodeImpl.fromString(map, n.asString());
-        Assert.assertEquals("n3={\"x\":1,\"a\":n1}", n2.asString());
-
-        n = new NodeImpl(map, 0);
-        n = n.cloneAndAddChildNode("a", false, null, a, 1);
-        Assert.assertEquals("n0={\"a\":n1}", n.asString());
-        n = n.cloneAndAddChildNode("b", false, null, b, 2);
-        Assert.assertEquals("n0={\"a\":n1,\"b\":n2}", n.asString());
-        n = n.cloneAndAddChildNode("c", false, null, c, 3);
-        Assert.assertEquals("n0={\"a\":n1,\"b\":n2,\"c\":n3}", n.asString());
-        n = n.cloneAndAddChildNode("d", false, null, d, 4);
-        Assert.assertEquals("n0={\":children\":n4,\":names\":\"63\",\":children\":n6,\":names\":\"64\",\":childCount\":4}",
-                n.asString());
-        n2 = NodeImpl.fromString(map, n.asString());
-        Assert.assertEquals("n0={\":children\":n4,\":names\":\"63\",\":children\":n6,\":names\":\"64\",\":childCount\":4}",
-                n2.asString());
-        Assert.assertTrue(n2.exists("a"));
-        Assert.assertTrue(n2.exists("b"));
-        Assert.assertTrue(n2.exists("c"));
-        Assert.assertTrue(n2.exists("d"));
-
-    }
-
 }
\ No newline at end of file



Mime
View raw message