jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1401591 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/test/resources/org/apache/jackrabbit/oak/jcr/
Date Wed, 24 Oct 2012 09:07:29 GMT
Author: mreutegg
Date: Wed Oct 24 09:07:28 2012
New Revision: 1401591

URL: http://svn.apache.org/viewvc?rev=1401591&view=rev
Log:
OAK-169: Support orderable nodes
- additional test
- TypeValidator must ignore hidden properties

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidator.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderableNodesTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/resources/org/apache/jackrabbit/oak/jcr/test_nodetypes.cnd

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidator.java?rev=1401591&r1=1401590&r2=1401591&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/TypeValidator.java
Wed Oct 24 09:07:28 2012
@@ -38,6 +38,7 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
+import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -83,6 +84,9 @@ class TypeValidator implements Validator
 
     @Override
     public void propertyAdded(PropertyState after) throws CommitFailedException {
+        if (isHidden(after)) {
+            return;
+        }
         try {
             checkType(after);
             getParentType().checkSetProperty(after);
@@ -99,6 +103,9 @@ class TypeValidator implements Validator
 
     @Override
     public void propertyChanged(PropertyState before, PropertyState after) throws CommitFailedException
{
+        if (isHidden(after)) {
+            return;
+        }
         try {
             checkType(after);
             getParentType().checkSetProperty(after);
@@ -115,6 +122,9 @@ class TypeValidator implements Validator
 
     @Override
     public void propertyDeleted(PropertyState before) throws CommitFailedException {
+        if (isHidden(before)) {
+            return;
+        }
         try {
             getParentType().checkRemoveProperty(before);
         }
@@ -346,4 +356,7 @@ class TypeValidator implements Validator
 
     }
 
+    private boolean isHidden(PropertyState state) {
+        return NodeStateUtils.isHidden(state.getName());
+    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderableNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderableNodesTest.java?rev=1401591&r1=1401590&r2=1401591&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderableNodesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OrderableNodesTest.java
Wed Oct 24 09:07:28 2012
@@ -30,8 +30,19 @@ public class OrderableNodesTest extends 
 
     @Test
     public void testSimpleOrdering() throws RepositoryException {
+        doTest("nt:unstructured");
+    }
+
+    @Test
+    public void orderableFolder() throws Exception {
+        // check ordering with node type without a residual properties definition
+        new TestContentLoader().loadTestContent(getAdminSession());
+        doTest("test:orderableFolder");
+    }
+
+    private void doTest(String nodeType) throws RepositoryException {
         Session session = getAdminSession();
-        Node root = session.getRootNode().addNode("test");
+        Node root = session.getRootNode().addNode("test", nodeType);
 
         root.addNode("a");
         root.addNode("b");
@@ -60,6 +71,7 @@ public class OrderableNodesTest extends 
         assertEquals("c", iterator.nextNode().getName());
         assertEquals("a", iterator.nextNode().getName());
         assertFalse(iterator.hasNext());
-    }
 
+        session.save();
+    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/resources/org/apache/jackrabbit/oak/jcr/test_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/resources/org/apache/jackrabbit/oak/jcr/test_nodetypes.cnd?rev=1401591&r1=1401590&r2=1401591&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/resources/org/apache/jackrabbit/oak/jcr/test_nodetypes.cnd
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/resources/org/apache/jackrabbit/oak/jcr/test_nodetypes.cnd
Wed Oct 24 09:07:28 2012
@@ -89,3 +89,6 @@
   + test:ignoreOnParentVersion (nt:base) = nt:unstructured ignore
   + test:abortOnParentVersion (nt:base) = nt:unstructured abort
   + test:copyOnParentVersion (nt:base) = nt:unstructured
+
+[test:orderableFolder] > nt:folder orderable
+  + * (nt:base) = test:orderableFolder



Mime
View raw message