jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r796876 - in /jackrabbit/trunk: jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/ jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/ jackrabbit...
Date Wed, 22 Jul 2009 20:55:26 GMT
Author: tripod
Date: Wed Jul 22 20:55:26 2009
New Revision: 796876

URL: http://svn.apache.org/viewvc?rev=796876&view=rev
Log:
JCR-2159: Several test cases fail when declaring nt:base / nt:hierarchy node types as 'abstract'

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
    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/SerializationTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/CanAddChildNodeCallWithNodeTypeTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AddEventListenerTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/ElementTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLJoinTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
Wed Jul 22 20:55:26 2009
@@ -24,6 +24,7 @@
 # global test configuration
 javax.jcr.tck.testroot=/testroot
 javax.jcr.tck.nodetype=nt:unstructured
+javax.jcr.tck.nodetypenochildren=nt:address
 javax.jcr.tck.nodename1=node1
 javax.jcr.tck.nodename2=node2
 javax.jcr.tck.nodename3=node3
@@ -154,7 +155,7 @@
 # nodetype that does not allow same name siblings
 javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype2=nt:folder
 # valid node type that can be added as child of nodetype2
-javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3=nt:hierarchyNode
+javax.jcr.tck.SessionTest.testMoveItemExistsException.nodetype3=nt:folder
 
 # Test class: SessionTest
 # Test method: testSaveContstraintViolationException
@@ -185,7 +186,7 @@
 # nodetype that has a mandatory child node definition
 javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype2=nt:file
 # nodetype of the  mandatory child
-javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype3=nt:base
+javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodetype3=nt:unstructured
 # name of the mandatory node
 javax.jcr.tck.NodeTest.testRemoveMandatoryNode.nodename3=jcr:content
 
@@ -219,7 +220,7 @@
 # nodetype that does not allow ordering of child nodes
 javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype2=nt:folder
 # valid node type that can be added as child of nodetype 2
-javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=nt:hierarchyNode
+javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=nt:folder
 
 # Test class: SetPropertyNodeTest
 # nodetype which is referenceable

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
Wed Jul 22 20:55:26 2009
@@ -31,7 +31,7 @@
  * @since 1.0
  */
 [nt:base]
-  // abstract (currently causes test-case failures, see JCR-2159)
+  abstract
   - jcr:primaryType (NAME) mandatory autocreated protected COMPUTE
   - jcr:mixinTypes (NAME) protected multiple COMPUTE
 
@@ -44,7 +44,7 @@
  * @since 1.0
  */
 [nt:hierarchyNode] > mix:created
-  // abstract (currently causes test-case failures, see JCR-2159)
+  abstract
 
 /**
  * Nodes of this node type may be used to represent files. This node type inherits

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=796876&r1=796875&r2=796876&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
Wed Jul 22 20:55:26 2009
@@ -169,6 +169,11 @@
     protected String ntBase;
 
     /**
+     * JCR Name nt:unstructured using the namespace resolver of the current session.
+     */
+    protected String ntUnstructured;
+
+    /**
      * JCR Name nt:version using the namespace resolver of the current session.
      */
     protected String ntVersion;
@@ -356,6 +361,7 @@
         jcrMergeFailed = superuser.getNamespacePrefix(NS_JCR_URI) + ":mergeFailed";
         jcrSystem = superuser.getNamespacePrefix(NS_JCR_URI) + ":system";
         ntBase = superuser.getNamespacePrefix(NS_NT_URI) + ":base";
