06-02-2014 08:02 PM
06-03-2014 02:37 AM
org.activiti.engine.runtime.Clock interface implementations (e.g. org.activiti.engine.impl.util.DefaultClockImpl).06-03-2014 02:27 PM
06-03-2014 03:50 PM
06-04-2014 03:26 AM
@Deployment
public void testSimpleSubProcessWithTimer() {
Date startTime = new Date();
// After staring the process, the task in the subprocess should be active
ProcessInstance pi = runtimeService.startProcessInstanceByKey("simpleSubProcess");
Task subProcessTask = taskService.createTaskQuery()
.processInstanceId(pi.getId())
.singleResult();
assertEquals("Task in subprocess", subProcessTask.getName());
// Setting the clock forward 2 hours 1 second (timer fires in 2 hours) and fire up the job executor
Date escalationTime = new Date(startTime.getTime() + (2 * 60 * 60 * 1000) + 1000);
processEngineConfiguration.getClock().setCurrentTime(escalationTime);
waitForJobExecutorToProcessAllJobs(5000L, 50L);
// The subprocess should be left, and the escalated task should be active
Task escalationTask = taskService.createTaskQuery()
.processInstanceId(pi.getId())
.singleResult();
assertEquals("Fix escalated problem", escalationTask.getName());
// test history
HistoricTaskInstance historicSubProcessTask = historyService.createHistoricTaskInstanceQuery().
taskDefinitionKey("subProcessTask").
singleResult();
assertTrue(historicSubProcessTask.getStartTime().before(new Date(startTime.getTime() + 1000)));
assertTrue(historicSubProcessTask.getEndTime().equals(escalationTime));
HistoricTaskInstance historicEscalationProcessTask = historyService.createHistoricTaskInstanceQuery().
taskDefinitionKey("subProcessTask").
singleResult();
assertTrue(historicEscalationProcessTask.getStartTime().equals(escalationTime));
assertNull(historicSubProcessTask.getEndTime());
}
06-04-2014 05:36 PM
06-05-2014 02:16 AM
org.activiti.engine.impl.util.DefaultClockImpl#getCurrentTime[code] - this is the place from where time is taken by default.
Regards
Martin
10-28-2014 12:58 PM
10-28-2014 05:07 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.