jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r722069 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
Date Mon, 01 Dec 2008 13:36:57 GMT
Author: mreutegg
Date: Mon Dec  1 05:36:57 2008
New Revision: 722069

URL: http://svn.apache.org/viewvc?rev=722069&view=rev
Log:
JCR-1888: Add customizable filtering to GQL

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=722069&r1=722068&r2=722069&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
Mon Dec  1 05:36:57 2008
@@ -22,6 +22,8 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.query.RowIterator;
+import javax.jcr.query.Row;
+
 import java.util.Calendar;
 import java.io.ByteArrayInputStream;
 import java.io.UnsupportedEncodingException;
@@ -238,7 +240,40 @@
         String stmt = createStatement("order:jcr:title");
         RowIterator rows = GQL.execute(stmt, superuser);
         checkResultSequence(rows, new Node[]{n1, n2, n3});
+    }
 
+    public void testFilter() throws RepositoryException {
+        final Node n1 = testRootNode.addNode("node1");
+        n1.setProperty("jcr:title", "a");
+        Node n2 = testRootNode.addNode("node2");
+        n2.setProperty("jcr:title", "b");
+        Node n3 = testRootNode.addNode("node3");
+        n3.setProperty("jcr:title", "c");
+        superuser.save();
+        String stmt = createStatement("order:jcr:title");
+        RowIterator rows = GQL.execute(stmt, superuser, null, new GQL.Filter() {
+            public boolean include(Row row) throws RepositoryException {
+                return !n1.getPath().equals(row.getValue("jcr:path").getString());
+            }
+        });
+        checkResultSequence(rows, new Node[]{n2, n3});
+    }
+
+    public void testFilterLimit() throws RepositoryException {
+        final Node n1 = testRootNode.addNode("node1");
+        n1.setProperty("jcr:title", "a");
+        Node n2 = testRootNode.addNode("node2");
+        n2.setProperty("jcr:title", "b");
+        Node n3 = testRootNode.addNode("node3");
+        n3.setProperty("jcr:title", "c");
+        superuser.save();
+        String stmt = createStatement("order:jcr:title limit:1");
+        RowIterator rows = GQL.execute(stmt, superuser, null, new GQL.Filter() {
+            public boolean include(Row row) throws RepositoryException {
+                return !n1.getPath().equals(row.getValue("jcr:path").getString());
+            }
+        });
+        checkResultSequence(rows, new Node[]{n2});
     }
 
     public void XXXtestQueryDestruction() throws RepositoryException {



Mime
View raw message