use of org.activiti.engine.impl.calendar.DurationHelper in project Activiti by Activiti.
the class DurationHelperTest method daylightSavingFallObservedSecondHour.
@Test
public void daylightSavingFallObservedSecondHour() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentCalendar(parseCalendar("20131103-00:45:00", TimeZone.getTimeZone("US/Eastern")));
DurationHelper dh = new DurationHelper("R2/2013-11-03T00:45:00-04:00/PT2H", testingClock);
Calendar expected = parseCalendarWithOffset("20131103-01:45:00 -05:00", TimeZone.getTimeZone("US/Eastern"));
assertTrue(expected.compareTo(dh.getCalendarAfter()) == 0);
}
use of org.activiti.engine.impl.calendar.DurationHelper in project Activiti by Activiti.
the class DurationHelperTest method shouldNotExceedNumber.
@Test
public void shouldNotExceedNumber() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentTime(new Date(0));
DurationHelper dh = new DurationHelper("R2/PT10S", testingClock);
testingClock.setCurrentTime(new Date(15000));
assertEquals(20000, dh.getDateAfter().getTime());
testingClock.setCurrentTime(new Date(30000));
assertEquals(30000, dh.getDateAfter().getTime());
}
use of org.activiti.engine.impl.calendar.DurationHelper in project Activiti by Activiti.
the class DurationHelperTest method daylightSavingFallSecondHour.
@Test
public void daylightSavingFallSecondHour() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentCalendar(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")));
Calendar easternTime = testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"));
DurationHelper dh = new DurationHelper("R2/2013-11-03T01:45:00-05:00/PT1H", testingClock);
assertEquals(parseCalendar("20131103-07:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(easternTime));
}
use of org.activiti.engine.impl.calendar.DurationHelper in project Activiti by Activiti.
the class DurationHelperTest method daylightSavingFall.
@Test
public void daylightSavingFall() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentCalendar(parseCalendar("20131103-04:45:00", TimeZone.getTimeZone("UTC")));
DurationHelper dh = new DurationHelper("R2/2013-11-03T00:45:00-04:00/PT1H", testingClock);
assertEquals(parseCalendar("20131103-05:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"))));
testingClock.setCurrentCalendar(parseCalendar("20131103-05:45:00", TimeZone.getTimeZone("UTC")));
assertEquals(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"))));
}
use of org.activiti.engine.impl.calendar.DurationHelper in project Activiti by Activiti.
the class DurationHelperTest method daylightSaving25HourDayEurope.
@Test
public void daylightSaving25HourDayEurope() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentCalendar(parseCalendar("20131027-00:00:00", TimeZone.getTimeZone("Europe/Amsterdam")));
DurationHelper dh = new DurationHelper("R2/2013-10-27T00:00:00/P1D", testingClock);
assertEquals(parseCalendar("20131028-00:00:00", TimeZone.getTimeZone("Europe/Amsterdam")), dh.getCalendarAfter(testingClock.getCurrentCalendar()));
}
Aggregations