// Doc order
String strDocOrder = "select * from nt:unstructured where jcr:path like '/" + testRootNodeName + "/%'";
Query selectChildQuery = qm.createQuery(strDocOrder, Query.SQL);
TwoWayRangeIterator iterator = testAction.execute(selectChildQuery);
assertTrue(iterator.hasNext());
assertEquals(expectedPosition, iterator.getPosition());
assertEquals(expectedPosition, ((Node)iterator.next()).getProperty("val").getLong());
// Order by
String strOrder = "select * from nt:unstructured where jcr:path like '/" + testRootNodeName + "/%' order by val";
Query selectOrderChildQuery = qm.createQuery(strOrder, Query.SQL);
TwoWayRangeIterator orderIterator = testAction.execute(selectOrderChildQuery);
assertTrue(orderIterator.hasNext());
assertEquals(expectedPosition, orderIterator.getPosition());
Node nextNode = (Node)orderIterator.next();
if (nextNode.getProperty("val").getLong() != expectedPosition)
{
orderIterator.skipBack(orderIterator.getPosition());
while (orderIterator.hasNext())
{
Node nooode = (Node)orderIterator.next();
log.info("node " + nooode.getPath() + " " + nooode.getProperty("val").getLong() + " "
+ orderIterator.getPosition());
}
}
assertEquals(expectedPosition, nextNode.getProperty("val").getLong());