[exo-jcr-commits] exo-jcr SVN: r4670 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/dataflow and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jul 21 05:39:19 EDT 2011


Author: nzamosenchuk
Date: 2011-07-21 05:39:19 -0400 (Thu, 21 Jul 2011)
New Revision: 4670

Added:
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/AbstractSameNameSiblingsMoveTest.java
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsSessionMove.java
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsWorkspaceMove.java
Removed:
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsMove.java
Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java
Log:
EXOJCR-1370 : fixed SNS move issue. Also ItemReferensePool issue fixed, that may cause some perf decrease, since ItemReferencePool was not updated before. 

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java	2011-07-20 09:57:28 UTC (rev 4669)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -1006,7 +1006,8 @@
    public int getLastOrderNumber(NodeData parent) throws RepositoryException
    {
       int lastOrderNumber = changesLog.getLastChildOrderNumber(parent.getIdentifier());
-      int lastPersistedNodeOrderNumber = isNew(parent.getIdentifier()) ? -1 : transactionableManager.getLastOrderNumber(parent);
+      int lastPersistedNodeOrderNumber =
+         isNew(parent.getIdentifier()) ? -1 : transactionableManager.getLastOrderNumber(parent);
 
       return Math.max(lastPersistedNodeOrderNumber, lastOrderNumber);
    }
@@ -1017,7 +1018,8 @@
    public int getChildNodesCount(NodeData parent) throws RepositoryException
    {
       int childsCount =
-         changesLog.getChildNodesCount(parent.getIdentifier()) + (isNew(parent.getIdentifier()) ? 0 : transactionableManager.getChildNodesCount(parent));
+         changesLog.getChildNodesCount(parent.getIdentifier())
+            + (isNew(parent.getIdentifier()) ? 0 : transactionableManager.getChildNodesCount(parent));
       if (childsCount < 0)
       {
          throw new InvalidItemStateException("Node's child nodes were changed in another Session "
@@ -1219,6 +1221,8 @@
       }
    }
 
+   // TODO: review. Won't work if renamed states for descendants are not fired
+   // Node will be only updated with the same NodeData with same outdated path
    void reloadPool(ItemData fromItem) throws RepositoryException
    {
       Collection<ItemImpl> pooledItems = itemsPool.getAll();
@@ -1267,7 +1271,18 @@
 
       changesLog.addAll(initializer.getAllStates());
 
-      reloadPool(srcData);
+      // reload items pool
+      for (ItemState state : initializer.getItemAddStates())
+      {
+         if (state.isUpdated() || state.isRenamed())
+         {
+            ItemImpl item = reloadItem(state.getData());
+            if (item != null)
+            {
+               invalidated.add(item);
+            }
+         }
+      }
    }
 
    /**
@@ -1305,8 +1320,8 @@
       if (itemData.isNode())
       {
          checkRemoveChildVersionStorages =
-            !session.getWorkspace().getNodeTypesHolder()
-               .isNodeType(Constants.NT_VERSIONHISTORY, ((NodeData)itemData).getPrimaryTypeName());
+            !session.getWorkspace().getNodeTypesHolder().isNodeType(Constants.NT_VERSIONHISTORY,
+               ((NodeData)itemData).getPrimaryTypeName());
       }
 
       boolean rootAdded = false;
@@ -1450,7 +1465,7 @@
                   // We can't remove this VH now.
                   return;
                } // else -- if we has a references in workspace where the VH is being
-                 // deleted we can remove VH now.
+               // deleted we can remove VH now.
             }
          }
          finally
@@ -1875,8 +1890,8 @@
    {
 
       Collection<ItemDefinitionData> mandatoryItemDefs =
-         session.getWorkspace().getNodeTypesHolder()
-            .getManadatoryItemDefs(nData.getPrimaryTypeName(), nData.getMixinTypeNames());
+         session.getWorkspace().getNodeTypesHolder().getManadatoryItemDefs(nData.getPrimaryTypeName(),
+            nData.getMixinTypeNames());
       for (ItemDefinitionData itemDefinitionData : mandatoryItemDefs)
       {
          if (getItemData(nData, new QPathEntry(itemDefinitionData.getName(), 0), ItemType.UNKNOWN) == null)
@@ -1995,8 +2010,8 @@
                   {
                      QPathEntry[] path = pooled.getData().getQPath().getEntries();
                      persisted =
-                        transactionableManager.getItemData(parent, path[path.length - 1],
-                           ItemType.getItemType(pooled.getData()));
+                        transactionableManager.getItemData(parent, path[path.length - 1], ItemType.getItemType(pooled
+                           .getData()));
                   } // else, the item has an invalid state, will be throwed on save
                }
                if (persisted != null)
@@ -2320,7 +2335,7 @@
             List<PropertyData> childProps =
                listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager
                   .getChildPropertiesData((NodeData)parent);
-            outer : for (int i = 0, length = childProps.size(); i < length; i++) 
+            outer : for (int i = 0, length = childProps.size(); i < length; i++)
             {
                PropertyData childProp = childProps.get(i);
                for (ItemState transientState : transientDescendants)

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java	2011-07-20 09:57:28 UTC (rev 4669)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -123,7 +123,7 @@
       {
          log.info("The JCR will throw an exception anytime we will try to use a dead session.");
       }
-   }   
+   }
 
    public static final int DEFAULT_LAZY_READ_THRESHOLD = 100;
 
@@ -152,9 +152,9 @@
    protected final String workspaceName;
 
    private boolean live;
-   
+
    private boolean expired;
-   
+
    private Exception closedByCallStack;
 
    private final List<SessionLifecycleListener> lifecycleListeners;
@@ -179,7 +179,7 @@
     * Transaction resources manager.
     */
    private final TransactionableResourceManager txResourceManager;
-   
+
    /**
     * The local timeout of the session, by default it will use the global timeout defined at repository configuration level
     */
@@ -193,7 +193,8 @@
       this.live = true;
       this.id = IdGenerator.generate();
       this.userState = userState;
-      this.txResourceManager = (TransactionableResourceManager)container.getComponentInstanceOfType(TransactionableResourceManager.class);
+      this.txResourceManager =
+         (TransactionableResourceManager)container.getComponentInstanceOfType(TransactionableResourceManager.class);
 
       this.repository = (RepositoryImpl)container.getComponentInstanceOfType(RepositoryImpl.class);
       this.systemLocationFactory = (LocationFactory)container.getComponentInstanceOfType(LocationFactory.class);
@@ -915,14 +916,15 @@
       {
          if (PROHIBIT_CLOSED_SESSION_USAGE)
          {
-            throw new RepositoryException("This kind of operation is forbidden after a session.logout().", closedByCallStack);
+            throw new RepositoryException("This kind of operation is forbidden after a session.logout().",
+               closedByCallStack);
          }
          // warn in debug mode only
          else if (PropertyManager.isDevelopping())
          {
             log.warn("This kind of operation is forbidden after a session.logout(), "
-                     + "please note that an exception will be raised in the next jcr version.", new Exception(
-                     closedByCallStack));
+               + "please note that an exception will be raised in the next jcr version.", new Exception(
+               closedByCallStack));
          }
       }
    }
