use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallDateIT method testASTCurrentTimestampParse.
@Test
public void testASTCurrentTimestampParse() {
Expression exp = ExpressionFactory.exp("timestampColumn > now()");
DateTestEntity res = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
assertNotNull(res);
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallDateIT method testASTCurrentDateParse.
@Test
public void testASTCurrentDateParse() {
Expression exp = ExpressionFactory.exp("dateColumn > currentDate()");
DateTestEntity res = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
assertNotNull(res);
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallDateIT method testCurrentTimestamp.
@Test
public void testCurrentTimestamp() throws Exception {
Expression exp = ExpressionFactory.greaterOrEqualExp("timestampColumn", new ASTCurrentTimestamp());
DateTestEntity res1 = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
assertNotNull(res1);
Expression exp2 = ExpressionFactory.lessExp("timestampColumn", new ASTCurrentTimestamp());
DateTestEntity res2 = ObjectSelect.query(DateTestEntity.class, exp2).selectOne(context);
assertNotNull(res2);
assertNotEquals(res1, res2);
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallMathIT method testASTSqrtParse.
@Test
public void testASTSqrtParse() {
Expression exp = ExpressionFactory.exp("sqrt(16)");
assertEquals(4.0, exp.evaluate(new Object()));
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallMathIT method testComplexParse.
@Test
public void testComplexParse() {
Expression exp = ExpressionFactory.exp("10 - mod(sqrt(abs(-9)), 2)");
assertEquals(BigDecimal.valueOf(9L), exp.evaluate(new Object()));
}
Aggregations