jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r800466 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
Date Mon, 03 Aug 2009 17:07:22 GMT
Author: jukka
Date: Mon Aug  3 17:07:22 2009
New Revision: 800466

URL: http://svn.apache.org/viewvc?rev=800466&view=rev
Log:
JCR-1972: Preserving UUID and document version history on repository migration

Added the Node.addNodeWithUuid() tests contributed by Paco Avila.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java?rev=800466&r1=800465&r2=800466&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NodeImplTest.java
Mon Aug  3 17:07:22 2009
@@ -22,9 +22,11 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jcr.ItemExistsException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.nodetype.NodeType;
 import javax.jcr.security.AccessControlManager;
 import javax.jcr.security.AccessControlPolicy;
 import javax.jcr.security.AccessControlPolicyIterator;
@@ -125,4 +127,30 @@
             changeReadPermission(principal, n, true);
         }
     }
-}
\ No newline at end of file
+
+    public void testAddNodeUuid() throws RepositoryException, NotExecutableException {
+        String uuid = "f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
+        Node n = testRootNode.addNode(nodeName1);
+        Node testNode = ((NodeImpl) n).addNodeWithUuid(nodeName2, uuid);
+        testNode.addMixin(NodeType.MIX_REFERENCEABLE);
+        testRootNode.getSession().save();
+        assertEquals(
+                "Node identifier should be: " + uuid,
+                uuid, testNode.getIdentifier());
+    }
+
+    public void testAddNodeUuidCollision() throws RepositoryException, NotExecutableException
{
+        String uuid = "f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
+        Node n = testRootNode.addNode(nodeName1);
+        Node testNode1 = ((NodeImpl) n).addNodeWithUuid(nodeName2, uuid);
+        testNode1.addMixin(NodeType.MIX_REFERENCEABLE);
+        testRootNode.getSession().save();
+
+        try {
+            ((NodeImpl) n).addNodeWithUuid(nodeName2, uuid);
+            fail("UUID collision not detected by addNodeWithUuid");
+        } catch (ItemExistsException e) {
+        }
+    }
+
+}



Mime
View raw message