You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2007/04/20 15:53:02 UTC
svn commit: r530810 -
/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java
Author: reschke
Date: Fri Apr 20 06:53:01 2007
New Revision: 530810
URL: http://svn.apache.org/viewvc?view=rev&rev=530810
Log:
JCR-856: catch ConstraintViolationException upon addMixin(); check for success after save()
Modified:
jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java
Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java?view=diff&rev=530810&r1=530809&r2=530810
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java Fri Apr 20 06:53:01 2007
@@ -27,6 +27,7 @@
import javax.jcr.Value;
import javax.jcr.Repository;
import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -226,9 +227,17 @@
// get session an create default node
Node node = testRootNode.addNode(nodeName1, testNodeType);
- node.addMixin(mixReferenceable);
+ try {
+ node.addMixin(mixReferenceable);
+ }
+ catch (ConstraintViolationException ex) {
+ // can occur if the node type already inherits mix:referenceable
+ }
// implementation specific: mixin may take effect only upon save
testRootNode.save();
+
+ // check that it did
+ assertTrue(node.isNodeType(mixReferenceable));
// test if jcr:uuid is not null, empty or throws a exception
// (format of value is not defined so we can only test if not empty)