use of javax.jcr.query.qom.Literal in project jackrabbit by apache.
the class QueryObjectModelFactoryTest method testFullTextSearch.
/**
* Test case for {@link QueryObjectModelFactory#fullTextSearch(String, String, StaticOperand)}
*/
public void testFullTextSearch() throws RepositoryException {
FullTextSearch ftSearch = qf.fullTextSearch(SELECTOR_NAME1, propertyName1, qf.literal(vf.createValue(FULLTEXT_SEARCH_EXPR)));
assertEquals("Wrong selector name", SELECTOR_NAME1, ftSearch.getSelectorName());
assertEquals("Wrong propertyName", propertyName1, ftSearch.getPropertyName());
StaticOperand op = ftSearch.getFullTextSearchExpression();
assertNotNull(op);
assertTrue("not a Literal", op instanceof Literal);
Literal literal = (Literal) op;
assertEquals(FULLTEXT_SEARCH_EXPR, literal.getLiteralValue().getString());
}
use of javax.jcr.query.qom.Literal 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());
}
Aggregations