@Deployment
public void testHistoricActivityInstanceReceive() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("receiveProcess");
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("receive").singleResult();
assertEquals("receive", historicActivityInstance.getActivityId());
assertEquals("receiveTask", historicActivityInstance.getActivityType());
assertNull(historicActivityInstance.getEndTime());
assertNull(historicActivityInstance.getDurationInMillis());
assertNotNull(historicActivityInstance.getProcessDefinitionId());
assertEquals(processInstance.getId(), historicActivityInstance.getProcessInstanceId());
assertEquals(processInstance.getId(), historicActivityInstance.getExecutionId());
assertNotNull(historicActivityInstance.getStartTime());
// move clock by 1 second
Date now = ClockUtil.getCurrentTime();
ClockUtil.setCurrentTime(new Date(now.getTime() + 1000));
runtimeService.signal(processInstance.getId());
historicActivityInstance = historyService.createHistoricActivityInstanceQuery().activityId("receive").singleResult();
assertEquals("receive", historicActivityInstance.getActivityId());
assertEquals("receiveTask", historicActivityInstance.getActivityType());
assertNotNull(historicActivityInstance.getEndTime());
assertNotNull(historicActivityInstance.getProcessDefinitionId());
assertEquals(processInstance.getId(), historicActivityInstance.getProcessInstanceId());
assertEquals(processInstance.getId(), historicActivityInstance.getExecutionId());
assertNotNull(historicActivityInstance.getStartTime());
assertTrue(historicActivityInstance.getDurationInMillis() >= 1000);
assertTrue(((HistoricActivityInstanceEventEntity)historicActivityInstance).getDurationRaw() >= 1000);
}