use of javax.jcr.query.qom.PropertyValue in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testOrderingAscending.
/**
* Test case for {@link QueryObjectModelFactory#ascending(DynamicOperand)}
*/
public void testOrderingAscending() throws RepositoryException {
PropertyValue op = qf.propertyValue(SELECTOR_NAME1, propertyName1);
Ordering asc = qf.ascending(op);
assertEquals("Ordering.getOrder() must return QueryObjectModelConstants.ORDER_ASCENDING", QueryObjectModelConstants.JCR_ORDER_ASCENDING, asc.getOrder());
assertTrue("Not a PropertyValue operand", asc.getOperand() instanceof PropertyValue);
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit-oak by apache.
the class QomTest method comparison.
@Test
public void comparison() throws RepositoryException {
PropertyValue p = f.propertyValue("selectorName", "propertyName");
Literal l = f.literal(vf.createValue(1));
Comparison c = f.comparison(p, QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, l);
assertEquals(p, c.getOperand1());
assertEquals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO, c.getOperator());
assertEquals(l, c.getOperand2());
assertEquals("[selectorName].[propertyName] = 1", c.toString());
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit-oak by apache.
the class QomTest method upperCase.
@Test
public void upperCase() throws RepositoryException {
PropertyValue p = f.propertyValue("selectorName", "propertyName");
Length length = f.length(p);
UpperCase u = f.upperCase(length);
assertEquals(length, u.getOperand());
assertEquals("UPPER(LENGTH([selectorName].[propertyName]))", u.toString());
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit-oak by apache.
the class QomTest method descending.
@Test
public void descending() throws RepositoryException {
PropertyValue p = f.propertyValue("selectorName", "propertyName");
Ordering o = f.descending(p);
assertEquals(p, o.getOperand());
assertEquals(QueryObjectModelConstants.JCR_ORDER_DESCENDING, o.getOrder());
assertEquals("[selectorName].[propertyName] DESC", o.toString());
}
use of javax.jcr.query.qom.PropertyValue in project jackrabbit-oak by apache.
the class QomTest method ascending.
@Test
public void ascending() throws RepositoryException {
PropertyValue p = f.propertyValue("selectorName", "propertyName");
Ordering o = f.ascending(p);
assertEquals(p, o.getOperand());
assertEquals(QueryObjectModelConstants.JCR_ORDER_ASCENDING, o.getOrder());
assertEquals("[selectorName].[propertyName]", p.toString());
}
Aggregations