use of org.activiti.engine.runtime.Clock in project Activiti by Activiti.
the class PlaybackRunTest method recordEvents.
private void recordEvents() {
Clock clock = new DefaultClockImpl();
ProcessEngineConfigurationImpl config = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
config.setClock(clock);
ProcessEngine processEngine = (new RecordableProcessEngineFactory(config, listener)).getObject();
processEngine.getProcessEngineConfiguration().setClock(clock);
processEngine.getRepositoryService().createDeployment().addClasspathResource(THE_SIMPLEST_PROCESS).deploy();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put(TEST_VARIABLE, TEST_VALUE);
processEngine.getRuntimeService().startProcessInstanceByKey(SIMPLEST_PROCESS, BUSINESS_KEY, variables);
checkStatus(processEngine);
EventRecorderTestUtils.closeProcessEngine(processEngine, listener);
ProcessEngines.destroy();
}
use of org.activiti.engine.runtime.Clock in project Activiti by Activiti.
the class DurationHelperTest method shouldNotExceedNumberPeriods.
@Test
public void shouldNotExceedNumberPeriods() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentTime(parse("19700101-00:00:00"));
DurationHelper dh = new DurationHelper("R2/1970-01-01T00:00:00/1970-01-01T00:00:10", testingClock);
testingClock.setCurrentTime(parse("19700101-00:00:15"));
assertEquals(parse("19700101-00:00:20"), dh.getDateAfter());
testingClock.setCurrentTime(parse("19700101-00:00:30"));
assertEquals(parse("19700101-00:00:30"), dh.getDateAfter());
}
use of org.activiti.engine.runtime.Clock in project Activiti by Activiti.
the class DurationHelperTest method daylightSaving23HourDay.
@Test
public void daylightSaving23HourDay() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentCalendar(parseCalendar("20140309-00:00:00", TimeZone.getTimeZone("US/Eastern")));
DurationHelper dh = new DurationHelper("R2/2014-03-09T00:00:00/P1D", testingClock);
assertEquals(parseCalendar("20140310-00:00:00", TimeZone.getTimeZone("US/Eastern")), dh.getCalendarAfter(testingClock.getCurrentCalendar()));
}
use of org.activiti.engine.runtime.Clock in project Activiti by Activiti.
the class DurationHelperTest method daylightSavingFallFirstHour.
@Test
public void daylightSavingFallFirstHour() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentCalendar(parseCalendar("20131103-05:45:00", TimeZone.getTimeZone("UTC")));
Calendar easternTime = testingClock.getCurrentCalendar(TimeZone.getTimeZone("US/Eastern"));
DurationHelper dh = new DurationHelper("R2/2013-11-03T01:45:00-04:00/PT1H", testingClock);
assertEquals(parseCalendar("20131103-06:45:00", TimeZone.getTimeZone("UTC")), dh.getCalendarAfter(easternTime));
}
use of org.activiti.engine.runtime.Clock in project Activiti by Activiti.
the class DurationHelperTest method shouldNotExceedNumberNegative.
@Test
public void shouldNotExceedNumberNegative() throws Exception {
Clock testingClock = new DefaultClockImpl();
testingClock.setCurrentTime(parse("19700101-00:00:00"));
DurationHelper dh = new DurationHelper("R2/PT10S/1970-01-01T00:00:50", testingClock);
testingClock.setCurrentTime(parse("19700101-00:00:20"));
assertEquals(parse("19700101-00:00:30"), dh.getDateAfter());
testingClock.setCurrentTime(parse("19700101-00:00:35"));
assertEquals(parse("19700101-00:00:35"), dh.getDateAfter());
}
Aggregations