use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class ChildNodeJoinConditionTest method testInnerJoin.
public void testInnerJoin() throws RepositoryException {
JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c);
checkQOM(qom, new Node[][] { { n2, n1 } });
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeJoinConditionTest method testLeftOuterJoin.
public void testLeftOuterJoin() throws RepositoryException {
JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER, c);
List<Node[]> result = new ArrayList<Node[]>();
result.add(new Node[] { n2, n1 });
// for each ancestor-or-self of testRootNode check
// whether it is of type testNodeType and add
// two matches in that case
Node n = testRootNode;
for (; ; ) {
if (n.isNodeType(testNodeType)) {
result.add(new Node[] { n1, n });
result.add(new Node[] { n2, n });
}
if (n.getDepth() == 0) {
break;
} else {
n = n.getParent();
}
}
if (result.size() == 1) {
// n1 not yet covered
result.add(new Node[] { n1, null });
}
checkQOM(qom, result.toArray(new Node[result.size()][]));
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeJoinConditionTest method testInnerJoin.
public void testInnerJoin() throws RepositoryException {
JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_INNER, c);
checkQOM(qom, new Node[][] { { n2, n1 } });
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeTest method testDescendantNode.
public void testDescendantNode() throws RepositoryException {
Node n = testRootNode.addNode(nodeName1, testNodeType);
superuser.save();
QueryObjectModel qom = qf.createQuery(qf.selector(testNodeType, "s"), qf.descendantNode("s", testRoot), null, null);
checkQOM(qom, new Node[] { n });
}
use of javax.jcr.query.qom.QueryObjectModel in project jackrabbit by apache.
the class DescendantNodeTest method testDescendantNodesDoNotMatchSelector.
public void testDescendantNodesDoNotMatchSelector() throws RepositoryException, NotExecutableException {
testRootNode.addNode(nodeName1, testNodeType);
superuser.save();
NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
NodeTypeIterator it = ntMgr.getPrimaryNodeTypes();
NodeType testNt = ntMgr.getNodeType(testNodeType);
while (it.hasNext()) {
NodeType nt = it.nextNodeType();
if (!testNt.isNodeType(nt.getName())) {
// perform test
QueryObjectModel qom = qf.createQuery(qf.selector(nt.getName(), "s"), qf.descendantNode("s", testRoot), null, null);
checkQOM(qom, new Node[] {});
return;
}
}
throw new NotExecutableException("No suitable node type found to " + "perform test against '" + testNodeType + "' nodes");
}
Aggregations