You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2008/12/01 14:36:57 UTC
svn commit: r722069 -
/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
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 {