jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r945216 - in /jackrabbit/sandbox/jackrabbit-j3/src: main/java/org/apache/jackrabbit/j3/ main/java/org/apache/jackrabbit/j3/mc/ main/java/org/apache/jackrabbit/j3/mc/jdbc/ main/java/org/apache/jackrabbit/j3/mc/mem/ main/java/org/apache/jackr...
Date Mon, 17 May 2010 15:38:37 GMT
Author: thomasm
Date: Mon May 17 15:38:36 2010
New Revision: 945216

URL: http://svn.apache.org/viewvc?rev=945216&view=rev
Log:
Started to implement unlimited number of child nodes and ordering of child nodes.

Added:
    jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestOrderableChildNodes.java
    jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/integration/
      - copied from r935321, jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/slow/
Removed:
    jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/slow/
Modified:
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeState.java
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/NodeData.java
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/StorageSession.java
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/jdbc/JdbcStorageSession.java
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/mem/MemStorageSession.java
    jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/util/Constants.java
    jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestAll.java
    jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestBase.java
    jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/integration/TestLargeTransaction.java

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeImpl.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeImpl.java
Mon May 17 15:38:36 2010
@@ -259,7 +259,7 @@ public class NodeImpl implements Node, L
     public boolean hasNode(String relPath) throws RepositoryException {
         log.code(this, "hasNode", relPath);
         Val childName = getSession().parseName(relPath);
-        Val childId = state.getNodeData().getChildId(childName);
+        Val childId = state.getChildId(childName);
         return childId != null;
     }
 

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeState.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/NodeState.java
Mon May 17 15:38:36 2010
@@ -136,18 +136,6 @@ public class NodeState {
         return session;
     }
 
-    void addChild(Val childName, Val id) {
-        modifyBegin();
-        data.addChild(childName, id);
-        modifyEnd();
-    }
-
-    void removeChild(Val childName) {
-        modifyBegin();
-        data.removeChild(childName);
-        modifyEnd();
-    }
-
     void setLockToken(Val lockToken) {
         modifyBegin();
         data.setLockToken(lockToken);
@@ -200,12 +188,61 @@ public class NodeState {
         return modCount;
     }
 
-    Val getNextChildId(NodeState last) {
-        return data.getNextChildId(last == null ? null : last.data);
-    }
-
     boolean isModified() {
         return modCount != 0;
     }
 
+    void addChild(Val childName, Val id) {
+        modifyBegin();
+        int todoChangeForManyChilds;
+        if (data.getChildCount() >= session.getStorageSession().getMaxChildCount()) {
+            data.setHiddenChildNodes(true);
+
+        }
+        if (data.getHiddenChildNodes()) {
+
+        }
+        data.addChild(childName, id);
+        modifyEnd();
+    }
+
+    void removeChild(Val childName) {
+        int todoChangeForManyChilds;
+        modifyBegin();
+        if (data.getHiddenChildNodes()) {
+
+        } else {
+            data.removeChild(childName);
+        }
+        modifyEnd();
+    }
+
+    Val getChildId(Val childName) {
+        return getChildId(data, childName);
+    }
+
+    private Val getChildId(NodeData data, Val childName) {
+        if (!data.getHiddenChildNodes()) {
+            return data.getChildId(childName);
+        }
+        int index = data.getChildIndex(childName);
+        if (index < 0) {
+            index = -index + 1;
+        }
+        if (index >= data.getChildCount()) {
+            return null;
+        }
+        Val v = data.getChildId(index);
+        data = session.getPersistedNodeData(v);
+        return getChildId(data, childName);
+    }
+
+    Val getNextChildId(NodeState last) {
+        int todoChangeForManyChilds;
+        if (data.getHiddenChildNodes()) {
+
+        }
+        return data.getNextChildId(last == null ? null : last.data);
+    }
+
 }

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/NodeData.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/NodeData.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/NodeData.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/NodeData.java
Mon May 17 15:38:36 2010
@@ -31,16 +31,21 @@ public class NodeData implements CacheEl
     private static final int BIT_PRIMARY_TYPE = 8;
     private static final int BIT_LOCKED = 16;
     private static final int BIT_EMBEDDED_CHILD_NODES = 32;
