Search in sources :

Example 11 with Selector

use of javax.jcr.query.qom.Selector in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQueryWithConstraintOrderingAndColumn.

public void testCreateQueryWithConstraintOrderingAndColumn() throws RepositoryException {
    Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
    PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
    PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
    Ordering ordering = qf.ascending(propValue);
    Column column = qf.column(SELECTOR_NAME1, propertyName1, propertyName1);
    QueryObjectModel qom = qf.createQuery(selector, propExist, new Ordering[] { ordering }, new Column[] { column });
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
    assertEquals("Wrong size of orderings", 1, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 1, qom.getColumns().length);
}
Also used : Column(javax.jcr.query.qom.Column) Ordering(javax.jcr.query.qom.Ordering) PropertyValue(javax.jcr.query.qom.PropertyValue) QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) PropertyExistence(javax.jcr.query.qom.PropertyExistence) Selector(javax.jcr.query.qom.Selector)

Example 12 with Selector

use of javax.jcr.query.qom.Selector in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQueryFromSource.

public void testCreateQueryFromSource() throws RepositoryException {
    Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
    QueryObjectModel qom = qf.createQuery(selector, null, null, null);
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertNull("Constraint must be null", qom.getConstraint());
    assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 0, qom.getColumns().length);
}
Also used : QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) Source(javax.jcr.query.qom.Source) Selector(javax.jcr.query.qom.Selector)

Example 13 with Selector

use of javax.jcr.query.qom.Selector in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testSelectorWithName.

/**
     * Test case for {@link QueryObjectModelFactory#selector(String, String)}
     */
public void testSelectorWithName() throws RepositoryException {
    Selector selector = qf.selector(ntBase, SELECTOR_NAME1);
    assertEquals("Wrong node type name", ntBase, selector.getNodeTypeName());
    assertEquals("Wrong selector name", SELECTOR_NAME1, selector.getSelectorName());
}
Also used : Selector(javax.jcr.query.qom.Selector)

Example 14 with Selector

use of javax.jcr.query.qom.Selector in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQueryFromSourceWithConstraint.

public void testCreateQueryFromSourceWithConstraint() throws RepositoryException {
    Source selector = qf.selector(testNodeType, SELECTOR_NAME1);
    PropertyExistence propExist = qf.propertyExistence(SELECTOR_NAME1, propertyName1);
    QueryObjectModel qom = qf.createQuery(selector, propExist, null, null);
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertTrue("Not a property existence constraint", qom.getConstraint() instanceof PropertyExistence);
    assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 0, qom.getColumns().length);
}
Also used : QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) PropertyExistence(javax.jcr.query.qom.PropertyExistence) Source(javax.jcr.query.qom.Source) Selector(javax.jcr.query.qom.Selector)

Example 15 with Selector

use of javax.jcr.query.qom.Selector in project jackrabbit by apache.

the class QueryObjectModelFactoryTest method testCreateQuery.

public void testCreateQuery() throws RepositoryException {
    Selector selector = qf.selector(testNodeType, SELECTOR_NAME1);
    QueryObjectModel qom = qf.createQuery(selector, null, null, null);
    assertTrue("Not a selector source", qom.getSource() instanceof Selector);
    assertNull("Constraint must be null", qom.getConstraint());
    assertEquals("Wrong size of orderings", 0, qom.getOrderings().length);
    assertEquals("Wrong size of columns", 0, qom.getColumns().length);
}
Also used : QueryObjectModel(javax.jcr.query.qom.QueryObjectModel) Selector(javax.jcr.query.qom.Selector)

Aggregations

Selector (javax.jcr.query.qom.Selector)16 QueryObjectModel (javax.jcr.query.qom.QueryObjectModel)9 Ordering (javax.jcr.query.qom.Ordering)6 PropertyExistence (javax.jcr.query.qom.PropertyExistence)6 Source (javax.jcr.query.qom.Source)6 Column (javax.jcr.query.qom.Column)5 PropertyValue (javax.jcr.query.qom.PropertyValue)5 Constraint (javax.jcr.query.qom.Constraint)3 BindVariableValue (javax.jcr.query.qom.BindVariableValue)2 JoinCondition (javax.jcr.query.qom.JoinCondition)2 AbstractRepositoryTest (org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 ChildNodeJoinCondition (javax.jcr.query.qom.ChildNodeJoinCondition)1 DescendantNodeJoinCondition (javax.jcr.query.qom.DescendantNodeJoinCondition)1 EquiJoinCondition (javax.jcr.query.qom.EquiJoinCondition)1 Join (javax.jcr.query.qom.Join)1 SameNodeJoinCondition (javax.jcr.query.qom.SameNodeJoinCondition)1 JoinType (org.apache.jackrabbit.commons.query.qom.JoinType)1