[exo-jcr-commits] exo-jcr SVN: r4835 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/impl/core and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Sep 2 08:24:31 EDT 2011


Author: nzamosenchuk
Date: 2011-09-02 08:24:30 -0400 (Fri, 02 Sep 2011)
New Revision: 4835

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNodesLazily.java
Log:
EXOJCR-1458 : Fixed incorrectly calculated orderNum

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java	2011-09-02 10:40:08 UTC (rev 4834)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java	2011-09-02 12:24:30 UTC (rev 4835)
@@ -169,7 +169,14 @@
          // type of the parent node of the new location, then the
          // newly moved node is appended to the end of the child
          // node list.
-         destOrderNum = destChilds.size() > 0 ? destChilds.get(destChilds.size() - 1).getOrderNumber() + 1 : 0;
+         destOrderNum = 0;
+         for (NodeData child : destChilds)
+         {
+            if (child.getOrderNumber() + 1 > destOrderNum)
+            {
+               destOrderNum = child.getOrderNumber() + 1;
+            }
+         }
 
          if (destParent == srcParent)// (destParent.getIdentifier().equals(node.getParentIdentifier()))
          {

Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNodesLazily.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNodesLazily.java	2011-09-02 10:40:08 UTC (rev 4834)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestGetNodesLazily.java	2011-09-02 12:24:30 UTC (rev 4835)
@@ -76,7 +76,7 @@
    /**
     * All child they reordered one by one and though must be returned in same order 
     */
-   public void _testGetNodesLazilyReordered() throws Exception
+   public void testGetNodesLazilyReordered() throws Exception
    {
       // 150 nodes added in setup
       for (int i = 0; i < nodesCount; i++)
@@ -91,7 +91,7 @@
    /**
     * All child they reordered one by one and though must be returned in same order 
     */
-   public void _testGetNodesLazilyReorderedBackwards() throws Exception
+   public void testGetNodesLazilyReorderedBackwards() throws Exception
    {
       // 150 nodes added in setup
       // TODO : testcase fails
@@ -241,7 +241,7 @@
     * All child nodes are in session changes log and both in persisted layer. All they reordered one by one and though must 
     * be returned in same order
     */
-   public void _testGetNodesLazilySessionReordered() throws Exception
+   public void testGetNodesLazilySessionReordered() throws Exception
    {
       // 150 nodes added in setup
       // TODO : testcase fails



More information about the exo-jcr-commits mailing list