jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1235676 - in /jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk: MoveNodeTest.java MultiMkTestBase.java large/LargeNodeTest.java large/ManyRevisionsTest.java mem/MemoryNodeTest.java
Date Wed, 25 Jan 2012 08:25:29 GMT
Author: thomasm
Date: Wed Jan 25 08:25:29 2012
New Revision: 1235676

URL: http://svn.apache.org/viewvc?rev=1235676&view=rev
Log:
Small child node lists are orderable, large lists are not.

Modified:
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MoveNodeTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/LargeNodeTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/ManyRevisionsTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/mem/MemoryNodeTest.java

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MoveNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MoveNodeTest.java?rev=1235676&r1=1235675&r2=1235676&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MoveNodeTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MoveNodeTest.java
Wed Jan 25 08:25:29 2012
@@ -97,9 +97,6 @@ public class MoveNodeTest extends MultiM
         if (!isMemoryKernel(mk)) {
             return;
         }
-        if (areChildrenSorted()) {
-            return;
-        }
 
         // order c before b
         commit("/", "> \"test/c\": {\"before\": \"test/b\"}");
@@ -117,9 +114,6 @@ public class MoveNodeTest extends MultiM
         if (!isMemoryKernel(mk)) {
             return;
         }
-        if (areChildrenSorted()) {
-            return;
-        }
 
         // order a after b
         commit("/", "> \"test/a\": {\"after\": \"test/b\"}");
@@ -142,9 +136,6 @@ public class MoveNodeTest extends MultiM
         if (!isMemoryKernel(mk)) {
             return;
         }
-        if (areChildrenSorted()) {
-            return;
-        }
 
         // move /test/a to /test2/a (rename is not supported in this way)
         commit("/", "> \"test/a\": {\"first\": \"test2\"}");
@@ -185,9 +176,6 @@ public class MoveNodeTest extends MultiM
         if (!isMemoryKernel(mk)) {
             return;
         }
-        if (areChildrenSorted()) {
-            return;
-        }
 
         // move /test/b to /test2/b, before any other nodes in /test2
         commit("/", "> \"test/b\": {\"first\": \"test2\"}");
@@ -207,9 +195,6 @@ public class MoveNodeTest extends MultiM
         if (!isMemoryKernel(mk)) {
             return;
         }
-        if (areChildrenSorted()) {
-            return;
-        }
 
         // move /test/c to /test2
         commit("/", "> \"test/c\": \"test2/c\"");

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java?rev=1235676&r1=1235675&r2=1235676&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
Wed Jan 25 08:25:29 2012
@@ -26,7 +26,6 @@ import org.apache.jackrabbit.mk.fs.FileU
 import org.apache.jackrabbit.mk.json.JsopBuilder;
 import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
-import org.apache.jackrabbit.mk.mem.MemoryKernelImpl;
 import org.apache.jackrabbit.mk.mem.NodeImpl;
 import org.apache.jackrabbit.mk.mem.NodeMap;
 import org.junit.After;
@@ -140,11 +139,4 @@ public class MultiMkTestBase {
         }
     }
 
-    public boolean areChildrenSorted() {
-        if (isMemoryKernel(mk)) {
-            return MemoryKernelImpl.SORT_CHILDREN;
-        }
-        return false;
-    }
-
 }

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=1235676&r1=1235675&r2=1235676&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
Wed Jan 25 08:25:29 2012
@@ -129,7 +129,8 @@ public class LargeNodeTest extends Multi
         for (int i = 0; i < 100; i++) {
             head = mk.commit("/", "+ \"t" + i + "\": {\"x\":" + i + "}", head, "");
         }
