jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r829019 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
Date Fri, 23 Oct 2009 12:21:39 GMT
Author: mreutegg
Date: Fri Oct 23 12:21:39 2009
New Revision: 829019

URL: http://svn.apache.org/viewvc?rev=829019&view=rev
Log:
JCR-2361: Add parser callback to GQL
- add test case for order by with relative path

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java?rev=829019&r1=829018&r2=829019&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
Fri Oct 23 12:21:39 2009
@@ -16,17 +16,17 @@
  */
 package org.apache.jackrabbit.core.integration;
 
-import org.apache.jackrabbit.core.query.AbstractQueryTest;
-import org.apache.jackrabbit.commons.query.GQL;
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Calendar;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
-import javax.jcr.query.RowIterator;
 import javax.jcr.query.Row;
+import javax.jcr.query.RowIterator;
 
-import java.util.Calendar;
-import java.io.ByteArrayInputStream;
-import java.io.UnsupportedEncodingException;
+import org.apache.jackrabbit.commons.query.GQL;
+import org.apache.jackrabbit.core.query.AbstractQueryTest;
 
 import junit.framework.AssertionFailedError;
 
@@ -68,6 +68,31 @@
         checkResultSequence(rows, new Node[]{n3, n2, n1});
     }
 
+    public void testOrderDeep() throws RepositoryException {
+        Node n1 = testRootNode.addNode("node1");
+        n1.setProperty("prop", "value");
+        n1.addNode("sub").setProperty("p", 1);
+        Node n2 = testRootNode.addNode("node2");
+        n2.setProperty("prop", "value");
+        n2.addNode("sub").setProperty("p", 2);
+        Node n3 = testRootNode.addNode("node3");
+        n3.setProperty("prop", "value");
+        n3.addNode("sub").setProperty("p", 3);
+        superuser.save();
+        // default: ascending
+        String stmt = createStatement("prop:value order:sub/p");
+        RowIterator rows = GQL.execute(stmt, superuser);
+        checkResultSequence(rows, new Node[]{n1, n2, n3});
+        // explicit ascending
+        stmt = createStatement("prop:value order:+sub/p");
+        rows = GQL.execute(stmt, superuser);
+        checkResultSequence(rows, new Node[]{n1, n2, n3});
+        // explicit descending
+        stmt = createStatement("prop:value order:-sub/p");
+        rows = GQL.execute(stmt, superuser);
+        checkResultSequence(rows, new Node[]{n3, n2, n1});
+    }
+
     public void testLimit() throws RepositoryException {
         Node n1 = testRootNode.addNode("node1");
         n1.setProperty("p", 1);



Mime
View raw message