use of org.apache.jackrabbit.spi.commons.query.QueryRootNode in project jackrabbit by apache.
the class XPathOrderByTest method testAscending.
public void testAscending() throws Exception {
String stmt = "//* order by @bar ascending";
QueryRootNode root = QueryParser.parse(stmt, Query.XPATH, RESOLVER, FACTORY);
OrderQueryNode.OrderSpec[] specs = root.getOrderNode().getOrderSpecs();
assertEquals(1, specs.length);
assertTrue(specs[0].isAscending());
}
use of org.apache.jackrabbit.spi.commons.query.QueryRootNode in project jackrabbit by apache.
the class XPathOrderByTest method testSimpleOrderBy.
public void testSimpleOrderBy() throws Exception {
String stmt = "//* order by @bar";
QueryRootNode root = QueryParser.parse(stmt, Query.XPATH, RESOLVER, FACTORY);
OrderQueryNode.OrderSpec[] specs = root.getOrderNode().getOrderSpecs();
assertEquals(1, specs.length);
assertTrue(specs[0].isAscending());
checkName(Name.NS_DEFAULT_URI, "bar", specs[0].getProperty());
Path propPath = specs[0].getPropertyPath();
assertEquals(1, propPath.getLength());
checkName(Name.NS_DEFAULT_URI, "bar", propPath.getName());
}
use of org.apache.jackrabbit.spi.commons.query.QueryRootNode in project jackrabbit by apache.
the class XPathOrderByTest method testRoundTrip.
public void testRoundTrip() throws Exception {
String stmt = "//* order by foo_x0020_bar/@bar";
QueryRootNode root = QueryParser.parse(stmt, Query.XPATH, RESOLVER, FACTORY);
assertEquals(stmt, QueryFormat.toString(root, RESOLVER));
}
use of org.apache.jackrabbit.spi.commons.query.QueryRootNode in project jackrabbit by apache.
the class QueryFormatTest method checkStatement.
protected void checkStatement(String stmt) throws InvalidQueryException {
QueryRootNode root = QueryParser.parse(stmt, Query.XPATH, RESOLVER, FACTORY);
assertEquals(stmt, QueryFormat.toString(root, RESOLVER));
}
use of org.apache.jackrabbit.spi.commons.query.QueryRootNode in project jackrabbit by apache.
the class XPathOrderByTest method testDescending.
public void testDescending() throws Exception {
String stmt = "//* order by @bar descending";
QueryRootNode root = QueryParser.parse(stmt, Query.XPATH, RESOLVER, FACTORY);
OrderQueryNode.OrderSpec[] specs = root.getOrderNode().getOrderSpecs();
assertEquals(1, specs.length);
assertFalse(specs[0].isAscending());
}
Aggregations