jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r570180 - in /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test: ./ api/ api/lock/ api/query/
Date Mon, 27 Aug 2007 16:51:33 GMT
Author: reschke
Date: Mon Aug 27 09:51:32 2007
New Revision: 570180

URL: http://svn.apache.org/viewvc?rev=570180&view=rev
Log:
JCR-1091: add convenience method for checking whether a certain mixin is already present in
a node type, and use it throughout when adding mixins.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeAddMixinTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueValueFormatExceptionTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/SetValueLockExceptionTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLJoinTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
Mon Aug 27 09:51:32 2007
@@ -602,6 +602,13 @@
     }
 
     /**
+     * Checks whether the node already has the specified mixin node type
+     */
+    protected boolean needsMixin(Node node, String mixin) throws RepositoryException {
+        return ! node.getSession().getWorkspace().getNodeTypeManager().getNodeType(node.getPrimaryNodeType().getName()).isNodeType(mixin);
+    }
+
+    /**
      * Reverts any pending changes made by <code>s</code> and deletes any nodes
      * under {@link #testRoot}. If there is no node at {@link #testRoot} then
      * the necessary nodes are created.

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?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- 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
Mon Aug 27 09:51:32 2007
@@ -27,7 +27,6 @@
 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,12 +225,8 @@
 
         // get session an create default node
         Node node = testRootNode.addNode(nodeName1, testNodeType);
-
-        try {
+        if (needsMixin(node, mixReferenceable)) {
             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();

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
Mon Aug 27 09:51:32 2007
@@ -20,7 +20,6 @@
 import org.apache.jackrabbit.test.NotExecutableException;
 
 import javax.jcr.*;
-import javax.jcr.nodetype.ConstraintViolationException;
 
 /**
  * <code>ReferencesTest</code> contains the test cases for the references.
@@ -37,12 +36,9 @@
      */
     public void testReferences() throws RepositoryException, NotExecutableException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixReferenceable)) {
             n1.addMixin(mixReferenceable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be present in the node type
-        }
 
         // with some impls. the mixin type has only affect upon save
         testRootNode.save();
@@ -117,12 +113,9 @@
      */
     public void testReferenceTarget() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixReferenceable)) {
             n1.addMixin(mixReferenceable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be present in the node type
-        }
         
         // with some impls. the mixin type has only affect upon save
         testRootNode.save();
@@ -149,14 +142,12 @@
      */
     public void testAlterReference() throws RepositoryException, NotExecutableException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        Node n2 = testRootNode.addNode(nodeName2, testNodeType);
-
-        try {
+        if (needsMixin(n1, mixReferenceable)) {
             n1.addMixin(mixReferenceable);
-            n2.addMixin(mixReferenceable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be present in the node type
+        Node n2 = testRootNode.addNode(nodeName2, testNodeType);
+        if (needsMixin(n2, mixReferenceable)) {
+            n2.addMixin(mixReferenceable);
         }
 
         // with some impls. the mixin type has only affect upon save

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueValueFormatExceptionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueValueFormatExceptionTest.java?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueValueFormatExceptionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueValueFormatExceptionTest.java
Mon Aug 27 09:51:32 2007
@@ -26,7 +26,6 @@
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.ConstraintViolationException;
 
 import java.io.InputStream;
 import java.io.ByteArrayInputStream;
@@ -213,12 +212,8 @@
         Property booleanProperty = createProperty(PropertyType.BOOLEAN, false);
         try {
             Node referenceableNode = testRootNode.addNode(nodeName3, testNodeType);
-            
-            try {
+            if (needsMixin(referenceableNode, mixReferenceable)) {
                 referenceableNode.addMixin(mixReferenceable);
-            }
-            catch (ConstraintViolationException ex) {
-                // may already be present in the node type
             }
 
             // some implementations may require a save after addMixin()

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
Mon Aug 27 09:51:32 2007
@@ -23,7 +23,6 @@
 import javax.jcr.Session;
 import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.apache.jackrabbit.test.NotExecutableException;
@@ -50,12 +49,9 @@
     public void testAddRemoveLockToken() throws Exception {
         // create new node
         Node n = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n, mixLockable)) {
             n.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node and get lock token
@@ -111,12 +107,9 @@
     public void testNodeLocked() throws Exception {
         // create new node and lock it
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node
@@ -154,13 +147,12 @@
     public void testGetNode() throws Exception {
         // create new node with a sub node and lock it
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        Node n1Sub = n1.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
-            n1Sub.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
+        Node n1Sub = n1.addNode(nodeName1, testNodeType);
+        if (needsMixin(n1Sub, mixLockable)) {
+            n1Sub.addMixin(mixLockable);
         }
         testRootNode.save();
 
@@ -185,12 +177,9 @@
     public void testGetLockOwnerProperty() throws Exception {
         // create new node and lock it
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node
@@ -216,12 +205,9 @@
     public void testGetLockOwner() throws Exception {
         // create new node and lock it
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node
@@ -241,12 +227,9 @@
     public void testShallowLock() throws Exception {
         // create new nodes
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         Node n2 = n1.addNode(nodeName2, testNodeType);
         testRootNode.save();
 
@@ -269,12 +252,9 @@
 
         // create a node that is lockable and versionable
         Node node = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(node, mixLockable)) {
             node.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         // try to make it versionable if it is not
         if (!node.isNodeType(mixVersionable)) {
             if (node.canAddMixin(mixVersionable)) {
@@ -312,19 +292,13 @@
     public void testParentChildLock() throws Exception {
         // create new nodes
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         Node n2 = n1.addNode(nodeName2, testNodeType);
-        try {
+        if (needsMixin(n2, mixLockable)) {
             n2.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock parent node
@@ -346,19 +320,13 @@
     public void testParentChildDeepLock() throws Exception {
         // create new nodes
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         Node n2 = n1.addNode(nodeName2, testNodeType);
-        try {
+        if (needsMixin(n2, mixLockable)) {
             n2.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock child node
@@ -379,19 +347,13 @@
     public void testIsDeep() throws RepositoryException {
         // create two lockable nodes
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         Node n2 = testRootNode.addNode(nodeName2, testNodeType);
-        try {
+        if (needsMixin(n2, mixLockable)) {
             n2.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node 1 "undeeply"
@@ -413,19 +375,13 @@
     public void testIsSessionScoped() throws RepositoryException {
         // create two lockable nodes
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-          // may already be lockable, just proceed
-        }
         Node n2 = testRootNode.addNode(nodeName2, testNodeType);
-        try {
+        if (needsMixin(n2, mixLockable)) {
             n2.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-          // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node 1 session-scoped
@@ -449,12 +405,9 @@
     public void testLogout() throws Exception {
         // add node
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-          // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // create new session
@@ -492,12 +445,9 @@
     public void testLockTransfer() throws Exception {
         // add node
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // create new session
@@ -538,12 +488,9 @@
     public void testOpenScopedLocks() throws Exception {
         // add node
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // create new session
@@ -575,12 +522,9 @@
     public void testRefresh() throws Exception {
         // create new node
         Node n = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n, mixLockable)) {
             n.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node and get lock token
@@ -605,12 +549,9 @@
     public void testRefreshNotLive() throws Exception {
         // create new node
         Node n = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n, mixLockable)) {
             n.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock node and get lock token
@@ -640,19 +581,13 @@
     public void testGetLock() throws Exception {
         // create new nodes
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(n1, mixLockable)) {
             n1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         Node n2 = n1.addNode(nodeName2, testNodeType);
-        try {
+        if (needsMixin(n2, mixLockable)) {
             n2.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // deep lock parent node
@@ -675,12 +610,9 @@
 
         // set up versionable and lockable node
         Node testNode = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(testNode, mixLockable)) {
             testNode.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testNode.addMixin(mixVersionable);
         testRootNode.save();
 
@@ -757,19 +689,13 @@
 
         // create two nodes, parent and child
         Node testNode1 = testRootNode.addNode(nodeName1, testNodeType);
-        try {
+        if (needsMixin(testNode1, mixLockable)) {
             testNode1.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         Node testNode2 = testNode1.addNode(nodeName2, testNodeType);
-        try {
+        if (needsMixin(testNode2, mixLockable)) {
             testNode2.addMixin(mixLockable);
         }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         testRootNode.save();
 
         // lock child node
@@ -848,35 +774,26 @@
      */
     private Node setUpSameNameSiblings() throws RepositoryException, NotExecutableException
{
         // create three lockable nodes with same name
-        Node testNode = testRootNode.addNode(nodeName1, testNodeType);
-        try {
-            testNode.addMixin(mixLockable);
-        }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
         try {
-          testNode = testRootNode.addNode(nodeName1, testNodeType);
+            Node testNode = testRootNode.addNode(nodeName1, testNodeType);
+            if (needsMixin(testNode, mixLockable)) {
+                testNode.addMixin(mixLockable);
+            }
+            testNode = testRootNode.addNode(nodeName1, testNodeType);
+            if (needsMixin(testNode, mixLockable)) {
+                testNode.addMixin(mixLockable);
+            }
+            testNode = testRootNode.addNode(nodeName1, testNodeType);
+            if (needsMixin(testNode, mixLockable)) {
+                testNode.addMixin(mixLockable);
+            }
+            testRootNode.save();
+            return testNode;
         }
         catch (ItemExistsException ex) {
             // repository does not seem to support same name siblings on this node type
             throw new NotExecutableException("Node type " + testNodeType + " does not support
same-name-siblings");
         }
-        try {
-            testNode.addMixin(mixLockable);
-        }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
-        testNode = testRootNode.addNode(nodeName1, testNodeType);
-        try {
-            testNode.addMixin(mixLockable);
-        }
-        catch (ConstraintViolationException ex) {
-            // may already be lockable, just proceed
-        }
-        testRootNode.save();
-        return testNode;
     }
 }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/SetValueLockExceptionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/SetValueLockExceptionTest.java?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/SetValueLockExceptionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/SetValueLockExceptionTest.java
Mon Aug 27 09:51:32 2007
@@ -20,7 +20,6 @@
 import org.apache.jackrabbit.test.NotExecutableException;
 
 import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.Session;
 import javax.jcr.Node;
 import javax.jcr.Property;
@@ -89,11 +88,8 @@
         else {
             // add a lockable node
             testNode = testRootNode.addNode(nodeName1, testNodeType);
-            try {
+            if (needsMixin(testNode, mixLockable)) {
                 testNode.addMixin(mixLockable);
-            }
-            catch (ConstraintViolationException ex) {
-                // may already be lockable, just proceed
             }
 
             // add properties

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLJoinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLJoinTest.java?rev=570180&r1=570179&r2=570180&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLJoinTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLJoinTest.java
Mon Aug 27 09:51:32 2007
@@ -43,7 +43,9 @@
      */
     public void testJoin() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        n1.addMixin(mixReferenceable);
+        if (needsMixin(n1, mixReferenceable)) {
+            n1.addMixin(mixReferenceable);
+        }
         testRootNode.addNode(nodeName2, testNodeType);
         testRootNode.save();
 
@@ -64,7 +66,9 @@
      */
     public void testJoinNtBase() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        n1.addMixin(mixReferenceable);
+        if (needsMixin(n1, mixReferenceable)) {
+            n1.addMixin(mixReferenceable);
+        }
         testRootNode.addNode(nodeName2, testNodeType);
         testRootNode.save();
 
@@ -85,9 +89,13 @@
      */
     public void testJoinFilterPrimaryType() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        n1.addMixin(mixReferenceable);
+        if (needsMixin(n1, mixReferenceable)) {
+            n1.addMixin(mixReferenceable);
+        }
         Node n2 = testRootNode.addNode(nodeName2, ntBase);
-        n2.addMixin(mixReferenceable);
+        if (needsMixin(n2, mixReferenceable)) {
+            n2.addMixin(mixReferenceable);
+        }
         testRootNode.save();
 
         StringBuffer query = new StringBuffer("SELECT * FROM ");
@@ -112,7 +120,9 @@
      */
     public void testJoinSNS() throws RepositoryException, NotExecutableException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        n1.addMixin(mixReferenceable);
+        if (needsMixin(n1, mixReferenceable)) {
+            n1.addMixin(mixReferenceable);
+        }
         if (!n1.getDefinition().allowsSameNameSiblings()) {
             throw new NotExecutableException("Node at " + testRoot + " does not allow same
name siblings with name " + nodeName1);
         }



Mime
View raw message