use of org.activiti.engine.impl.util.DefaultClockImpl in project Activiti by Activiti.
the class AbstractPlaybackTest method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
Clock clock = new DefaultClockImpl();
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
processEngineConfiguration.setClock(clock);
this.processEngine = (new RecordableProcessEngineFactory((ProcessEngineConfigurationImpl) processEngineConfiguration, listener)).getObject();
}
use of org.activiti.engine.impl.util.DefaultClockImpl in project Activiti by Activiti.
the class CycleBusinessCalendarTest method testSimpleCron.
public void testSimpleCron() throws Exception {
Clock testingClock = new DefaultClockImpl();
CycleBusinessCalendar businessCalendar = new CycleBusinessCalendar(testingClock);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy MM dd - HH:mm");
Date now = simpleDateFormat.parse("2011 03 11 - 17:23");
testingClock.setCurrentTime(now);
Date duedate = businessCalendar.resolveDuedate("0 0 0 1 * ?");
Date expectedDuedate = simpleDateFormat.parse("2011 04 1 - 00:00");
assertEquals(expectedDuedate, duedate);
}
use of org.activiti.engine.impl.util.DefaultClockImpl 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.util.DefaultClockImpl 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.util.DefaultClockImpl 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));
}
Aggregations