jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1528966 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OrderByTest.java
Date Thu, 03 Oct 2013 18:45:25 GMT
Author: jukka
Date: Thu Oct  3 18:45:24 2013
New Revision: 1528966

URL: http://svn.apache.org/r1528966
Log:
JCR-3677: Invalid SQL2OrderByTest.testOrderByScore test case

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OrderByTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OrderByTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OrderByTest.java?rev=1528966&r1=1528965&r2=1528966&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OrderByTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/SQL2OrderByTest.java
Thu Oct  3 18:45:24 2013
@@ -20,6 +20,8 @@ import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.query.QueryResult;
+import javax.jcr.query.Row;
+import javax.jcr.query.RowIterator;
 
 import org.apache.jackrabbit.commons.JcrUtils;
 
@@ -68,9 +70,21 @@ public class SQL2OrderByTest extends Abs
         testRootNode.getSession().save();
 
         QueryResult qr = executeSQL2Query("SELECT * FROM [nt:base] WHERE ISCHILDNODE(["
-                + testRoot + "]) ORDER BY [jcr:score]");
-        checkSeq(qr, new Node[] { n1, n2, n3 });
+                + testRoot + "]) ORDER BY SCORE()");
+        RowIterator rows = qr.getRows();
 
+        long size = rows.getSize();
+        assertTrue(size == 3 || size == -1);
+        size = 0;
+
+        double score = Double.MIN_VALUE;
+        while (rows.hasNext()) {
+            double nextScore = rows.nextRow().getScore();
+            assertTrue(nextScore >= score);
+            score = nextScore;
+            size++;
+        }
+        assertEquals(3, size);
     }
 
     /**



Mime
View raw message