use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testCreateQueryFromSourceWithConstraintAndOrdering.
public void testCreateQueryFromSourceWithConstraintAndOrdering() throws RepositoryException {
Source 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);
QueryObjectModel qom = qf.createQuery(selector, propExist, new Ordering[] { ordering }, 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", 1, qom.getOrderings().length);
assertEquals("Wrong size of columns", 0, qom.getColumns().length);
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testPropertyValue.
/**
* Test case for {@link QueryObjectModelFactory#propertyValue(String, String)}
*/
public void testPropertyValue() throws RepositoryException {
PropertyValue propVal = qf.propertyValue(SELECTOR_NAME1, propertyName1);
assertEquals("Wrong selector name", SELECTOR_NAME1, propVal.getSelectorName());
assertEquals("Wrong property name", propertyName1, propVal.getPropertyName());
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testComparison.
/**
* Test case for {@link QueryObjectModelFactory#comparison(DynamicOperand, String, StaticOperand)}
*/
public void testComparison() throws RepositoryException {
PropertyValue op1 = qf.propertyValue(SELECTOR_NAME1, propertyName1);
BindVariableValue op2 = qf.bindVariable(VARIABLE_NAME);
for (Iterator<String> it = OPERATORS.iterator(); it.hasNext(); ) {
String operator = it.next();
Comparison comp = qf.comparison(op1, operator, op2);
assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
assertEquals("Wrong operator", operator, comp.getOperator());
}
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testOrderingDescending.
/**
* Test case for {@link QueryObjectModelFactory#descending(DynamicOperand)}
*/
public void testOrderingDescending() throws RepositoryException {
PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
Ordering desc = qf.descending(op);
assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_DESCENDING", QueryObjectModelConstants.JCR_ORDER_DESCENDING, desc.getOrder());
assertTrue("Not a PropertyValue operand", desc.getOperand() instanceof PropertyValue);
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testUpperCase.
/**
* Test case for {@link QueryObjectModelFactory#upperCase(DynamicOperand)}
*/
public void testUpperCase() throws RepositoryException {
PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
UpperCase upper = qf.upperCase(propValue);
assertTrue("Not a property value operand", upper.getOperand() instanceof PropertyValue);
}
Aggregations