jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1324712 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingCursorTest.java
Date Wed, 11 Apr 2012 11:43:16 GMT
Author: thomasm
Date: Wed Apr 11 11:43:16 2012
New Revision: 1324712

URL: http://svn.apache.org/viewvc?rev=1324712&view=rev
Log:
OAK-28 Query implementation (redo changed from the previous commit)

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingCursorTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingCursorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingCursorTest.java?rev=1324712&r1=1324711&r2=1324712&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingCursorTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingCursorTest.java
Wed Apr 11 11:43:16 2012
@@ -20,7 +20,10 @@ package org.apache.jackrabbit.oak.query.
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.junit.Test;
@@ -47,23 +50,22 @@ public class TraversingCursorTest {
 
     private void traverse(TraversingIndex t) {
         String head = mk.getHeadRevision();
-        head = mk.commit("/",
-                "+ \"parents\": { \"p0\": {\"id\": \"0\"}, \"p1\": {\"id\": \"1\"}, \"p2\":
{\"id\": \"2\"}}",
-                head, "");
-        head = mk.commit("/",
-                "+ \"children\": { \"c1\": {\"p\": \"1\"}, \"c2\": {\"p\": \"1\"}, \"c3\":
{\"p\": \"2\"}, \"c4\": {\"p\": \"3\"}}",
-                head, "");
+        head = mk.commit("/", "+ \"parents\": { \"p0\": {\"id\": \"0\"}, \"p1\": {\"id\":
\"1\"}, \"p2\": {\"id\": \"2\"}}", head, "");
+        head = mk.commit("/", "+ \"children\": { \"c1\": {\"p\": \"1\"}, \"c2\": {\"p\":
\"1\"}, \"c3\": {\"p\": \"2\"}, \"c4\": {\"p\": \"3\"}}", head, "");
         Filter f = new Filter(null);
 
         f.setPath("/");
-        // also check the iteration order
-        String[] list = {"/", "/parents", "/parents/p0", "/parents/p1",  "/parents/p2",
-                "/children", "/children/c1", "/children/c2", "/children/c3", "/children/c4"};
+        List<String> paths = new ArrayList<String>();
         Cursor c = t.query(f, head);
-        for (String s : list) {
-            assertTrue(c.next());
-            assertEquals(s, c.currentPath());
+        while (c.next()) {
+            paths.add(c.currentPath());
         }
+        Collections.sort(paths);
+        assertEquals(Arrays.asList(
+                "/", "/children", "/children/c1", "/children/c2",
+                "/children/c3", "/children/c4", "/parents",
+                "/parents/p0", "/parents/p1",  "/parents/p2"),
+                paths);
         assertFalse(c.next());
         // endure it stays false
         assertFalse(c.next());



Mime
View raw message