-        if (areChildrenSorted()) {
+        boolean largeChildNodeListsAreSorted = true;
+        if (largeChildNodeListsAreSorted) {
             Assert.assertEquals("{\":childNodeCount\":101,\"t\":{\":childNodeCount\":3,\"a\":{},\"b\":{},\"c\":{}},"
+
                     "\"t0\":{\"x\":0,\":childNodeCount\":0}," +
                     "\"t1\":{\"x\":1,\":childNodeCount\":0}," +

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/ManyRevisionsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/ManyRevisionsTest.java?rev=1235676&r1=1235675&r2=1235676&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/ManyRevisionsTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/large/ManyRevisionsTest.java
Wed Jan 25 08:25:29 2012
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.mk.json.fas
 import org.apache.jackrabbit.mk.json.fast.JsopArray;
 import org.apache.jackrabbit.mk.json.fast.JsopObject;
 import org.apache.jackrabbit.mk.mem.NodeImpl;
+import org.apache.jackrabbit.mk.util.StopWatch;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,7 +45,7 @@ public class ManyRevisionsTest extends M
     }
 
     @Test
-    public void test() {
+    public void readRevisions() {
         String head = mk.getHeadRevision();
         head = mk.commit("/", "+\"test\" : {\"id\": -1}", head, "\"-1\"");
         String first = head;
@@ -73,4 +74,23 @@ public class ManyRevisionsTest extends M
         }
     }
 
+    @Test
+    public void smallWrites() {
+        String head = mk.getHeadRevision();
+        log(url);
+        StopWatch watch = new StopWatch();
+        int count = 1000;
+        for (int i = 0; i < count; i++) {
+            head = mk.commit("/", "^ \"x\": " + (i % 10), head, "");
+            if (i % 100 == 0 && watch.log()) {
+                log(watch.operationsPerSecond(i));
+            }
+        }
+        log(watch.operationsPerSecond(count));
+    }
+
+    private void log(String s) {
+        // System.out.println(s);
+    }
+
 }

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/mem/MemoryNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/mem/MemoryNodeTest.java?rev=1235676&r1=1235675&r2=1235676&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/mem/MemoryNodeTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/mem/MemoryNodeTest.java
Wed Jan 25 08:25:29 2012
@@ -62,21 +62,11 @@ public class MemoryNodeTest {
         n = n.cloneAndAddChildNode("c", false, null, c, 3);
         Assert.assertEquals("{\"a\":n1,\"b\":n2,\"c\":n3}", n.asString());
         n = n.cloneAndAddChildNode("d", false, null, d, 4);
-        if (MemoryKernelImpl.SORT_CHILDREN) {
-            Assert.assertEquals("{\":children\":n5,\":names\":\"a\",\":children\":n6,\":names\":\"b\",\":children\":n7,\":names\":\"c\",\":children\":n8,\":names\":\"d\",\n\":childCount\":4}",
-                    n.asString());
-        } else {
-            Assert.assertEquals("{\":children\":n5,\":names\":\"0e00\",\":children\":n6,\":names\":\"1000\",\":childCount\":4}",
-                    n.asString());
-        }
+        Assert.assertEquals("{\":children\":n5,\":names\":\"a\",\":children\":n6,\":names\":\"b\",\":children\":n7,\":names\":\"c\",\":children\":n8,\":names\":\"d\",\n\":childCount\":4}",
+                n.asString());
         n2 = NodeImpl.fromString(map, n.asString());
-        if (MemoryKernelImpl.SORT_CHILDREN) {
-            Assert.assertEquals("{\":children\":n5,\":names\":\"a\",\":children\":n6,\":names\":\"b\",\":children\":n7,\":names\":\"c\",\":children\":n8,\":names\":\"d\",\n\":childCount\":4}",
-                    n2.asString());
-        } else {
-            Assert.assertEquals("{\":children\":n5,\":names\":\"0e00\",\":children\":n6,\":names\":\"1000\",\":childCount\":4}",
-                    n2.asString());
-        }
+        Assert.assertEquals("{\":children\":n5,\":names\":\"a\",\":children\":n6,\":names\":\"b\",\":children\":n7,\":names\":\"c\",\":children\":n8,\":names\":\"d\",\n\":childCount\":4}",
+                n2.asString());
         Assert.assertTrue(n2.exists("a"));
         Assert.assertTrue(n2.exists("b"));
         Assert.assertTrue(n2.exists("c"));



Mime
View raw message