jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1547424 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
Date Tue, 03 Dec 2013 15:13:13 GMT
Author: tripod
Date: Tue Dec  3 15:13:13 2013
New Revision: 1547424

URL: http://svn.apache.org/r1547424
Log:
OAK-1257 Adding a new reference to an existing MV property deletes the back references of
the old ones

- adding test case

Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1547424&r1=1547423&r2=1547424&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Tue Dec  3 15:13:13 2013
@@ -51,6 +51,7 @@
       org.apache.jackrabbit.test.api.WorkspaceMoveTest#testMoveNodesLocked              
              <!-- OAK-118 -->
 
       org.apache.jackrabbit.oak.jcr.ReferencesTest#testWeakReferencesAddLater <!-- OAK-1242
-->
+      org.apache.jackrabbit.oak.jcr.ReferencesTest#testMVReferencesAltering <!-- OAK-1257
-->
 
       <!-- Locking : not fully implemented -->
       org.apache.jackrabbit.test.api.lock.LockTest#testNodeLocked

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java?rev=1547424&r1=1547423&r2=1547424&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ReferencesTest.java
Tue Dec  3 15:13:13 2013
@@ -245,6 +245,45 @@ public class ReferencesTest extends Abst
         checkReferences("refs", ref1.getReferences(), n.getPath() + "/myref");
     }
 
+    // OAK-1257
+    public void testMVReferencesAltering() throws RepositoryException {
+        Node ref0 = testRootNode.addNode(nodeName2, testNodeType);
+        ref0.addMixin(mixReferenceable);
+        Node ref1 = testRootNode.addNode(nodeName3, testNodeType);
+        ref1.addMixin(mixReferenceable);
+        Node ref2 = testRootNode.addNode(nodeName4, testNodeType);
+        ref2.addMixin(mixReferenceable);
+        superuser.save();
+
+        Node n = testRootNode.addNode(nodeName1, testNodeType);
+        Value[] vs = new Value[]{
+                superuser.getValueFactory().createValue(ref0),
+                superuser.getValueFactory().createValue(ref1)
+        };
+        n.setProperty("myref", vs);
+        superuser.save();
+
+        assertEquals("ref0", ref0.getIdentifier(), n.getProperty("myref").getValues()[0].getString());
+        assertEquals("ref1", ref1.getIdentifier(), n.getProperty("myref").getValues()[1].getString());
+        checkReferences("refs", ref0.getReferences(), n.getPath() + "/myref");
+        checkReferences("refs", ref1.getReferences(), n.getPath() + "/myref");
+
+        vs = new Value[]{
+                superuser.getValueFactory().createValue(ref0),
+                superuser.getValueFactory().createValue(ref1),
+                superuser.getValueFactory().createValue(ref2)
+        };
+        n.setProperty("myref", vs);
+        superuser.save();
+
+        assertEquals("ref0", ref0.getIdentifier(), n.getProperty("myref").getValues()[0].getString());
+        assertEquals("ref1", ref1.getIdentifier(), n.getProperty("myref").getValues()[1].getString());
+        assertEquals("ref2", ref2.getIdentifier(), n.getProperty("myref").getValues()[2].getString());
+        checkReferences("refs", ref0.getReferences(), n.getPath() + "/myref");
+        checkReferences("refs", ref1.getReferences(), n.getPath() + "/myref");
+        checkReferences("refs", ref2.getReferences(), n.getPath() + "/myref");
+    }
+
     public void testVersionReferencesVH() throws RepositoryException {
         Node n = testRootNode.addNode(nodeName1, testNodeType);
         n.addMixin(mixVersionable);



Mime
View raw message