use of jakarta.ejb.ScheduleExpression in project tomee by apache.
the class TimerServiceImpl method copy.
private ScheduleExpression copy(final ScheduleExpression scheduleExpression) {
final ScheduleExpression scheduleExpressionCopy = new ScheduleExpression();
scheduleExpressionCopy.year(scheduleExpression.getYear());
scheduleExpressionCopy.month(scheduleExpression.getMonth());
scheduleExpressionCopy.dayOfMonth(scheduleExpression.getDayOfMonth());
scheduleExpressionCopy.dayOfWeek(scheduleExpression.getDayOfWeek());
scheduleExpressionCopy.hour(scheduleExpression.getHour());
scheduleExpressionCopy.minute(scheduleExpression.getMinute());
scheduleExpressionCopy.second(scheduleExpression.getSecond());
scheduleExpressionCopy.start(scheduleExpression.getStart());
scheduleExpressionCopy.end(scheduleExpression.getEnd());
scheduleExpressionCopy.timezone(scheduleExpression.getTimezone());
return scheduleExpressionCopy;
}
use of jakarta.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testRangeMonthA.
@Test(timeout = 500)
public void testRangeMonthA() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().year("2011").month("dec-dec").dayOfMonth(29).hour(23).minute(1).second(0).start(new Date(0));
;
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
assertEquals(new GregorianCalendar(2011, 11, 29, 23, 1, 0).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2009, 1, 1, 23, 0, 0).getTime()));
}
use of jakarta.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testBothDayOfMonthAndDayOfWeekH.
@Test(timeout = 5000)
public void testBothDayOfMonthAndDayOfWeekH() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().year(2011).dayOfMonth("28").dayOfWeek("3").hour(20).minute(59).second(59).start(new GregorianCalendar(2011, 5, 11, 20, 59, 58).getTime());
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
assertEquals(new GregorianCalendar(2011, 6, 28, 20, 59, 59).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 6, 27, 21, 59, 59).getTime()));
}
use of jakarta.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testBothDayOfMonthAndDayOfWeekF.
@Test(timeout = 5000)
public void testBothDayOfMonthAndDayOfWeekF() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().year(2011).dayOfMonth("19").dayOfWeek("3").hour(20).minute(59).second(59).start(new GregorianCalendar(2011, 4, 18, 20, 59, 58).getTime());
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
assertEquals(new GregorianCalendar(2011, 4, 18, 20, 59, 59).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 4, 18, 20, 59, 58).getTime()));
assertEquals(new GregorianCalendar(2011, 4, 19, 20, 59, 59).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 4, 18, 20, 59, 59).getTime()));
}
use of jakarta.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testOrdinalNumbersDayOfMonthC.
@Test(timeout = 5000)
public void testOrdinalNumbersDayOfMonthC() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().dayOfMonth("last sun").hour(23).minute(1).second(59);
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
assertEquals(new GregorianCalendar(2100, 1, 28, 23, 1, 59).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2100, 1, 1, 0, 0, 0).getTime()));
}
Aggregations