@@ -971,7 +973,7 @@
       this.expired = true;
       logout();
    }
-   
+
    /**
     * {@inheritDoc}
     */
@@ -1012,9 +1014,18 @@
             throw new ItemExistsException("A node with this name (" + destAbsPath + ") is already exists. ");
          }
       }
-
+      NodeImpl srcParentNode = null;
+      if (destParentNode.getIdentifier().equals(srcNode.getParentIdentifier()))
+      {
+         // move to same parent
+         srcParentNode = destParentNode;
+      }
+      else
+      {
+         srcParentNode = srcNode.parent();
+      }
       // Check if versionable ancestor is not checked-in
-      if (!srcNode.parent().checkedOut())
+      if (!srcParentNode.checkedOut())
       {
          throw new VersionException("Parent or source Node or its nearest ancestor is checked-in");
       }
@@ -1026,8 +1037,8 @@
 
       ItemDataMoveVisitor initializer =
          new ItemDataMoveVisitor((NodeData)destParentNode.getData(), destNodePath.getName().getInternalName(),
-            nodeTypeManager, getTransientNodesManager(), true, triggerEventsForDescendentsOnRename
-               || !srcNodePath.makeParentPath().equals(destNodePath.makeParentPath()));
+            (NodeData)srcParentNode.getData(), nodeTypeManager, getTransientNodesManager(), true,
+            triggerEventsForDescendentsOnRename || srcParentNode != destParentNode);
 
       getTransientNodesManager().rename((NodeData)srcNode.getData(), initializer);
    }
@@ -1154,7 +1165,7 @@
    {
       this.timeout = (timeout <= 0 ? 0 : timeout);
    }
-   
+
    /**
     * {@inheritDoc}
     */

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java	2011-07-20 09:57:28 UTC (rev 4669)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -439,9 +439,18 @@
             throw new ItemExistsException(msg);
          }
       }
-
+      NodeImpl srcParentNode = null;
+      if (destParentNode.getIdentifier().equals(srcNode.getParentIdentifier()))
+      {
+         // move to same parent
+         srcParentNode = destParentNode;
+      }
+      else
+      {
+         srcParentNode = srcNode.parent();
+      }
       // Check if versionable ancestor is not checked-in
-      if (!srcNode.checkedOut())
+      if (!srcParentNode.checkedOut())
       {
          throw new VersionException("Source parent node " + srcNode.getPath()
             + " or its nearest ancestor is checked-in");
@@ -454,12 +463,21 @@
 
       ItemDataMoveVisitor initializer =
          new ItemDataMoveVisitor((NodeData)destParentNode.getData(), destNodePath.getName().getInternalName(),
-            nodeTypeManager, session.getTransientNodesManager(), true);
+            (NodeData)srcParentNode.getData(), nodeTypeManager, session.getTransientNodesManager(), true);
       srcNode.getData().accept(initializer);
 
       PlainChangesLog changes = new PlainChangesLogImpl(session.getId());
       changes.addAll(initializer.getAllStates());
 
