@Test @FixFor( "MODE-2329" ) public void shouldAllowUsingExpandedSelectorNameInQOM() throws Exception { QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory(); Selector selector = qomFactory.selector(NodeType.NT_BASE, "category"); // Build and execute the query ... Query query = qomFactory.createQuery(selector, qomFactory.childNode("category", "/Cars"), null, new Column[0]); assertThat(query.getStatement(), is("SELECT * FROM [{http://www.jcp.org/jcr/nt/1.0}base] AS category WHERE ISCHILDNODE(category,'/Cars')")); QueryResult result = query.execute(); validateQuery().rowCount(4).hasColumns(allColumnNames("category")).validate(query, result); }
@FixFor( "MODE-1611" ) @Test public void shouldAllowQomUseOfIsChildNodeInWhereClause() throws RepositoryException { QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory(); Selector selector = qomFactory.selector("nt:base", "category"); ChildNode childNodeConstraint = qomFactory.childNode("category", "/Cars"); Constraint constraint = childNodeConstraint; Column[] columns = new Column[0]; Ordering[] orderings = null; // Build and execute the query ... Query query = qomFactory.createQuery(selector, constraint, orderings, columns); assertThat(query.getStatement(), is("SELECT * FROM [nt:base] AS category WHERE ISCHILDNODE(category,'/Cars')")); QueryResult result = query.execute(); validateQuery().rowCount(4).hasColumns(allColumnNames("category")).validate(query, result); }