+        ntUnstructured = superuser.getNamespacePrefix(NS_NT_URI) + ":unstructured";
         ntVersion = superuser.getNamespacePrefix(NS_NT_URI) + ":version";
         ntVersionHistory = superuser.getNamespacePrefix(NS_NT_URI) + ":versionHistory";
         ntVersionLabels = superuser.getNamespacePrefix(NS_NT_URI) + ":versionLabels";

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SerializationTest.java
Wed Jul 22 20:55:26 2009
@@ -452,7 +452,8 @@
             throws Exception {
 
         treeComparator.createExampleTree();
-        Node node = testRootNode.addNode("ntBase", ntBase);
+        String nodetype = testNodeTypeNoChildren == null ? ntBase : testNodeTypeNoChildren;
+        Node node = testRootNode.addNode("ntBase", nodetype);
         session.save();
 
         FileInputStream in = new FileInputStream(file);

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java
Wed Jul 22 20:55:26 2009
@@ -108,7 +108,8 @@
      */
     public void testCloneNodesConstraintViolationException() throws RepositoryException {
         // if parent node is nt:base then no sub nodes can be created
-        Node subNodesNotAllowedNode = testRootNodeW2.addNode(nodeName3, ntBase);
+        String nodetype = testNodeTypeNoChildren == null ? ntBase : testNodeTypeNoChildren;
+        Node subNodesNotAllowedNode = testRootNodeW2.addNode(nodeName3, nodetype);
         testRootNodeW2.save();
         try {
             String dstAbsPath = subNodesNotAllowedNode.getPath() + "/" + node2.getName();

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java
Wed Jul 22 20:55:26 2009
@@ -91,7 +91,8 @@
      */
     public void testCopyNodesConstraintViolationException() throws RepositoryException {
         // if parent node is nt:base then no sub nodes can be created
-        Node subNodesNotAllowedNode = testRootNodeW2.addNode(nodeName3, ntBase);
+        String nodetype = testNodeTypeNoChildren == null ? ntBase : testNodeTypeNoChildren;
+        Node subNodesNotAllowedNode = testRootNodeW2.addNode(nodeName3, nodetype);
         testRootNodeW2.save();
         try {
             String dstAbsPath = subNodesNotAllowedNode.getPath() + "/" + node2.getName();

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/CanAddChildNodeCallWithNodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/CanAddChildNodeCallWithNodeTypeTest.java?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/CanAddChildNodeCallWithNodeTypeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/CanAddChildNodeCallWithNodeTypeTest.java
Wed Jul 22 20:55:26 2009
@@ -16,15 +16,15 @@
  */
 package org.apache.jackrabbit.test.api.nodetype;
 
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.test.NotExecutableException;
-
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * Tests <code>NodeType.canAddChildNode(String childNodeName, String nodeTypeName)</code>
@@ -88,6 +88,10 @@
         NodeType nodeType = nodeDef.getDeclaringNodeType();
         String childNodeName = nodeDef.getName();
         String nodeTypeName = nodeDef.getRequiredPrimaryTypes()[0].getName();
+        if (nodeTypeName.equals(ntBase)) {
+            // nt:base is abstract and can never be added, upgrade for check below
+            nodeTypeName = ntUnstructured;
+        }
 
         assertTrue("NodeType.canAddChildNode(String childNodeName, String nodeTypeName) "
+
                 "must return true if childNodeName and nodeTypeName match the " +
@@ -221,6 +225,10 @@
         }
 
         String type = nodeDef.getRequiredPrimaryTypes()[0].getName();
+        if (type.equals(ntBase)) {
+            // nt:base is abstract and can never be added, upgrade for check below
+            type = ntUnstructured;
+        }
         NodeType nodeType = nodeDef.getDeclaringNodeType();
         String undefinedName = NodeTypeUtil.getUndefinedChildNodeName(nodeType);
 

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AddEventListenerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AddEventListenerTest.java?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AddEventListenerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AddEventListenerTest.java
Wed Jul 22 20:55:26 2009
@@ -161,7 +161,7 @@
         Session s = getHelper().getSuperuserSession();
         try {
             Node n = (Node) s.getItem(n1.getPath());
-            n.addNode(nodeName3, ntBase);
+            n.addNode(nodeName3, testNodeType);
             n = (Node) s.getItem(n2.getPath());
             n.addNode(nodeName3, nodetype2);
             n = (Node) s.getItem(testRoot);

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/ElementTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/ElementTest.java?rev=796876&r1=796875&r2=796876&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/ElementTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/ElementTest.java
Wed Jul 22 20:55:26 2009
@@ -41,13 +41,21 @@
  */
 public class ElementTest extends AbstractQueryTest {
 
+    private String simpleNodeType;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        simpleNodeType = testNodeTypeNoChildren == null ? ntBase : testNodeTypeNoChildren;
+    }
+
     /**
      * Tests the element test without arguments.
      * @throws NotExecutableException 
      */
     public void testElementTest() throws RepositoryException, NotExecutableException {
+
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        Node n2 = testRootNode.addNode(nodeName2, ntBase);
+        Node n2 = testRootNode.addNode(nodeName2, simpleNodeType);
         Node n3 = testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -61,7 +69,7 @@
      */
     public void testElementTestAnyNode() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        Node n2 = testRootNode.addNode(nodeName2, ntBase);
+        Node n2 = testRootNode.addNode(nodeName2, simpleNodeType);
         Node n3 = testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -76,7 +84,7 @@
      */
     public void testElementTestAnyNodeNtBase() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        Node n2 = testRootNode.addNode(nodeName2, ntBase);
+        Node n2 = testRootNode.addNode(nodeName2, simpleNodeType);
         Node n3 = testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -91,7 +99,7 @@
      */
     public void testElementTestAnyNodeSomeNT() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.addNode(nodeName2, ntBase);
+        testRootNode.addNode(nodeName2, simpleNodeType);
         Node n3 = testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -105,7 +113,7 @@
      */
     public void testElementTestNameTest() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.addNode(nodeName2, ntBase);
+        testRootNode.addNode(nodeName2, simpleNodeType);
         testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -120,7 +128,7 @@
      */
     public void testElementTestNameTestNtBase() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.addNode(nodeName2, ntBase);
+        testRootNode.addNode(nodeName2, simpleNodeType);
         testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -135,7 +143,7 @@
      */
     public void testElementTestNameTestSomeNT() throws RepositoryException, NotExecutableException
{
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.addNode(nodeName2, ntBase);
+        testRootNode.addNode(nodeName2, simpleNodeType);
         testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 
@@ -153,9 +161,9 @@
         if (!n1.getDefinition().allowsSameNameSiblings()) {
             throw new NotExecutableException("Node at " + testRoot + " does not allow same
name siblings with name " + nodeName1);
         }
-        testRootNode.addNode(nodeName1, ntBase);
+        testRootNode.addNode(nodeName1, simpleNodeType);
         Node n2 = testRootNode.addNode(nodeName1, testNodeType);
-        testRootNode.addNode(nodeName2, ntBase);
+        testRootNode.addNode(nodeName2, simpleNodeType);
         testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.save();
 

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=796876&r1=796875&r2=796876&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
Wed Jul 22 20:55:26 2009
@@ -110,7 +110,8 @@
             throws RepositoryException, NotExecutableException {
         Node n1 = testRootNode.addNode(nodeName1, testNodeType);
         ensureMixinType(n1, mixReferenceable);
-        Node n2 = testRootNode.addNode(nodeName2, ntBase);
+        String nodetype = testNodeTypeNoChildren == null ? ntBase : testNodeTypeNoChildren;
+        Node n2 = testRootNode.addNode(nodeName2, nodetype);
         ensureMixinType(n2, mixReferenceable);
         testRootNode.save();
 



Mime
View raw message