+      // reload items pool
+      for (ItemState state : initializer.getItemAddStates())
+      {
+         if (state.isUpdated() || state.isRenamed())
+         {
+            (session.getTransientNodesManager()).reloadItem(state.getData());
+         }
+      }
+
       session.getTransientNodesManager().getTransactManager().save(changes);
    }
 

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-07-20 09:57:28 UTC (rev 4669)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataMoveVisitor.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -27,6 +27,7 @@
 import org.exoplatform.services.jcr.datamodel.NodeData;
 import org.exoplatform.services.jcr.datamodel.PropertyData;
 import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
 import org.exoplatform.services.jcr.datamodel.ValueData;
 import org.exoplatform.services.jcr.impl.Constants;
 import org.exoplatform.services.jcr.impl.core.SessionDataManager;
@@ -65,6 +66,11 @@
    protected Stack<NodeData> parents;
 
    /**
+    * Contains instance of source parent
+    */
+   protected NodeData srcParent;
+
+   /**
     * The list of added item states
     */
    protected List<ItemState> addStates = new ArrayList<ItemState>();
@@ -103,8 +109,9 @@
     * @param triggerEventsForDescendents 
     *          - Trigger events for descendents.          
     */
-   public ItemDataMoveVisitor(NodeData parent, InternalQName dstNodeName, NodeTypeDataManager nodeTypeManager,
-      SessionDataManager srcDataManager, boolean keepIdentifiers, boolean triggerEventsForDescendents)
+   public ItemDataMoveVisitor(NodeData parent, InternalQName dstNodeName, NodeData srcParent,
+      NodeTypeDataManager nodeTypeManager, SessionDataManager srcDataManager, boolean keepIdentifiers,
+      boolean triggerEventsForDescendents)
    {
       super(srcDataManager, triggerEventsForDescendents ? INFINITE_DEPTH : 0);
       this.keepIdentifiers = keepIdentifiers;
@@ -113,6 +120,7 @@
 
       this.parents = new Stack<NodeData>();
       this.parents.add(parent);
+      this.srcParent = srcParent;
       this.triggerEventsForDescendents = triggerEventsForDescendents;
    }
 
@@ -127,10 +135,10 @@
     * @param skipEventsForDescendents - Don't generate events for the 
     *          descendants. 
     */
-   public ItemDataMoveVisitor(NodeData parent, InternalQName dstNodeName, NodeTypeDataManager nodeTypeManager,
-      SessionDataManager srcDataManager, boolean keepIdentifiers)
+   public ItemDataMoveVisitor(NodeData parent, InternalQName dstNodeName, NodeData srcParent,
+      NodeTypeDataManager nodeTypeManager, SessionDataManager srcDataManager, boolean keepIdentifiers)
    {
-      this(parent, dstNodeName, nodeTypeManager, srcDataManager, keepIdentifiers, true);
+      this(parent, dstNodeName, srcParent, nodeTypeManager, srcDataManager, keepIdentifiers, true);
    }
 
    @Override
@@ -142,7 +150,7 @@
          ancestorToSave = QPath.getCommonAncestorPath(curParent().getQPath(), node.getQPath());
       }
 
-      NodeData parent = curParent();
+      NodeData destParent = curParent();
 
       int destIndex; // index for path
       int destOrderNum; // order number
@@ -152,9 +160,8 @@
       {
          qname = destNodeName;
 
-         List<NodeData> destChilds = dataManager.getChildNodesData(parent);
+         List<NodeData> destChilds = dataManager.getChildNodesData(destParent);
          List<NodeData> srcChilds;
-         NodeData srcParent;
 
          destIndex = 1;
 
@@ -164,31 +171,23 @@
          // node list.
          destOrderNum = destChilds.size() > 0 ? destChilds.get(destChilds.size() - 1).getOrderNumber() + 1 : 0;
 
-         if (parent.getIdentifier().equals(node.getParentIdentifier()))
+         if (destParent == srcParent)// (destParent.getIdentifier().equals(node.getParentIdentifier()))
          {
             // move to same parent
             srcChilds = destChilds;
-            srcParent = parent;
          }
          else
          {
             // move to another parent
+            srcChilds = dataManager.getChildNodesData(srcParent);
             // find index on destination
             for (NodeData dchild : destChilds)
             {
-               if (dchild.getQPath().getName().equals(qname))
+               if (dchild.getQPath().getName().equals(destNodeName))
+               {
                   destIndex++;
+               }
             }
-
-            // for fix SNSes on source
-            srcParent = (NodeData)dataManager.getItemData(node.getParentIdentifier());
-            if (srcParent == null)
-            {
-               throw new RepositoryException("FATAL: parent Node not for " + node.getQPath().getAsString()
-                  + ", parent id: " + node.getParentIdentifier());
-            }
-
-            srcChilds = dataManager.getChildNodesData(srcParent);
          }
 
          int srcIndex = 1;
@@ -199,26 +198,23 @@
             NodeData child = srcChilds.get(i);
             if (!child.getIdentifier().equals(node.getIdentifier()))
             {
-               if (child.getQPath().getName().equals(qname))
+               if ((child.getQPath().getName()).getAsString().equals((node.getQPath().getName()).getAsString()))
                {
                   QPath siblingPath = QPath.makeChildPath(srcParent.getQPath(), child.getQPath().getName(), srcIndex);
                   TransientNodeData sibling =
-                     new TransientNodeData(siblingPath, child.getIdentifier(), child.getPersistedVersion() + 1,
-                        child.getPrimaryTypeName(), child.getMixinTypeNames(), child.getOrderNumber(),
-                        child.getParentIdentifier(), child.getACL());
-
+                     new TransientNodeData(siblingPath, child.getIdentifier(), child.getPersistedVersion() + 1, child
+                        .getPrimaryTypeName(), child.getMixinTypeNames(), child.getOrderNumber(), child
+                        .getParentIdentifier(), child.getACL());
                   addStates.add(new ItemState(sibling, ItemState.UPDATED, true, ancestorToSave, false, true));
-
                   srcIndex++;
                }
+               // find index on destination in case when destination the same as source
+               if (srcChilds == destChilds && (child.getQPath().getName().equals(destNodeName)))
+               {
+                  destIndex++;
+               }
             }
          }
