use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class SelectQueryTest method testOrQualifier.
@Test
public void testOrQualifier() {
assertNull(query.getQualifier());
Expression e1 = ExpressionFactory.expressionOfType(Expression.EQUAL_TO);
query.orQualifier(e1);
assertSame(e1, query.getQualifier());
Expression e2 = ExpressionFactory.expressionOfType(Expression.NOT_EQUAL_TO);
query.orQualifier(e2);
assertEquals(Expression.OR, query.getQualifier().getType());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class SelectQueryTest method testSetQualifier.
@Test
public void testSetQualifier() {
assertNull(query.getQualifier());
Expression qual = ExpressionFactory.expressionOfType(Expression.AND);
query.setQualifier(qual);
assertNotNull(query.getQualifier());
assertSame(qual, query.getQualifier());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTAbsTest method parseTest.
@Test
public void parseTest() throws Exception {
String expString = "abs(xyz)";
Expression exp = ExpressionFactory.exp(expString);
assertTrue(exp instanceof ASTAbs);
String toString = exp.toString();
assertEquals(expString, toString);
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTAggregateTest method testAvgParse.
@Test
public void testAvgParse() throws Exception {
String expressionString = "avg(artistName)";
Expression exp = ExpressionFactory.exp(expressionString);
assertTrue(exp instanceof ASTAvg);
assertEquals(1, exp.getOperandCount());
assertTrue(exp.getOperand(0) instanceof ASTObjPath);
assertEquals(expressionString, exp.toString());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTAggregateTest method testSumParse.
@Test
public void testSumParse() throws Exception {
String expressionString = "sum(artistName)";
Expression exp = ExpressionFactory.exp(expressionString);
assertTrue(exp instanceof ASTSum);
assertEquals(1, exp.getOperandCount());
assertTrue(exp.getOperand(0) instanceof ASTObjPath);
assertEquals(expressionString, exp.toString());
}
Aggregations