+    private static final int BIT_HIDDEN_CHILD_NODES = 64;
 
     private final Val id;
     private final Val primaryParentId;
     private long version;
     private Val primaryType;
     private Val lockToken;
+    private Val childNameFirst, childNameLast;
+    // TODO maybe combine all pairs into one array
     private Val[] propertyValuePairs;
     private Val[] childNameIdPairs;
+    private Val[] childNamePrevNextPairs;
     private int cachedParentIndex;
     private int memoryCache;
+    private boolean hiddenChildNodes;
 
     public NodeData(Val id, Val primaryParentId, long version) {
         this.id = id;
@@ -50,9 +55,16 @@ public class NodeData implements CacheEl
 
     public NodeData createCopy() {
         NodeData copy = new NodeData(id, primaryParentId, version);
-        copy.memoryCache = memoryCache;
+        copy.primaryType = primaryType;
+        copy.lockToken = lockToken;
+        copy.childNameFirst = childNameFirst;
+        copy.childNameLast = childNameLast;
         copy.propertyValuePairs = propertyValuePairs;
         copy.childNameIdPairs = childNameIdPairs;
+        copy.childNamePrevNextPairs = childNamePrevNextPairs;
+        copy.cachedParentIndex = cachedParentIndex;
+        copy.memoryCache = memoryCache;
+        copy.hiddenChildNodes = hiddenChildNodes;
         return copy;
     }
 
@@ -84,14 +96,53 @@ public class NodeData implements CacheEl
         return propertyValuePairs[index];
     }
 
+    public Val getChildId(int index) {
+        index += index;
+        if (childNameIdPairs == null || index >= childNameIdPairs.length) {
+            return null;
+        }
+        return childNameIdPairs[index];
+    }
+
     public void addChild(Val childName, Val childId) {
         if (getChildId(childName) != null) {
             throw ExceptionFactory.mcException("Duplicate node {0}", childName);
         }
         childNameIdPairs = updatePair(childNameIdPairs, childName, childId);
+        if (childNamePrevNextPairs != null) {
+            int index = search(childName, childNameIdPairs);
+            int newLength = childNameIdPairs.length;
+            Val[] newPrevNext = new Val[newLength];
+            if (newLength == 2) {
+                childNameFirst = childName;
+                childNameLast = childName;
+            } else {
+                System.arraycopy(childNamePrevNextPairs, 0, newPrevNext, 0, index);
+                System.arraycopy(childNamePrevNextPairs, index, newPrevNext, index + 2, newLength
- 2 - index);
+                newPrevNext[index] = childNameLast;
+                int lastIndex = search(childNameLast, childNameIdPairs);
+                newPrevNext[lastIndex + 1] = childName;
+                childNameLast = childName;
+            }
+            childNamePrevNextPairs = newPrevNext;
+        }
     }
 
     public void removeChild(Val childName) {
+        if (childNamePrevNextPairs != null) {
+            int index = search(childName, childNameIdPairs);
+            int newLength = childNameIdPairs.length - 2;
+            Val[] newPrevNext = new Val[newLength];
+            System.arraycopy(childNamePrevNextPairs, 0, newPrevNext, 0, index);
+            System.arraycopy(childNamePrevNextPairs, index + 2, newPrevNext, index, newLength
- index);
+            if (childNameFirst.equals(childName)) {
+                childNameFirst = childNamePrevNextPairs[index + 1];
+            }
+            if (childNameLast.equals(childName)) {
+                childNameLast = childNamePrevNextPairs[index];
+            }
+
+        }
         childNameIdPairs = updatePair(childNameIdPairs, childName, null);
     }
 
