jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1488237 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ oak-jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/
Date Fri, 31 May 2013 14:07:53 GMT
Author: jukka
Date: Fri May 31 14:07:53 2013
New Revision: 1488237

URL: http://svn.apache.org/r1488237
Log:
OAK-826: NodeDefinition#getRequiredPrimaryTypes throws IllegalStateException

Fix also getRequiredPrimaryTypes

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java?rev=1488237&r1=1488236&r2=1488237&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/NodeDefinitionImpl.java
Fri May 31 14:07:53 2013
@@ -63,7 +63,10 @@ class NodeDefinitionImpl extends ItemDef
         }
 
         NodeType[] types = new NodeType[oakNames.length];
-        Tree root = definition.getParent().getParent();
+        Tree root = definition.getParent();
+        while (!JCR_NODE_TYPES.equals(root.getName())) {
+            root = root.getParent();
+        }
         for (int i = 0; i < oakNames.length; i++) {
             Tree type = root.getChild(oakNames[i]);
             checkState(type.exists());

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1488237&r1=1488236&r2=1488237&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Fri May 31 14:07:53 2013
@@ -306,8 +306,6 @@
 
       org.apache.jackrabbit.oak.jcr.security.user.MemberNodeImportTest <!-- OAK-414, OAK-482
-->
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportGroupIntoUsersTree
<!-- OAK-821 -->
-
-      org.apache.jackrabbit.oak.jcr.nodetype.NodeDefinitionTest <!-- OAK-826 -->
     </known.issues>
   </properties>
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1488237&r1=1488236&r2=1488237&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Fri May 31 14:07:53 2013
@@ -2161,6 +2161,7 @@ public class RepositoryTest extends Abst
         for (Node child : getChildNodes(node, "jcr:childNodeDefinition")) {
             NodeDefinition definition = child.getDefinition(); // OAK-829
             definition.getDefaultPrimaryType();                // OAK-826
+            definition.getRequiredPrimaryTypes();              // OAK-826
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionTest.java?rev=1488237&r1=1488236&r2=1488237&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeDefinitionTest.java
Fri May 31 14:07:53 2013
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.oak.jcr.nodetype;
 
-import java.util.ArrayList;
+import static com.google.common.collect.Sets.newHashSet;
+
 import java.util.Arrays;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import javax.jcr.Node;
@@ -30,12 +30,12 @@ import javax.jcr.nodetype.PropertyDefini
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore("OAK-826") // FIXME
 public class NodeDefinitionTest extends AbstractJCRTest {
 
+    private List<String> paths;
+
     @Override
     @Before
     public void setUp() throws Exception {
@@ -44,20 +44,20 @@ public class NodeDefinitionTest extends 
         testRootNode.addNode("a", JcrConstants.NT_UNSTRUCTURED);
         testRootNode.addNode("b", JcrConstants.NT_FOLDER);
         superuser.save();
+
+        paths = Arrays.asList(
+                "/",
+                "/jcr:system",
+                "/jcr:system/jcr:versionStorage",
+                "/jcr:system/jcr:nodeTypes",
+                "/jcr:system/rep:namespaces",
+                testRoot + "/a",
+                testRoot + "/b",
+                "/oak:index");
     }
 
     @Test
     public void testGetRequiredPrimaryTypes() throws RepositoryException {
-        List<String> paths = new ArrayList();
-        paths.add("/");
-        paths.add("/jcr:system");
-        paths.add("/jcr:system/jcr:versionStorage");
-        paths.add("/jcr:system/jcr:nodeTypes");
-        paths.add("/jcr:system/rep:namespaces");
-        paths.add(testRoot + "/a");
-        paths.add(testRoot + "/b");
-        paths.add("/oak:index");
-
         for (String path : paths) {
             Node n = superuser.getNode(path);
             NodeDefinition def = n.getDefinition();
@@ -67,16 +67,6 @@ public class NodeDefinitionTest extends 
 
     @Test
     public void testGetRequiredPrimaryTypes2() throws RepositoryException {
-        List<String> paths = new ArrayList();
-        paths.add("/");
-        paths.add("/jcr:system");
-        paths.add("/jcr:system/jcr:versionStorage");
-        paths.add("/jcr:system/jcr:nodeTypes");
-        paths.add("/jcr:system/rep:namespaces");
-        paths.add(testRoot + "/a");
-        paths.add(testRoot + "/b");
-        paths.add("/oak:index");
-
         for (String path : paths) {
             Node n = superuser.getNode(path);
             for (NodeDefinition nd : getAggregatedNodeDefinitions(n)) {
@@ -87,7 +77,7 @@ public class NodeDefinitionTest extends 
 
 
     private static NodeDefinition[] getAggregatedNodeDefinitions(Node node) throws RepositoryException
{
-        Set<NodeDefinition> cDefs = new HashSet();
+        Set<NodeDefinition> cDefs = newHashSet();
         NodeDefinition[] nd = node.getPrimaryNodeType().getChildNodeDefinitions();
         cDefs.addAll(Arrays.asList(nd));
         NodeType[] mixins = node.getMixinNodeTypes();
@@ -99,7 +89,7 @@ public class NodeDefinitionTest extends 
     }
 
     public static PropertyDefinition[] getAggregatedPropertyDefinitionss(Node node) throws
RepositoryException {
-        Set<PropertyDefinition> pDefs = new HashSet();
+        Set<PropertyDefinition> pDefs = newHashSet();
         PropertyDefinition pd[] = node.getPrimaryNodeType().getPropertyDefinitions();
         pDefs.addAll(Arrays.asList(pd));
         NodeType[] mixins = node.getMixinNodeTypes();



Mime
View raw message