-
-         // in case of moving to the same parent destination index is calculated above
-         if (srcChilds == destChilds)
-         {
-            destIndex = srcIndex;
-         }
       }
       else
       {
@@ -229,9 +225,9 @@
 
       String id = keepIdentifiers ? node.getIdentifier() : IdGenerator.generate();
 
-      QPath qpath = QPath.makeChildPath(parent.getQPath(), qname, destIndex);
+      QPath qpath = QPath.makeChildPath(destParent.getQPath(), qname, destIndex);
 
-      AccessControlList acl = parent.getACL();
+      AccessControlList acl = destParent.getACL();
 
       boolean isPrivilegeable =
          ntManager.isNodeType(Constants.EXO_PRIVILEGEABLE, node.getPrimaryTypeName(), node.getMixinTypeNames());
@@ -242,16 +238,16 @@
       if (isPrivilegeable || isOwneable)
       {
          List<AccessControlEntry> permissionEntries = new ArrayList<AccessControlEntry>();
-         permissionEntries.addAll((isPrivilegeable ? node.getACL() : parent.getACL()).getPermissionEntries());
+         permissionEntries.addAll((isPrivilegeable ? node.getACL() : destParent.getACL()).getPermissionEntries());
 
-         String owner = isOwneable ? node.getACL().getOwner() : parent.getACL().getOwner();
+         String owner = isOwneable ? node.getACL().getOwner() : destParent.getACL().getOwner();
 
          acl = new AccessControlList(owner, permissionEntries);
       }
 
       TransientNodeData newNode =
          new TransientNodeData(qpath, id, -1, node.getPrimaryTypeName(), node.getMixinTypeNames(), destOrderNum,
-            parent.getIdentifier(), acl);
+            destParent.getIdentifier(), acl);
 
       parents.push(newNode);
 

Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/AbstractSameNameSiblingsMoveTest.java (from rev 4639, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsMove.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/AbstractSameNameSiblingsMoveTest.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/AbstractSameNameSiblingsMoveTest.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -0,0 +1,453 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.api.writing;
+
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.version.VersionException;
+
+/**
+ * Created by The eXo Platform SAS.
+ * 
+ * Date: 31.03.2008
+ * 
+ * @author <a href="mailto:peter.nedonosko at exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id: TestSameNameSiblingsMove.java 12992 2008-04-09 14:52:34Z pnedonosko $
+ */
+public abstract class AbstractSameNameSiblingsMoveTest extends JcrAPIBaseTest
+{
+
+   private Node testRoot;
+
+   /**
+    * Abstract SNS move test
+    * 
+    * @param srcAbsPath
+    * @param destAbsPath
+    */
+   abstract void move(Node testRoot, String srcAbsPath, String destAbsPath) throws ItemExistsException,
+      PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException;
+
+   @Override
+   public void setUp() throws Exception
+   {
+      super.setUp();
+
+      testRoot = root.addNode("snsMoveTest");
+      root.save();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      root.refresh(false);
+      testRoot.remove();
+      root.save();
+
+      super.tearDown();
+   }
+
+   /**
+    * Move node[1] to node[3], node[3] reordered to node[2], node[2] to node[1].
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveSameParentSameNameFirst() throws LoginException, NoSuchWorkspaceException, RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+      testRootS1.addMixin("exo:owneable");
+      testRootS1.addMixin("exo:privilegeable");
+      testRootS1.save();
+
+      Node nS1_1 = testRootS1.addNode("node"); // node[1]
+      testRootS1.save();
+      nS1_1.addMixin("mix:referenceable");
+      nS1_1.addMixin("exo:owneable");
+      // nS1_1.setProperty("exo:owner", "root");
+      String s1_1_id = nS1_1.getUUID();
+      testRootS1.save();
+
+      Node nS1_2 = testRootS1.addNode("node"); // node[2]
+      Node nS1_3 = testRootS1.addNode("node"); // node[3]
+
+      testRootS1.save();
+
+      try
+      {
+         // move node[1] to node[3], node[3] reordered to node[2], node[2] to node[1]
+         move(testRootS1, testRootS1.getPath() + "/node", testRootS1.getPath() + "/node");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      int index = 0;
+      for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();)
+      {
+         index++;
+         Node n = iter.nextNode();
+         // log.info("Node: " + n.getPath());
+         assertEquals("Wrong index found ", index, n.getIndex());
+      }
+
+      // check pool updated
+      assertEquals(1, nS1_2.getIndex());
+      assertEquals(2, nS1_3.getIndex());
+      assertEquals(3, nS1_1.getIndex());
+      // check reordering
+      assertEquals("Wrong node UUID found ", s1_1_id, testRootS1.getNode("node[3]").getUUID());
+   }
+
+   /**
+    * Move node[2] to node[3], node[3] reordered to node[2].
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveSameParentSameNameMiddle() throws LoginException, NoSuchWorkspaceException, RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+
+      Node nS1_1 = testRootS1.addNode("node"); // node[1]
+      testRootS1.save();
+      nS1_1.addMixin("mix:referenceable");
+      String s1_1_id = nS1_1.getUUID();
+      testRootS1.save();
+
+      Node nS1_2 = testRootS1.addNode("node"); // node[2]
+      Node nS1_3 = testRootS1.addNode("node"); // node[3]
+      testRootS1.save();
+
+      // test
+      try
+      {
+         // move node[2] to node[3], node[3] reordered to node[2]
+         move(testRootS1, testRootS1.getPath() + "/node[2]", testRootS1.getPath() + "/node");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      int index = 0;
+      for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();)
+      {
+         index++;
+         Node n = iter.nextNode();
+         // log.info("Node: " + n.getPath());
+         assertEquals("Wrong index found ", index, n.getIndex());
+      }
+
+      // check pool updated
+      assertEquals(1, nS1_1.getIndex());
+      assertEquals(2, nS1_3.getIndex());
+      assertEquals(3, nS1_2.getIndex());
+
+      // check reordering
+      assertEquals("Wrong node UUID found ", s1_1_id, testRootS1.getNode("node").getUUID());
+   }
+
+   /**
+    * Move SNS node to itself, move node[3] to node[3].
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveSameParentSameNameLast() throws LoginException, NoSuchWorkspaceException, RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+
+      Node nS1_1 = testRootS1.addNode("node"); // node[1]
+      testRootS1.save();
+      nS1_1.addMixin("mix:referenceable");
+      String s1_1_id = nS1_1.getUUID();
+      testRootS1.save();
+
+      Node nS1_2 = testRootS1.addNode("node"); // node[2]
+      Node nS1_3 = testRootS1.addNode("node"); // node[3]
+      testRootS1.save();
+
+      // test
+      try
+      {
+         // move to itself, move node[3] to node[3]
+         move(testRootS1, testRootS1.getPath() + "/node[3]", testRootS1.getPath() + "/node");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      int index = 0;
+      for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();)
+      {
+         index++;
+         Node n = iter.nextNode();
+         // log.info("Node: " + n.getPath());
+         assertEquals("Wrong index found ", index, n.getIndex());
+      }
+
+      // check pool updated
+      assertEquals(1, nS1_1.getIndex());
+      assertEquals(2, nS1_2.getIndex());
+      assertEquals(3, nS1_3.getIndex());
+
+      // check reordering
+      assertEquals("Wrong node UUID found ", s1_1_id, testRootS1.getNode("node").getUUID());
+   }
+
+   /**
+    * Move node[1] to node-new[1], node[1,3] reordered to node[1,2].
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveSameParentDifferentName() throws LoginException, NoSuchWorkspaceException, RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+
+      Node nS1_1 = testRootS1.addNode("node"); // node[1]
+      testRootS1.save();
+
+      Node nS1_2 = testRootS1.addNode("node"); // node[2]
+      Node nS1_3 = testRootS1.addNode("node"); // node[3]
+      testRootS1.save();
+
+      // test
+      try
+      {
+         // move node[2] to node[3], node[3] reordered to node[2]
+         move(testRootS1, testRootS1.getPath() + "/node[1]", testRootS1.getPath() + "/node-new");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      // check pool updated
+      assertEquals(1, nS1_2.getIndex());
+      assertEquals(2, nS1_3.getIndex());
+
+      assertEquals(2, testRootS1.getNodes("node").getSize());
+   }
+
+   /**
+    * Move node[1] to node-existing[2], node[1,3] reordered to node[1,2].
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveSameParentDifferentExistingName() throws LoginException, NoSuchWorkspaceException,
+      RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+
+      Node nS1_1 = testRootS1.addNode("node"); // node[1]
+      testRootS1.save();
+
+      Node nS1_2 = testRootS1.addNode("node"); // node[2]
+      Node nS1_3 = testRootS1.addNode("node"); // node[3]
+
+      Node nExisting = testRootS1.addNode("node-existing"); // node-existing
+      testRootS1.save();
+
+      // test
+      try
+      {
+         // move node[2] to node[3], node[3] reordered to node[2]
+         move(testRootS1, testRootS1.getPath() + "/node[1]", testRootS1.getPath() + "/node-existing");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      // check pool updated
+      assertEquals(1, nS1_2.getIndex());
+      assertEquals(2, nS1_3.getIndex());
+
+      assertEquals(1, nExisting.getIndex());
+      assertEquals(2, nS1_1.getIndex());
+
+      assertEquals(2, testRootS1.getNodes("node").getSize());
+      assertEquals(2, testRootS1.getNodes("node-existing").getSize());
+   }
+
+   /**
+    * Move SNS node to different location with SNS too, move /snsMoveTest/node1/node[2] to /snsMoveTest/node2/node[3].
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveAnotherParentSameExsintingName() throws LoginException, NoSuchWorkspaceException,
+      RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+      final Node testNode1 = testRootS1.addNode("node1");
+      final Node testNode2 = testRootS1.addNode("node1");
+      testRootS1.save();
+
+      Node n1_1 = testNode1.addNode("node"); // node[1]
+      Node n1_2 = testNode1.addNode("node"); // node[2]
+      testNode1.save();
+      n1_2.addMixin("mix:referenceable");
+      String n1_2_id = n1_2.getUUID();
+      testNode1.save();
+
+      Node n1_3 = testNode1.addNode("node"); // node[3]
+      Node n1_4 = testNode1.addNode("node"); // node[4]
+      testNode1.save();
+
+      Node n2_1 = testNode2.addNode("node"); // node[1]
+      Node n2_2 = testNode2.addNode("node"); // node[2]
+      testNode2.save();
+
+      // test
+      try
+      {
+         // move /snsMoveTest/node1/node[2] to /snsMoveTest/node2/node[3]
+         move(testNode1, testNode1.getPath() + "/node[2]", testNode2.getPath() + "/node");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      int index = 0;
+      for (NodeIterator iter = testNode1.getNodes(); iter.hasNext();)
+      {
+         index++;
+         Node n = iter.nextNode();
+         assertEquals("Wrong index found ", index, n.getIndex());
+      }
+
+      index = 0;
+      for (NodeIterator iter = testNode2.getNodes(); iter.hasNext();)
+      {
+         index++;
+         Node n = iter.nextNode();
+         assertEquals("Wrong index found ", index, n.getIndex());
+      }
+
+      // check pool updated
+      assertEquals(1, n1_1.getIndex());
+      assertEquals(2, n1_3.getIndex());
+
+      assertEquals(1, n2_1.getIndex());
+      assertEquals(2, n2_2.getIndex());
+      assertEquals(3, n1_2.getIndex());
+
+      // check reordering
+      assertEquals("Wrong node UUID found ", n1_2_id, testNode2.getNode("node[3]").getUUID());
+   }
+
+   /**
+    * Move SNS node to different location with SNS too, move /snsMoveTest/node1/node[2] to /snsMoveTest/node2/node-new.
+    * 
+    * @throws LoginException
+    * @throws NoSuchWorkspaceException
+    * @throws RepositoryException
+    */
+   public void testMoveAnotherParentDifferentName() throws LoginException, NoSuchWorkspaceException,
+      RepositoryException
+   {
+
+      final Node testRootS1 = testRoot;
+      final Node testNode1 = testRootS1.addNode("node1");
+      final Node testNode2 = testRootS1.addNode("node1");
+      testRootS1.save();
+
+      Node n1_1 = testNode1.addNode("node"); // node[1]
+      Node n1_2 = testNode1.addNode("node"); // node[2]
+      testNode1.save();
+      n1_2.addMixin("mix:referenceable");
+      String n1_2_id = n1_2.getUUID();
+      testNode1.save();
+
+      Node n1_3 = testNode1.addNode("node"); // node[3]
+      Node n1_4 = testNode1.addNode("node"); // node[4]
+      testNode1.save();
+
+      Node n2_1 = testNode2.addNode("node"); // node[1]
+      Node n2_2 = testNode2.addNode("node"); // node[2]
+      testNode2.save();
+
+      // test
+      try
+      {
+         // move /snsMoveTest/node1/node[2] to /snsMoveTest/node2/node-new
+         move(testNode1, testNode1.getPath() + "/node[2]", testNode2.getPath() + "/node-new");
+      }
+      catch (RepositoryException e)
+      {
+         e.printStackTrace();
+         fail("RepositoryException should not have been thrown, but " + e);
+      }
+
+      int index = 0;
+      for (NodeIterator iter = testNode1.getNodes(); iter.hasNext();)
+      {
+         index++;
+         Node n = iter.nextNode();
+         assertEquals("Wrong index found ", index, n.getIndex());
+      }
+
+      assertEquals(3, testNode1.getNodes("node").getSize());
+      assertEquals(2, testNode2.getNodes("node").getSize());
+
+      // check pool updated
+      assertEquals(1, n1_1.getIndex());
+      assertEquals(2, n1_3.getIndex());
+
+      assertEquals(1, n2_1.getIndex());
+      assertEquals(2, n2_2.getIndex());
+
+      // check reordering
+      assertEquals("Wrong node UUID found ", n1_2_id, testNode2.getNode("node-new").getUUID());
+   }
+}

Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsMove.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsMove.java	2011-07-20 09:57:28 UTC (rev 4669)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsMove.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.api.writing;
-
-import org.exoplatform.services.jcr.JcrAPIBaseTest;
-
-import javax.jcr.LoginException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-
-/**
- * Created by The eXo Platform SAS.
- * 
- * Date: 31.03.2008
- * 
- * @author <a href="mailto:peter.nedonosko at exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id: TestSameNameSiblingsMove.java 12992 2008-04-09 14:52:34Z pnedonosko $
- */
-public class TestSameNameSiblingsMove extends JcrAPIBaseTest
-{
-
-   private Node testRoot;
-
-   @Override
-   public void setUp() throws Exception
-   {
-      super.setUp();
-
-      testRoot = root.addNode("snsMoveTest");
-      root.save();
-   }
-
-   @Override
-   protected void tearDown() throws Exception
-   {
-      root.refresh(false);
-      testRoot.remove();
-      root.save();
-
-      super.tearDown();
-   }
-
-   /**
-    * Move node[1] to node[3], node[3] reordered to node[2], node[2] to node[1].
-    * 
-    * @throws LoginException
-    * @throws NoSuchWorkspaceException
-    * @throws RepositoryException
-    */
-   public void testMoveFirst() throws LoginException, NoSuchWorkspaceException, RepositoryException
-   {
-
-      final Node testRootS1 = testRoot;
-      testRootS1.addMixin("exo:owneable");
-      testRootS1.addMixin("exo:privilegeable");
-      testRootS1.save();
-
-      Node nS1_1 = testRootS1.addNode("node"); // node[1]
-      testRootS1.save();
-      nS1_1.addMixin("mix:referenceable");
-      nS1_1.addMixin("exo:owneable");
-      // nS1_1.setProperty("exo:owner", "root");
-      String s1_1_id = nS1_1.getUUID();
-      testRootS1.save();
-
-      Node nS1_2 = testRootS1.addNode("node"); // node[2]
-      Node nS1_3 = testRootS1.addNode("node"); // node[3]
-
-      testRootS1.save();
-
-      // test
-      // for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();) {
-      // Node n = iter.nextNode();
-      // log.info("Node: " + n.getPath() + " " + ((NodeImpl)n).getInternalIdentifier());
-      // }
-      try
-      {
-         // move node[1] to node[3], node[3] reordered to node[2], node[2] to node[1]
-         testRootS1.getSession().move(testRootS1.getPath() + "/node", testRootS1.getPath() + "/node");
-         // for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();) {
-         // Node n = iter.nextNode();
-         // log.info("Node: " + n.getPath() + " " + ((NodeImpl)n).getInternalIdentifier());
-         // }
-         testRootS1.save(); // save
-
-      }
-      catch (RepositoryException e)
-      {
-         e.printStackTrace();
-         fail("RepositoryException should not have been thrown, but " + e);
-      }
-
-      int index = 0;
-      for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();)
-      {
-         index++;
-         Node n = iter.nextNode();
-         // log.info("Node: " + n.getPath());
-         assertEquals("Wrong index found ", index, n.getIndex());
-      }
-
-      // check reordering
-      assertEquals("Wrong node UUID found ", s1_1_id, testRootS1.getNode("node[3]").getUUID());
-   }
-
-   /**
-    * Move node[2] to node[3], node[3] reordered to node[2].
-    * 
-    * @throws LoginException
-    * @throws NoSuchWorkspaceException
-    * @throws RepositoryException
-    */
-   public void testMoveMiddle() throws LoginException, NoSuchWorkspaceException, RepositoryException
-   {
-
-      final Node testRootS1 = testRoot;
-
-      Node nS1_1 = testRootS1.addNode("node"); // node[1]
-      testRootS1.save();
-      nS1_1.addMixin("mix:referenceable");
-      String s1_1_id = nS1_1.getUUID();
-      testRootS1.save();
-
-      Node nS1_2 = testRootS1.addNode("node"); // node[2]
-      Node nS1_3 = testRootS1.addNode("node"); // node[3]
-      testRootS1.save();
-
-      // test
-      try
-      {
-         // move node[2] to node[3], node[3] reordered to node[2]
-         testRootS1.getSession().move(testRootS1.getPath() + "/node[2]", testRootS1.getPath() + "/node");
-         testRootS1.save(); // save
-      }
-      catch (RepositoryException e)
-      {
-         e.printStackTrace();
-         fail("RepositoryException should not have been thrown, but " + e);
-      }
-
-      int index = 0;
-      for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();)
-      {
-         index++;
-         Node n = iter.nextNode();
-         // log.info("Node: " + n.getPath());
-         assertEquals("Wrong index found ", index, n.getIndex());
-      }
-
-      // check reordering
-      assertEquals("Wrong node UUID found ", s1_1_id, testRootS1.getNode("node").getUUID());
-   }
-
-   /**
-    * Move SNS node to itself, move node[3] to node[3].
-    * 
-    * @throws LoginException
-    * @throws NoSuchWorkspaceException
-    * @throws RepositoryException
-    */
-   public void testMoveLast() throws LoginException, NoSuchWorkspaceException, RepositoryException
-   {
-
-      final Node testRootS1 = testRoot;
-
-      Node nS1_1 = testRootS1.addNode("node"); // node[1]
-      testRootS1.save();
-      nS1_1.addMixin("mix:referenceable");
-      String s1_1_id = nS1_1.getUUID();
-      testRootS1.save();
-
-      Node nS1_2 = testRootS1.addNode("node"); // node[2]
-      Node nS1_3 = testRootS1.addNode("node"); // node[3]
-      testRootS1.save();
-
-      // test
-      try
-      {
-         // move to itself, move node[3] to node[3]
-         testRootS1.getSession().move(testRootS1.getPath() + "/node[3]", testRootS1.getPath() + "/node");
-         testRootS1.save(); // save
-      }
-      catch (RepositoryException e)
-      {
-         e.printStackTrace();
-         fail("RepositoryException should not have been thrown, but " + e);
-      }
-
-      int index = 0;
-      for (NodeIterator iter = testRootS1.getNodes(); iter.hasNext();)
-      {
-         index++;
-         Node n = iter.nextNode();
-         // log.info("Node: " + n.getPath());
-         assertEquals("Wrong index found ", index, n.getIndex());
-      }
-
-      // check reordering
-      assertEquals("Wrong node UUID found ", s1_1_id, testRootS1.getNode("node").getUUID());
-   }
-
-   /**
-    * Move SNS node to different location with SNS too, move /snsMoveTest/node1/node[2] to /snsMoveTest/node2/node[3].
-    * 
-    * @throws LoginException
-    * @throws NoSuchWorkspaceException
-    * @throws RepositoryException
-    */
-   public void testMoveToDiffLocation() throws LoginException, NoSuchWorkspaceException, RepositoryException
-   {
-
-      final Node testRootS1 = testRoot;
-      final Node testNode1 = testRootS1.addNode("node1");
-      final Node testNode2 = testRootS1.addNode("node1");
-      testRootS1.save();
-
-      Node n1_1 = testNode1.addNode("node"); // node[1]
-      Node n1_2 = testNode1.addNode("node"); // node[2]
-      testNode1.save();
-      n1_2.addMixin("mix:referenceable");
-      String n1_2_id = n1_2.getUUID();
-      testNode1.save();
-
-      Node n1_3 = testNode1.addNode("node"); // node[3]
-      Node n1_4 = testNode1.addNode("node"); // node[4]
-      testNode1.save();
-
-      Node n2_1 = testNode2.addNode("node"); // node[1]
-      Node n2_2 = testNode2.addNode("node"); // node[2]
-      testNode2.save();
-
-      // test
-      try
-      {
-         // move /snsMoveTest/node1/node[2] to /snsMoveTest/node2/node[3]
-         testNode1.getSession().move(testNode1.getPath() + "/node[2]", testNode2.getPath() + "/node");
-         testNode1.getSession().save(); // save
-      }
-      catch (RepositoryException e)
-      {
-         e.printStackTrace();
-         fail("RepositoryException should not have been thrown, but " + e);
-      }
-
-      int index = 0;
-      for (NodeIterator iter = testNode1.getNodes(); iter.hasNext();)
-      {
-         index++;
-         Node n = iter.nextNode();
-         assertEquals("Wrong index found ", index, n.getIndex());
-      }
-
-      index = 0;
-      for (NodeIterator iter = testNode2.getNodes(); iter.hasNext();)
-      {
-         index++;
-         Node n = iter.nextNode();
-         assertEquals("Wrong index found ", index, n.getIndex());
-      }
-
-      // check reordering
-      assertEquals("Wrong node UUID found ", n1_2_id, testNode2.getNode("node[3]").getUUID());
-   }
-}

Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsSessionMove.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsSessionMove.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsSessionMove.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.api.writing;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.version.VersionException;
+
+/**
+ * @author <a href="mailto:nzamosenchuk at exoplatform.com">Nikolay Zamosenchul</a>
+ * @version $Id: TestSameNameSiblingsSessionMove 34360 2011-07-20 18:58:59Z nzamosenchuk $
+ *
+ */
+public class TestSameNameSiblingsSessionMove extends AbstractSameNameSiblingsMoveTest
+{
+
+   /**
+   * {@inheritDoc}
+   */
+   @Override
+   void move(Node testRoot, String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException,
+      VersionException, ConstraintViolationException, LockException, RepositoryException
+   {
+      testRoot.getSession().move(srcAbsPath, destAbsPath);
+      testRoot.getSession().save();
+   }
+
+}


Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsSessionMove.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsWorkspaceMove.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsWorkspaceMove.java	                        (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsWorkspaceMove.java	2011-07-21 09:39:19 UTC (rev 4670)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.api.writing;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.version.VersionException;
+
+/**
+ * @author <a href="mailto:nzamosenchuk at exoplatform.com">Nikolay Zamosenchul</a>
+ * @version $Id: TestSameNameSiblingsSessionMove 34360 2011-07-20 18:58:59Z nzamosenchuk $
+ *
+ */
+public class TestSameNameSiblingsWorkspaceMove extends AbstractSameNameSiblingsMoveTest
+{
+
+   /**
+   * {@inheritDoc}
+   */
+   @Override
+   void move(Node testRoot, String srcAbsPath, String destAbsPath) throws ItemExistsException, PathNotFoundException,
+      VersionException, ConstraintViolationException, LockException, RepositoryException
+   {
+      testRoot.getSession().getWorkspace().move(srcAbsPath, destAbsPath);
+   }
+
+}


Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/writing/TestSameNameSiblingsWorkspaceMove.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the exo-jcr-commits mailing list