Search in sources :

Example 21 with PropertyValue

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);
}
Also used : Ordering(javax.jcr.query.qom.Ordering) PropertyValue(javax.jcr.query.qom.PropertyValue)

Example 22 with 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());
}
Also used : Comparison(javax.jcr.query.qom.Comparison) Literal(javax.jcr.query.qom.Literal) PropertyValue(javax.jcr.query.qom.PropertyValue) Test(org.junit.Test) AbstractRepositoryTest(org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)

Example 23 with PropertyValue

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());
}
Also used : UpperCase(javax.jcr.query.qom.UpperCase) Length(javax.jcr.query.qom.Length) PropertyValue(javax.jcr.query.qom.PropertyValue) Test(org.junit.Test) AbstractRepositoryTest(org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)

Example 24 with PropertyValue

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());
}
Also used : Ordering(javax.jcr.query.qom.Ordering) PropertyValue(javax.jcr.query.qom.PropertyValue) Test(org.junit.Test) AbstractRepositoryTest(org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)

Example 25 with PropertyValue

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());
}
Also used : Ordering(javax.jcr.query.qom.Ordering) PropertyValue(javax.jcr.query.qom.PropertyValue) Test(org.junit.Test) AbstractRepositoryTest(org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)

Aggregations

PropertyValue (javax.jcr.query.qom.PropertyValue)26 Ordering (javax.jcr.query.qom.Ordering)9 AbstractRepositoryTest (org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)8 Test (org.junit.Test)8 Length (javax.jcr.query.qom.Length)5 QueryObjectModel (javax.jcr.query.qom.QueryObjectModel)5 Selector (javax.jcr.query.qom.Selector)5 BindVariableValue (javax.jcr.query.qom.BindVariableValue)4 Constraint (javax.jcr.query.qom.Constraint)4 PropertyExistence (javax.jcr.query.qom.PropertyExistence)4 NodeType (javax.jcr.nodetype.NodeType)3 Column (javax.jcr.query.qom.Column)3 LowerCase (javax.jcr.query.qom.LowerCase)3 UpperCase (javax.jcr.query.qom.UpperCase)3 RepositoryException (javax.jcr.RepositoryException)2 UnsupportedRepositoryOperationException (javax.jcr.UnsupportedRepositoryOperationException)2 Value (javax.jcr.Value)2 Comparison (javax.jcr.query.qom.Comparison)2 NodeLocalName (javax.jcr.query.qom.NodeLocalName)2 NodeName (javax.jcr.query.qom.NodeName)2