Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 35643 invoked from network); 1 Dec 2008 13:37:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Dec 2008 13:37:48 -0000 Received: (qmail 64019 invoked by uid 500); 1 Dec 2008 13:38:00 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 63984 invoked by uid 500); 1 Dec 2008 13:38:00 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 63975 invoked by uid 99); 1 Dec 2008 13:38:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 05:38:00 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 13:36:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 09EA0238889E; Mon, 1 Dec 2008 05:36:58 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@jackrabbit.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081201133658.09EA0238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 {