jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1522532 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
Date Thu, 12 Sep 2013 11:26:44 GMT
Author: mduerig
Date: Thu Sep 12 11:26:44 2013
New Revision: 1522532

URL: http://svn.apache.org/r1522532
Log:
OAK-1013: Node.addNode(name) different behavior from JR if NodeType resolves to an abstract
test case

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java?rev=1522532&r1=1522531&r2=1522532&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
Thu Sep 12 11:26:44 2013
@@ -36,6 +36,10 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeDefinitionTemplate;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.NodeTypeTemplate;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
@@ -251,4 +255,27 @@ public class CompatibilityIssuesTest ext
         }
     }
 
+    @Test(expected = ConstraintViolationException.class)
+    public void addNodeTest() throws RepositoryException {
+        Session session = getAdminSession();
+
+        // node type with default child-node type of to nt:base
+        String ntName = "test";
+        NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
+        NodeTypeTemplate ntt = ntm.createNodeTypeTemplate();
+        ntt.setName(ntName);
+        NodeDefinitionTemplate child = ntm.createNodeDefinitionTemplate();
+        child.setName("*");
+        child.setDefaultPrimaryTypeName("nt:base");
+        child.setRequiredPrimaryTypeNames(new String[] {"nt:base"});
+        List<NodeDefinition> children = ntt.getNodeDefinitionTemplates();
+        children.add(child);
+        ntm.registerNodeType(ntt, true);
+
+        // try to create a node with the default nt:base
+        Node node = session.getRootNode().addNode("defaultNtBase", ntName);
+        node.addNode("throw");  // Throws ConstraintViolationException on Oak, works on Jackrabbit
2
+        session.save();
+    }
+
 }



Mime
View raw message