use of javax.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 javax.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testWeekdaysA.
@Test(timeout = 1000)
public void testWeekdaysA() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().year(2008).dayOfWeek("Wed").start(new Date(0));
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
// Should fire on January 16th
Calendar calendar = new GregorianCalendar(2008, 0, 16);
final Date startTime = new Date(calendar.getTimeInMillis() - 1000);
assertEquals(calendar.getTime(), trigger.getFireTimeAfter(startTime));
// And for the last time, on the 31st of December
calendar = new GregorianCalendar(2008, 11, 31);
final Date expectedTime = calendar.getTime();
assertEquals(expectedTime, trigger.getFinalFireTime());
}
use of javax.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testBothDayOfMonthAndDayOfWeekB.
@Test(timeout = 5000)
public void testBothDayOfMonthAndDayOfWeekB() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().dayOfMonth("last").dayOfWeek("3").year(2011).start(new Date(0));
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
assertEquals(new GregorianCalendar(2011, 4, 11, 0, 0, 0).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 4, 7, 0, 0, 0).getTime()));
}
use of javax.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testBothDayOfMonthAndDayOfWeekG.
@Test(timeout = 5000)
public void testBothDayOfMonthAndDayOfWeekG() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().year(2011).dayOfMonth("12").dayOfWeek("6").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, 5, 11, 20, 59, 59).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 5, 11, 20, 59, 58).getTime()));
assertEquals(new GregorianCalendar(2011, 5, 12, 20, 59, 59).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 5, 11, 20, 59, 59).getTime()));
}
use of javax.ejb.ScheduleExpression in project tomee by apache.
the class EJBCronTriggerTest method testBothDayOfMonthAndDayOfWeekE.
@Test(timeout = 5000)
public void testBothDayOfMonthAndDayOfWeekE() throws ParseException {
final ScheduleExpression expr = new ScheduleExpression().year(2011).dayOfMonth("19").dayOfWeek("3").hour(23).minute(59).second(58).start(new GregorianCalendar(2011, 4, 18, 23, 59, 58).getTime());
final EJBCronTrigger trigger = new EJBCronTrigger(expr);
assertEquals(new GregorianCalendar(2011, 4, 19, 23, 59, 58).getTime(), trigger.getFireTimeAfter(new GregorianCalendar(2011, 4, 18, 23, 59, 59).getTime()));
}
Aggregations