Search in sources :

Example 16 with Ordering

use of javax.jcr.query.qom.Ordering 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 17 with Ordering

use of javax.jcr.query.qom.Ordering 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 18 with Ordering

use of javax.jcr.query.qom.Ordering 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

Ordering (javax.jcr.query.qom.Ordering)18 PropertyValue (javax.jcr.query.qom.PropertyValue)9 QueryObjectModel (javax.jcr.query.qom.QueryObjectModel)6 Selector (javax.jcr.query.qom.Selector)6 Column (javax.jcr.query.qom.Column)5 Constraint (javax.jcr.query.qom.Constraint)4 PropertyExistence (javax.jcr.query.qom.PropertyExistence)4 Source (javax.jcr.query.qom.Source)3 AbstractRepositoryTest (org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 BindVariableValue (javax.jcr.query.qom.BindVariableValue)2 DynamicOperand (javax.jcr.query.qom.DynamicOperand)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 RepositoryException (javax.jcr.RepositoryException)1 Value (javax.jcr.Value)1 Operand (javax.jcr.query.qom.Operand)1 DynamicOperandFieldComparatorSource (org.apache.jackrabbit.core.query.lucene.sort.DynamicOperandFieldComparatorSource)1 SortField (org.apache.lucene.search.SortField)1