Search in sources :

Example 6 with PropertyValue

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

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

Example 8 with PropertyValue

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

the class QueryObjectModelFactoryTest method testLength.

/**
     * Test case for {@link QueryObjectModelFactory#length(PropertyValue)}
     */
public void testLength() throws RepositoryException {
    PropertyValue propValue = qf.propertyValue(SELECTOR_NAME1, propertyName1);
    Length len = qf.length(propValue);
    assertNotNull("Property value must not be null", len.getPropertyValue());
}
Also used : Length(javax.jcr.query.qom.Length) PropertyValue(javax.jcr.query.qom.PropertyValue)

Example 9 with PropertyValue

use of javax.jcr.query.qom.PropertyValue in project jackrabbit-oak by apache.

the class QomTest method propertyValue.

@Test
public void propertyValue() throws RepositoryException {
    PropertyValue pv = f.propertyValue("selectorName", "propertyName");
    assertEquals("selectorName", pv.getSelectorName());
    assertEquals("propertyName", pv.getPropertyName());
    assertEquals("[selectorName].[propertyName]", pv.toString());
    assertEquals("*", f.propertyValue(null, null).toString());
    assertEquals("[s].*", f.propertyValue("s", null).toString());
    assertEquals("[p]", f.propertyValue(null, "p").toString());
    assertEquals("[s].[p]", f.propertyValue("s", "p").toString());
}
Also used : PropertyValue(javax.jcr.query.qom.PropertyValue) Test(org.junit.Test) AbstractRepositoryTest(org.apache.jackrabbit.oak.jcr.AbstractRepositoryTest)

Example 10 with PropertyValue

use of javax.jcr.query.qom.PropertyValue in project jackrabbit-oak by apache.

the class QomTest method lowerCase.

@Test
public void lowerCase() throws RepositoryException {
    PropertyValue p = f.propertyValue("selectorName", "propertyName");
    Length length = f.length(p);
    LowerCase l = f.lowerCase(length);
    assertEquals(length, l.getOperand());
    assertEquals("LOWER(LENGTH([selectorName].[propertyName]))", l.toString());
}
Also used : Length(javax.jcr.query.qom.Length) PropertyValue(javax.jcr.query.qom.PropertyValue) LowerCase(javax.jcr.query.qom.LowerCase) 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