You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2007/07/04 16:21:25 UTC
svn commit: r553217 - in
/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api:
NodeUUIDTest.java SessionUUIDTest.java TreeComparator.java
Author: mreutegg
Date: Wed Jul 4 07:21:23 2007
New Revision: 553217
URL: http://svn.apache.org/viewvc?view=rev&rev=553217
Log:
JCR-813: TCK: testSaveMovedRefNode
Modified:
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeUUIDTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SessionUUIDTest.java
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeUUIDTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeUUIDTest.java?view=diff&rev=553217&r1=553216&r2=553217
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeUUIDTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeUUIDTest.java Wed Jul 4 07:21:23 2007
@@ -23,6 +23,7 @@
import javax.jcr.Node;
import javax.jcr.Session;
import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.InvalidItemStateException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
/**
@@ -90,13 +91,15 @@
/**
* Moves a referencable node using {@link javax.jcr.Session#move(String,
- * String)} with one session and saves afterward changes made with a second
+ * String)} with one session and saves afterward changes made with a second
* session to the moved node using {@link Node#save()}.<br/> <br/>
* Procedure: <ul> <li>Creates node 1 and node 2 with session 1</li>
* <li>Gets reference to node 1 using session 2</li> <li>Session 1 moves
* node 1 under node 2, saves changes</li> <li>Session 2 modifes node 1,
- * saves</li> </ul> This should work since the modified node is identified
- * by its UUID, not by position in repository. <br><br>Prerequisites: <ul>
+ * saves</li> </ul> This should work (since the modified node is identified
+ * by its UUID, not by position in repository) or throw an
+ * <code>InvalidItemStateException</code> if 'move' is reported to the second
+ * session as a sequence of remove and add events. <br><br>Prerequisites: <ul>
* <li><code>javax.jcr.tck.NodeUUIDTest.nodetype2</code> must have the mixin
* type <code>mix:referenceable</code> assigned.</li>
* <li><code>javax.jcr.tck.NodeUUIDTest.testSaveMovedRefNode.propertyname1</code>
@@ -129,11 +132,15 @@
superuser.save();
// modify some prop of the moved node with session 2
- refTargetNodeSession2.setProperty(propertyName1, "test");
+ try {
+ refTargetNodeSession2.setProperty(propertyName1, "test");
- // save it
- refTargetNodeSession2.save();
- // ok, works as expected
+ // save it
+ refTargetNodeSession2.save();
+ // ok, works as expected
+ } catch (InvalidItemStateException e) {
+ // ok as well.
+ }
} finally {
testSession.logout();
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SessionUUIDTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SessionUUIDTest.java?view=diff&rev=553217&r1=553216&r2=553217
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SessionUUIDTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SessionUUIDTest.java Wed Jul 4 07:21:23 2007
@@ -23,6 +23,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.ReferentialIntegrityException;
import javax.jcr.Session;
+import javax.jcr.InvalidItemStateException;
/**
* <code>SessionUUIDTest</code> contains all tests for the {@link javax.jcr.Session}
@@ -100,7 +101,9 @@
* <li>Session 1 moves node 1 under node 2, saves changes</li>
* <li>Session 2 modifes node 1, saves</li>
* </ul>
- * This should work since the modified node is identified by its UUID, not by position in repository.
+ * This should work (since the modified node is identified by its UUID, not by position in repository)
+ * or throw an <code>InvalidItemStateException</code> if 'move' is reported
+ * to the second session as a sequence of remove and add events.
* <br><br>Prerequisites:
* <ul>
* <li><code>javax.jcr.tck.SessionUUIDTest.nodetype2</code> must have the mixin type <code>mix:referenceable</code> assigned.</li>
@@ -137,13 +140,15 @@
// make the move persistent with session 1
superuser.save();
- // modify some prop of the moved node with session 2
- refTargetNodeSession2.setProperty(propertyName1, "test");
-
- // save it
- testSession.save();
-
- // ok, works as expected
+ try {
+ // modify some prop of the moved node with session 2
+ refTargetNodeSession2.setProperty(propertyName1, "test");
+ // save it
+ testSession.save();
+ // ok, works as expected
+ } catch (InvalidItemStateException e) {
+ // ok as well.
+ }
} finally {
testSession.logout();
}
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java?view=diff&rev=553217&r1=553216&r2=553217
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/TreeComparator.java Wed Jul 4 07:21:23 2007
@@ -202,7 +202,9 @@
log.println("Cannot create node with mixin node type: " + e);
// if saving failed for a node, then remove it again (or else the next save will fail on it)
try {
- n.remove();
+ if (n != null) {
+ n.remove();
+ }
} catch (RepositoryException e1) {
log.println("Could not remove node: " + e);
}