mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1078821 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1c1aa17311
commit
74a45502e2
|
@ -52,6 +52,32 @@ public class CronParserTest {
|
|||
assertEquals(2010,result.get(Calendar.YEAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testgetNextTimeCase1() throws MessageFormatException {
|
||||
|
||||
|
||||
// using an absolute date so that result will be absolute - Monday 15 Nov 2010
|
||||
Calendar current = Calendar.getInstance();
|
||||
current.set(2011, Calendar.MARCH, 7, 9, 15, 30);
|
||||
System.out.println("start:" + current.getTime());
|
||||
|
||||
String test = "50 20 * * 5";
|
||||
long next = CronParser.getNextScheduledTime(test, current.getTimeInMillis());
|
||||
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTimeInMillis(next);
|
||||
System.out.println("next:" + result.getTime());
|
||||
|
||||
assertEquals(30,result.get(Calendar.SECOND));
|
||||
assertEquals(50,result.get(Calendar.MINUTE));
|
||||
assertEquals(20,result.get(Calendar.HOUR_OF_DAY));
|
||||
// expecting Friday 11th
|
||||
assertEquals(11,result.get(Calendar.DAY_OF_MONTH));
|
||||
assertEquals(Calendar.FRIDAY,result.get(Calendar.DAY_OF_WEEK));
|
||||
assertEquals(Calendar.MARCH,result.get(Calendar.MONTH));
|
||||
assertEquals(2011,result.get(Calendar.YEAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testgetNextTimeMonth() throws MessageFormatException {
|
||||
|
||||
|
|
Loading…
Reference in New Issue