use of org.activiti.engine.impl.calendar.CycleBusinessCalendar in project Activiti by Activiti.
the class ProcessEngineConfigurationImpl method initBusinessCalendarManager.
public void initBusinessCalendarManager() {
if (businessCalendarManager == null) {
MapBusinessCalendarManager mapBusinessCalendarManager = new MapBusinessCalendarManager();
mapBusinessCalendarManager.addBusinessCalendar(DurationBusinessCalendar.NAME, new DurationBusinessCalendar(this.clock));
mapBusinessCalendarManager.addBusinessCalendar(DueDateBusinessCalendar.NAME, new DueDateBusinessCalendar(this.clock));
mapBusinessCalendarManager.addBusinessCalendar(CycleBusinessCalendar.NAME, new CycleBusinessCalendar(this.clock));
businessCalendarManager = mapBusinessCalendarManager;
}
}
use of org.activiti.engine.impl.calendar.CycleBusinessCalendar 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");
assertThat(duedate).isEqualTo(expectedDuedate);
}
use of org.activiti.engine.impl.calendar.CycleBusinessCalendar in project Activiti by Activiti.
the class MapBusinessCalendarManagerTest method testMapConstructor.
public void testMapConstructor() {
Map<String, BusinessCalendar> calendars = new HashMap<String, BusinessCalendar>(1);
CycleBusinessCalendar calendar = new CycleBusinessCalendar(null);
calendars.put("someKey", calendar);
MapBusinessCalendarManager businessCalendarManager = new MapBusinessCalendarManager(calendars);
assertThat(businessCalendarManager.getBusinessCalendar("someKey").equals(calendar)).isTrue();
}
use of org.activiti.engine.impl.calendar.CycleBusinessCalendar in project Activiti by Activiti.
the class CycleBusinessCalendarTest method testSimpleDuration.
public void testSimpleDuration() throws Exception {
Clock testingClock = new DefaultClockImpl();
CycleBusinessCalendar businessCalendar = new CycleBusinessCalendar(testingClock);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy MM dd - HH:mm");
Date now = simpleDateFormat.parse("2010 06 11 - 17:23");
testingClock.setCurrentTime(now);
Date duedate = businessCalendar.resolveDuedate("R/P2DT5H70M");
Date expectedDuedate = simpleDateFormat.parse("2010 06 13 - 23:33");
assertThat(duedate).isEqualTo(expectedDuedate);
}
Aggregations