jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1357596 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
Date Thu, 05 Jul 2012 13:30:41 GMT
Author: thomasm
Date: Thu Jul  5 13:30:41 2012
New Revision: 1357596

URL: http://svn.apache.org/viewvc?rev=1357596&view=rev
Log:
JCR-3376 TCK: SQLPathTest.testChildAxisRoot expected root node not in result

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java?rev=1357596&r1=1357595&r2=1357596&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
Thu Jul  5 13:30:41 2012
@@ -69,7 +69,7 @@ public class SQLPathTest extends Abstrac
 
     /**
      * Tests if <somepath>/% returns the descendants of <somepath>.
-     * @throws NotExecutableException 
+     * @throws NotExecutableException
      */
     public void testDescendantTestRoot() throws RepositoryException, NotExecutableException
{
         String sql = getStatement(testRoot + "/%");
@@ -79,7 +79,7 @@ public class SQLPathTest extends Abstrac
     /**
      * Tests if <somepath>/% returns no nodes if node at <somepath>
      * is a leaf.
-     * @throws NotExecutableException 
+     * @throws NotExecutableException
      */
     public void testDescendantLeaf() throws RepositoryException, NotExecutableException {
         // find leaf
@@ -95,7 +95,7 @@ public class SQLPathTest extends Abstrac
      * Tests if <somepath>/%/<nodename> OR <somepath>/<nodename>
      * returns nodes with name <nodename> which are descendants of
      * node at <code>testroot</code>.
-     * @throws NotExecutableException 
+     * @throws NotExecutableException
      */
     public void testDescendantSelfTestRoot() throws RepositoryException, NotExecutableException
{
         // get first node which is two levels deeper than node at testroot
@@ -124,11 +124,14 @@ public class SQLPathTest extends Abstrac
 
     /**
      * Tests if /% AND NOT /%/% returns the child nodes of the root node.
-     * @throws NotExecutableException 
+     * @throws NotExecutableException
      */
     public void testChildAxisRoot() throws RepositoryException, NotExecutableException {
         String sql = getStatement("/%");
-        sql += " AND NOT " + jcrPath + " LIKE '/%/%'";
+        // need to exclude the root node explicitly (using jcr:path <> '/')
+        // as the specification allows to not return it even if using jcr:path LIKE '/%'
+        // see also JCR specification, section 8.5.2.2 ("Pseudo-property jcr:path")
+        sql += " AND NOT " + jcrPath + " LIKE '/%/%' AND " + jcrPath + " <> '/'";
         Node[] nodes = toArray(session.getRootNode().getNodes());
         executeSqlQuery(session, sql, nodes);
     }
@@ -136,7 +139,7 @@ public class SQLPathTest extends Abstrac
     /**
      * Tests if &lt;somepath>/% AND NOT &lt;somepath>/%/% returns the child
      * nodes of node at &lt;somepath>.
-     * @throws NotExecutableException 
+     * @throws NotExecutableException
      */
     public void testChildAxisTestRoot() throws RepositoryException, NotExecutableException
{
         String sql = getStatement(testRoot + "/%");
@@ -148,7 +151,7 @@ public class SQLPathTest extends Abstrac
     /**
      * Tests if &lt;somepath>/% AND NOT &lt;somepath>/%/% returns no nodes
      * if the node at &lt;somepath> is a leaf.
-     * @throws NotExecutableException 
+     * @throws NotExecutableException
      */
     public void testChildAxisLeaf() throws RepositoryException, NotExecutableException {
         // find leaf
@@ -179,7 +182,7 @@ public class SQLPathTest extends Abstrac
      * @return descendants of <code>node</code>.
      * @throws RepositoryException if an error occurs.
      */
-    private Node[] getDescendants(final Node node) throws RepositoryException {
+    private static Node[] getDescendants(final Node node) throws RepositoryException {
         final List<Node> descendants = new ArrayList<Node>();
 
         node.accept(new TraversingItemVisitor.Default() {



Mime
View raw message