@@ -100,7 +151,7 @@ public class NodeData implements CacheEl
     }
 
     public Val getName(NodeData parent) {
-        int index = getChildIndex(parent);
+        int index = getChildIndexInParent(parent);
         if (index < 0) {
             if (parent == null) {
                 return Val.get("");
@@ -118,7 +169,7 @@ public class NodeData implements CacheEl
             }
             index = 0;
         } else {
-            index = lastChild.getChildIndex(this);
+            index = lastChild.getChildIndexInParent(this);
             if (index < 0 || index + 2 >= childNameIdPairs.length) {
                 return null;
             }
@@ -127,7 +178,7 @@ public class NodeData implements CacheEl
         return childNameIdPairs[index + 1];
     }
 
-    private int getChildIndex(NodeData parent) {
+    private int getChildIndexInParent(NodeData parent) {
         if (parent == null) {
             return -1;
         }
@@ -149,6 +200,20 @@ public class NodeData implements CacheEl
         return cachedParentIndex;
     }
 
+    /**
+     * Get the index of the given child node name.
+     * This method works like java.util.Array.binarySearch.
+     *
+     * @param name the child node name to search
+     * @return the index if found (0, 1,...); or (-index - 1) if not
+     */
+    public int getChildIndex(Val name) {
+        if (childNameIdPairs == null) {
+            return -1;
+        }
+        return search(name, childNameIdPairs) / 2;
+    }
+
     public Val getChildId(Val name) {
         if (childNameIdPairs == null) {
             return null;
@@ -172,14 +237,17 @@ public class NodeData implements CacheEl
         if (propertyValuePairs == null) {
             return -1;
         }
-        int index = search(propertyName, propertyValuePairs);
-        return index / 2;
+        return search(propertyName, propertyValuePairs);
     }
 
     public int getPropertyCount() {
         return propertyValuePairs == null ? 0 : propertyValuePairs.length / 2;
     }
 
+    public int getChildCount() {
+        return childNameIdPairs == null ? 0 : childNameIdPairs.length / 2;
+    }
+
     public Val getPropertyValue(Val propertyName) {
         if (propertyValuePairs == null) {
             return null;
@@ -234,6 +302,15 @@ public class NodeData implements CacheEl
         return pairs;
     }
 
+    /**
+     * Return the index of the key within the array of key-value pairs. If
+     * found, the method returns the index of the key, if not this method
+     * returns (- index - 2). See also Arrays.binarySearch.
+     *
+     * @param key the key
+     * @param pair the key-value pair
+     * @return the index
+     */
     private int search(Val key, Val[] pair) {
         int low = 0;
         int high = pair.length / 2 - 1;
@@ -329,6 +406,8 @@ public class NodeData implements CacheEl
         if ((flags & BIT_CHILDREN) != 0) {
             int count = bundle.readVarInt();
             data.childNameIdPairs = readArray(bundle, count * 2);
+            // TODO child order
+            data.childNamePrevNextPairs = new Val[count * 2];
         }
         if ((flags & BIT_PROPERTIES) != 0) {
             int count = bundle.readVarInt();
@@ -337,6 +416,9 @@ public class NodeData implements CacheEl
         if ((flags & BIT_EMBEDDED_CHILD_NODES) != 0) {
             throw ExceptionFactory.unsupportedOperation();
         }
+        if ((flags & BIT_HIDDEN_CHILD_NODES) != 0) {
+            data.hiddenChildNodes = true;
+        }
         return data;
     }
 
@@ -367,6 +449,9 @@ public class NodeData implements CacheEl
         if (propertyValuePairs != null) {
             flags |= BIT_PROPERTIES;
         }
+        if (hiddenChildNodes) {
+            flags |= BIT_HIDDEN_CHILD_NODES;
+        }
         bundle.writeVarLong(flags);
         if (version != 0) {
             bundle.writeVarLong(version);
@@ -378,6 +463,7 @@ public class NodeData implements CacheEl
             bundle.writeVal(primaryType);
         }
         if (childNameIdPairs != null) {
+            // TODO child order
             bundle.writeVarInt(childNameIdPairs.length / 2);
             for (Val v : childNameIdPairs) {
                 bundle.writeVal(v);
@@ -421,4 +507,12 @@ public class NodeData implements CacheEl
         version++;
     }
 
+    public boolean getHiddenChildNodes() {
+        return hiddenChildNodes;
+    }
+
+    public void setHiddenChildNodes(boolean hiddenChildNodes) {
+        this.hiddenChildNodes = hiddenChildNodes;
+    }
+
 }

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/StorageSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/StorageSession.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/StorageSession.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/StorageSession.java
Mon May 17 15:38:36 2010
@@ -162,4 +162,11 @@ public interface StorageSession {
      */
     DataStore getDataStore();
 
+    /**
+     * The maximum number of child nodes per node.
+     *
+     * @return the maximum number
+     */
+    int getMaxChildCount();
+
 }

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/jdbc/JdbcStorageSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/jdbc/JdbcStorageSession.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/jdbc/JdbcStorageSession.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/jdbc/JdbcStorageSession.java
Mon May 17 15:38:36 2010
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.j3.mc.Bundl
 import org.apache.jackrabbit.j3.mc.NodeData;
 import org.apache.jackrabbit.j3.mc.StorageSession;
 import org.apache.jackrabbit.j3.mc.Val;
+import org.apache.jackrabbit.j3.util.Constants;
 import org.apache.jackrabbit.j3.util.ExceptionFactory;
 
 /**
@@ -305,4 +306,8 @@ public class JdbcStorageSession implemen
         return storage.getDataStore();
     }
 
+    public int getMaxChildCount() {
+        return Constants.MAX_CHILD_COUNT;
+    }
+
 }

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/mem/MemStorageSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/mem/MemStorageSession.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/mem/MemStorageSession.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/mc/mem/MemStorageSession.java
Mon May 17 15:38:36 2010
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.j3.mc.Bundl
 import org.apache.jackrabbit.j3.mc.NodeData;
 import org.apache.jackrabbit.j3.mc.StorageSession;
 import org.apache.jackrabbit.j3.mc.Val;
+import org.apache.jackrabbit.j3.util.Constants;
 import org.apache.jackrabbit.j3.util.ExceptionFactory;
 
 /**
@@ -111,4 +112,8 @@ public class MemStorageSession implement
         return null;
     }
 
+    public int getMaxChildCount() {
+        return Constants.MAX_CHILD_COUNT;
+    }
+
 }

Modified: jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/util/Constants.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/util/Constants.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/util/Constants.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/main/java/org/apache/jackrabbit/j3/util/Constants.java
Mon May 17 15:38:36 2010
@@ -30,6 +30,8 @@ public class Constants {
 
     public static final int MAX_STORE_RETRY = 3;
 
+    public static final int MAX_CHILD_COUNT = 200;
+
     public static final int MEM_CACHE_PER_REPOSITORY = 16 * 1024 * 1024;
     public static final int MEM_CACHE_PER_SESSION = 1024 * 1024;
     public static final int MEM_MAP_ENTRY = 32;

Modified: jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestAll.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestAll.java (original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestAll.java Mon
May 17 15:38:36 2010
@@ -17,12 +17,13 @@
 package org.apache.jackrabbit.j3;
 
 import junit.framework.Test;
+import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 /**
  * Runs all tests.
  */
-public class TestAll {
+public class TestAll extends TestCase {
 
     /**
      * Returns a <code>Test</code> suite that executes all tests inside this
@@ -36,11 +37,21 @@ public class TestAll {
 
         int todo;
 
+        // ability to disable the even journal (for a repo, for each session)
+
+        // many child nodes
+
+        // unsorted / sort child sortedChildNodeNames
+
+        // sns
+
         // integrated lob storage
         // database data store: should use the session to access the binary
         // (like this we can also restrict on temporary storage per session)
 
-        // ability to disable the even journal (for each session?)
+        // data store: automatically fast when moving data from two repositories that
+        // share the same data store, using special input stream classes
+        // or provide a good API (without casting)
 
         // XA API
 
@@ -58,24 +69,28 @@ public class TestAll {
         // API improvements:
         // change RepositoryException to RuntimeException
         // remove weird exceptions from throws clauses
-        // get rid of Binary and de-deprecate InputStream methods
+        // get rid of Binary and un-deprecate InputStream methods
         // make namespace registry global
+        // NodeIterators: support Iterable
+        // somehow support getValue for multi-value properties
 
         suite.addTestSuite(TestBundle.class);
-        suite.addTestSuite(TestNamespaceRegistry.class);
-        suite.addTestSuite(TestNodeTypeRegistry.class);
-        suite.addTestSuite(TestSecurity.class);
         suite.addTestSuite(TestCache.class);
         suite.addTestSuite(TestCreateNodesTraverse.class);
         suite.addTestSuite(TestEventJournal.class);
         suite.addTestSuite(TestLargeObject.class);
+        // suite.addTestSuite(TestOrderableChildNodes.class);
+        suite.addTestSuite(TestNamespaceRegistry.class);
+        suite.addTestSuite(TestNodeTypeRegistry.class);
+        suite.addTestSuite(TestSecurity.class);
 
         for (int i = 0; i < TestBase.URL.length; i++) {
+
             suite.addTestSuite(TestConcurrentWrite.class);
             suite.addTestSuite(TestLock.class);
-            suite.addTestSuite(TestSimple.class);
             suite.addTestSuite(TestObservation.class);
             suite.addTestSuite(TestSessionGC.class);
+            suite.addTestSuite(TestSimple.class);
 
             suite.addTestSuite(TestNextConfiguration.class);
         }

Modified: jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestBase.java?rev=945216&r1=945215&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestBase.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestBase.java
Mon May 17 15:38:36 2010
@@ -31,7 +31,7 @@ import org.apache.commons.io.FileUtils;
 /**
  * The base class for the tests.
  */
-public class TestBase extends TestCase {
+public abstract class TestBase extends TestCase {
 
     protected static int configurationId;
 
@@ -72,4 +72,8 @@ public class TestBase extends TestCase {
         return new SimpleCredentials("sa", "sa".toCharArray());
     }
 
+    protected int getTestScale() {
+        return Integer.parseInt(System.getProperty("test.scale", "1"));
+    }
+
 }

Added: jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestOrderableChildNodes.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestOrderableChildNodes.java?rev=945216&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestOrderableChildNodes.java
(added)
+++ jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/TestOrderableChildNodes.java
Mon May 17 15:38:36 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j3;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+
+/**
+ * Tests orderable child nodes.
+ */
+public class TestOrderableChildNodes extends TestBase {
+
+    public void test() throws Exception {
+
+        Session session = openSession();
+        Node root = session.getRootNode();
+        if (root.hasNode("test")) {
+            root.getNode("test").remove();
+            session.save();
+        }
+        Node test = root.addNode("test");
+
+        test.addNode("the");
+        test.addNode("lazy");
+        test.addNode("fox");
+        session.save();
+
+        NodeIterator it = test.getNodes();
+        Node n;
+        n = it.nextNode();
+        assertEquals("the", n.getName());
+        n = it.nextNode();
+        assertEquals("lazy", n.getName());
+        n = it.nextNode();
+        assertEquals("fox", n.getName());
+
+        session.logout();
+
+    }
+
+}

Modified: jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/integration/TestLargeTransaction.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/integration/TestLargeTransaction.java?rev=945216&r1=935321&r2=945216&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/integration/TestLargeTransaction.java
(original)
+++ jackrabbit/sandbox/jackrabbit-j3/src/test/java/org/apache/jackrabbit/j3/integration/TestLargeTransaction.java
Mon May 17 15:38:36 2010
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.j3.slow;
+package org.apache.jackrabbit.j3.integration;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -27,8 +27,16 @@ public class TestLargeTransaction extend
 
     public void test() throws Exception {
         Node n = session.getRootNode().addNode("testLarge");
-        // transiently create about 1 million nodes
-        int count = add(0, n, 10, 5);
+
+        int count;
+        if (getTestScale() > 1) {
+            // transiently create about 1 million nodes
+            count = add(0, n, 10, 5);
+        } else {
+            // transiently create about 1 million nodes
+            count = add(0, n, 4, 3);
+        }
+
         System.out.println(count);
         long time = System.currentTimeMillis();
         System.out.println("saving...");



Mime
View raw message