use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTExtractTest method testDayOfWeek.
@Test
public void testDayOfWeek() {
String expStr = "dayOfWeek(dateColumn)";
Expression expParsed = ExpressionFactory.exp(expStr);
Expression expFromFactory = FunctionExpressionFactory.dayOfWeekExp("dateColumn");
assertTrue(expParsed instanceof ASTExtract);
assertTrue(expFromFactory instanceof ASTExtract);
assertEquals(expStr, expParsed.toString());
assertEquals(expStr, expFromFactory.toString());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTExtractTest method testDay.
@Test
public void testDay() {
String expStr = "day(dateColumn)";
Expression expParsed = ExpressionFactory.exp(expStr);
assertTrue(expParsed instanceof ASTExtract);
assertEquals(expStr, expParsed.toString());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTExtractTest method testMinute.
@Test
public void testMinute() {
String expStr = "minute(dateColumn)";
Expression expParsed = ExpressionFactory.exp(expStr);
Expression expFromFactory = FunctionExpressionFactory.minuteExp("dateColumn");
assertTrue(expParsed instanceof ASTExtract);
assertTrue(expFromFactory instanceof ASTExtract);
assertEquals(expStr, expParsed.toString());
assertEquals(expStr, expFromFactory.toString());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTExtractTest method testWeek.
@Test
public void testWeek() {
String expStr = "week(dateColumn)";
Expression expParsed = ExpressionFactory.exp(expStr);
Expression expFromFactory = FunctionExpressionFactory.weekExp("dateColumn");
assertTrue(expParsed instanceof ASTExtract);
assertTrue(expFromFactory instanceof ASTExtract);
assertEquals(expStr, expParsed.toString());
assertEquals(expStr, expFromFactory.toString());
}
use of org.apache.cayenne.exp.Expression in project cayenne by apache.
the class ASTFunctionCallDateIT method testASTCurrentTimeParse.
@Test
public void testASTCurrentTimeParse() {
Expression exp = ExpressionFactory.exp("timeColumn > currentTime()");
DateTestEntity res = ObjectSelect.query(DateTestEntity.class, exp).selectOne(context);
if (!unitDbAdapter.supportsTimeSqlType()) {
return;
}
assertNotNull(res);
}
Aggregations