use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class ColumnTest method testColumnNames.
/**
* From the spec:
* <p>
* If propertyName is specified, columnName is required and used to name
* the column in the tabular results.
*/
public void testColumnNames() throws RepositoryException {
QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, SELECTOR_1), null, null, new Column[] { qf.column(SELECTOR_1, propertyName1, propertyName1) });
forQOMandSQL2(qom, new Callable() {
public Object call(Query query) throws RepositoryException {
QueryResult result = query.execute();
List<String> names = new ArrayList<String>(Arrays.asList(result.getColumnNames()));
assertTrue("Missing column: " + propertyName1, names.remove(propertyName1));
for (Iterator<String> it = names.iterator(); it.hasNext(); ) {
fail(it.next() + " was not declared as a column");
}
return null;
}
});
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeJoinConditionTest method testRightOuterJoin.
public void testRightOuterJoin() throws RepositoryException {
JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_RIGHT_OUTER, c);
checkQOM(qom, new Node[][] { { n2, n1 }, { null, n2 } });
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeTest method testDescendantNodes.
public void testDescendantNodes() throws RepositoryException {
Node n1 = testRootNode.addNode(nodeName1, testNodeType);
Node n2 = testRootNode.addNode(nodeName2, testNodeType);
Node n21 = n2.addNode(nodeName1, testNodeType);
superuser.save();
QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, "s"), qf.descendantNode("s", testRoot), null, null);
checkQOM(qom, new Node[] { n1, n2, n21 });
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeTest method testPathDoesNotExist.
public void testPathDoesNotExist() throws RepositoryException {
QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, "s"), qf.descendantNode("s", testRoot + "/" + nodeName1), null, null);
checkQOM(qom, new Node[] {});
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class SameNodeTest method testPathDoesNotExist.
public void testPathDoesNotExist() throws RepositoryException {
QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, "s"), qf.sameNode("s", testRoot + "/" + nodeName1), null, null);
checkQOM(qom, new Node[] {});
}
Aggregations