jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r575319 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetReferencesNodeTest.java
Date Thu, 13 Sep 2007 14:09:58 GMT
Author: reschke
Date: Thu Sep 13 07:09:57 2007
New Revision: 575319

URL: http://svn.apache.org/viewvc?rev=575319&view=rev
Log:
JCR-1110: do not require a primary node type that includes mix:versionable (add the mixin
when needed), fail with NotExecutableException when reference properties are not supported

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetReferencesNodeTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetReferencesNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetReferencesNodeTest.java?rev=575319&r1=575318&r2=575319&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetReferencesNodeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetReferencesNodeTest.java
Thu Sep 13 07:09:57 2007
@@ -18,11 +18,11 @@
 
 import javax.jcr.Node;
 import javax.jcr.PropertyIterator;
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * <code>GetReferencesNodeTest</code> contains test to check if references are
@@ -51,18 +51,10 @@
     protected void setUp() throws Exception {
         super.setUp();
 
-        NodeTypeManager ntm = superuser.getWorkspace().getNodeTypeManager();
-
         versionableNodeType = getProperty(PROP_VERSIONABLE_NODE_TYPE);
         if (versionableNodeType == null) {
             fail("Property '" + PROP_VERSIONABLE_NODE_TYPE + "' is not defined.");
         }
-
-        // check if node type is versionable
-        NodeType vNt = ntm.getNodeType(versionableNodeType);
-        if (!vNt.isNodeType(mixVersionable)) {
-            fail("Property '" + PROP_VERSIONABLE_NODE_TYPE + "' does not define a versionable
nodetype.");
-        }
     }
 
     /**
@@ -71,12 +63,13 @@
      * 3. Create a new version 1.1 after changing reference 4. Check if
      * reference is found by getReferences()
      */
-    public void testGetReferencesNeverFromVersions() throws RepositoryException {
+    public void testGetReferencesNeverFromVersions() throws RepositoryException, NotExecutableException
{
         // create some test nodes
         initTestNodes();
 
         // create a version 1.0 and reference test node
         testNode.checkout();
+        ensureCanSetProperty(testNode, propertyName1, PropertyType.REFERENCE, false);
         testNode.setProperty(propertyName1, nodeToBeReferenced);
 
         testRootNode.save();
@@ -103,6 +96,9 @@
     private void initTestNodes() throws RepositoryException {
         // create a versionable node with reference property
         testNode = testRootNode.addNode(nodeName1, versionableNodeType);
+        if (needsMixin(testNode, mixVersionable)) {
+          testNode.addMixin(mixVersionable);
+        }
 
         // node to be referenced, does not have to be versionable
         nodeToBeReferenced = testRootNode.addNode(nodeName2, versionableNodeType);



Mime
View raw message