jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1378903 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/index/TraversingCursor.java test/resources/org/apache/jackrabbit/oak/query/sql2.txt
Date Thu, 30 Aug 2012 12:17:51 GMT
Author: thomasm
Date: Thu Aug 30 12:17:50 2012
New Revision: 1378903

URL: http://svn.apache.org/viewvc?rev=1378903&view=rev
Log:
OAK-237 Run Jackrabbit query tests - exclude hidden nodes (*/:data) from results

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/TraversingCursor.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/TraversingCursor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/TraversingCursor.java?rev=1378903&r1=1378902&r2=1378903&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/TraversingCursor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/TraversingCursor.java
Thu Aug 30 12:17:50 2012
@@ -20,9 +20,11 @@ import org.apache.jackrabbit.oak.commons
 import org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.Cursor;
 import org.apache.jackrabbit.oak.spi.Filter;
+import org.apache.jackrabbit.oak.spi.Filter.PathRestriction;
 import org.apache.jackrabbit.oak.spi.IndexRow;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
 import com.google.common.collect.Iterators;
 import com.google.common.collect.Queues;
 
@@ -33,7 +35,7 @@ public class TraversingCursor implements
 
     private final Filter filter;
 
-    private final Deque<Iterator<? extends ChildNodeEntry>> nodes =
+    private final Deque<Iterator<? extends ChildNodeEntry>> nodeIterators =
             Queues.newArrayDeque();
 
     private String parentPath;
@@ -62,25 +64,27 @@ public class TraversingCursor implements
                 }
             }
         }
-
-        switch (filter.getPathRestriction()) {
+        PathRestriction restriciton = filter.getPathRestriction();
+        switch (restriciton) {
         case EXACT:
         case ALL_CHILDREN:
-            nodes.add(Iterators.singletonIterator(
+            nodeIterators.add(Iterators.singletonIterator(
                     new MemoryChildNodeEntry(currentPath, node)));
             parentPath = "";
             break;
         case PARENT:
             if (parent != null) {
-                nodes.add(Iterators.singletonIterator(
+                nodeIterators.add(Iterators.singletonIterator(
                         new MemoryChildNodeEntry(parentPath, parent)));
                 parentPath = "";
             }
             break;
         case DIRECT_CHILDREN:
-            nodes.add(node.getChildNodeEntries().iterator());
+            nodeIterators.add(node.getChildNodeEntries().iterator());
             parentPath = currentPath;
             break;
+        default:
+            throw new IllegalArgumentException("Unknown restriction: " + restriciton);
         }
     }
 
@@ -91,22 +95,25 @@ public class TraversingCursor implements
 
     @Override
     public boolean next() {
-        while (!nodes.isEmpty()) {
-            Iterator<? extends ChildNodeEntry> iterator = nodes.getLast();
+        while (!nodeIterators.isEmpty()) {
+            Iterator<? extends ChildNodeEntry> iterator = nodeIterators.getLast();
             if (iterator.hasNext()) {
                 ChildNodeEntry entry = iterator.next();
                 NodeState node = entry.getNodeState();
 
                 String name = entry.getName();
+                if (NodeStateUtils.isHidden(name)) {
+                    continue;
+                }
                 currentPath = PathUtils.concat(parentPath, name);
 
                 if (filter.getPathRestriction() == ALL_CHILDREN) {
-                    nodes.addLast(node.getChildNodeEntries().iterator());
+                    nodeIterators.addLast(node.getChildNodeEntries().iterator());
                     parentPath = currentPath;
                 }
                 return true;
             } else {
-                nodes.removeLast();
+                nodeIterators.removeLast();
                 parentPath = PathUtils.getParentPath(parentPath);
             }
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt?rev=1378903&r1=1378902&r2=1378903&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
Thu Aug 30 12:17:50 2012
@@ -116,7 +116,6 @@ select * from [nt:base] as x where isdes
 /jcr:system/rep:privileges
 /oak-index
 /oak-index/indexes
-/oak-index/indexes/:data
 /test
 /test/jcr:resource
 /test/resource
@@ -198,7 +197,6 @@ select * from [nt:base]
 /jcr:system/rep:privileges
 /oak-index
 /oak-index/indexes
-/oak-index/indexes/:data
 /test
 /test/hello
 /test/world
@@ -223,7 +221,6 @@ select * from [nt:base] where not (id = 
 /jcr:system/rep:privileges
 /oak-index
 /oak-index/indexes
-/oak-index/indexes/:data
 /test
 /test/hello
 
@@ -236,7 +233,6 @@ select * from [nt:base] where x is null
 /jcr:system/rep:privileges
 /oak-index
 /oak-index/indexes
-/oak-index/indexes/:data
 /test
 
 commit / - "test"
@@ -257,7 +253,6 @@ null
 null
 null
 null
-null
 10 percent
 10%
 Hallo



Mime
View raw message