public static HistoricProcessInstance createMockHistoricProcessInstance(String tenantId) { HistoricProcessInstance mock = mock(HistoricProcessInstance.class); when(mock.getId()).thenReturn(EXAMPLE_PROCESS_INSTANCE_ID); when(mock.getBusinessKey()).thenReturn(EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY); when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY); when(mock.getProcessDefinitionName()).thenReturn(EXAMPLE_PROCESS_DEFINITION_NAME); when(mock.getProcessDefinitionVersion()).thenReturn(EXAMPLE_PROCESS_DEFINITION_VERSION); when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID); when(mock.getDeleteReason()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_DELETE_REASON); when(mock.getRemovalTime()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_PROCESS_INSTANCE_REMOVAL_TIME)); when(mock.getEndTime()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_PROCESS_INSTANCE_END_TIME)); when(mock.getStartTime()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_TIME)); when(mock.getDurationInMillis()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_DURATION_MILLIS); when(mock.getStartUserId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_USER_ID); when(mock.getStartActivityId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_START_ACTIVITY_ID); when(mock.getRootProcessInstanceId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_ROOT_PROCESS_INSTANCE_ID); when(mock.getSuperProcessInstanceId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_SUPER_PROCESS_INSTANCE_ID); when(mock.getSuperCaseInstanceId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_SUPER_CASE_INSTANCE_ID); when(mock.getCaseInstanceId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_CASE_INSTANCE_ID); when(mock.getTenantId()).thenReturn(tenantId); when(mock.getState()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_STATE); return mock; }
@Test public void shouldResolveHistoricProcessInstance() { // given ClockUtil.setCurrentTime(START_DATE); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); // when ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .activeActivityIdIn("userTask") .singleResult(); // assume assertThat(historicProcessInstance, notNullValue()); Date removalTime = addDays(START_DATE, 5); // then assertThat(historicProcessInstance.getRemovalTime(), is(removalTime)); }
@Test public void shouldResolveHistoricProcessInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .activeActivityIdIn("userTask") .singleResult(); // assume assertThat(historicProcessInstance.getRemovalTime(), nullValue()); String taskId = historyService.createHistoricTaskInstanceQuery().singleResult().getId(); ClockUtil.setCurrentTime(END_DATE); // when taskService.complete(taskId); historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processDefinitionKey(CALLED_PROCESS_KEY) .singleResult(); Date removalTime = addDays(END_DATE, 5); // then assertThat(historicProcessInstance.getRemovalTime(), is(removalTime)); }
public static HistoricProcessInstanceDto fromHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) { HistoricProcessInstanceDto dto = new HistoricProcessInstanceDto(); dto.id = historicProcessInstance.getId(); dto.businessKey = historicProcessInstance.getBusinessKey(); dto.processDefinitionId = historicProcessInstance.getProcessDefinitionId(); dto.processDefinitionKey = historicProcessInstance.getProcessDefinitionKey(); dto.processDefinitionName = historicProcessInstance.getProcessDefinitionName(); dto.processDefinitionVersion = historicProcessInstance.getProcessDefinitionVersion(); dto.startTime = historicProcessInstance.getStartTime(); dto.endTime = historicProcessInstance.getEndTime(); dto.removalTime = historicProcessInstance.getRemovalTime(); dto.durationInMillis = historicProcessInstance.getDurationInMillis(); dto.startUserId = historicProcessInstance.getStartUserId(); dto.startActivityId = historicProcessInstance.getStartActivityId(); dto.deleteReason = historicProcessInstance.getDeleteReason(); dto.rootProcessInstanceId = historicProcessInstance.getRootProcessInstanceId(); dto.superProcessInstanceId = historicProcessInstance.getSuperProcessInstanceId(); dto.superCaseInstanceId = historicProcessInstance.getSuperCaseInstanceId(); dto.caseInstanceId = historicProcessInstance.getCaseInstanceId(); dto.tenantId = historicProcessInstance.getTenantId(); dto.state = historicProcessInstance.getState(); return dto; }
public static HistoricProcessInstanceDto fromHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) { HistoricProcessInstanceDto dto = new HistoricProcessInstanceDto(); dto.id = historicProcessInstance.getId(); dto.businessKey = historicProcessInstance.getBusinessKey(); dto.processDefinitionId = historicProcessInstance.getProcessDefinitionId(); dto.processDefinitionKey = historicProcessInstance.getProcessDefinitionKey(); dto.processDefinitionName = historicProcessInstance.getProcessDefinitionName(); dto.processDefinitionVersion = historicProcessInstance.getProcessDefinitionVersion(); dto.startTime = historicProcessInstance.getStartTime(); dto.endTime = historicProcessInstance.getEndTime(); dto.removalTime = historicProcessInstance.getRemovalTime(); dto.durationInMillis = historicProcessInstance.getDurationInMillis(); dto.startUserId = historicProcessInstance.getStartUserId(); dto.startActivityId = historicProcessInstance.getStartActivityId(); dto.deleteReason = historicProcessInstance.getDeleteReason(); dto.rootProcessInstanceId = historicProcessInstance.getRootProcessInstanceId(); dto.superProcessInstanceId = historicProcessInstance.getSuperProcessInstanceId(); dto.superCaseInstanceId = historicProcessInstance.getSuperCaseInstanceId(); dto.caseInstanceId = historicProcessInstance.getCaseInstanceId(); dto.tenantId = historicProcessInstance.getTenantId(); dto.state = historicProcessInstance.getState(); return dto; }
@Test public void shouldResolveHistoricProcessInstance() { // given ClockUtil.setCurrentTime(START_DATE); testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); // when ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .activeActivityIdIn("userTask") .singleResult(); // assume assertThat(historicProcessInstance, notNullValue()); Date removalTime = addDays(START_DATE, 5); // then assertThat(historicProcessInstance.getRemovalTime(), is(removalTime)); }
@Test public void shouldResolveHistoricProcessInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .activeActivityIdIn("userTask") .singleResult(); // assume assertThat(historicProcessInstance.getRemovalTime(), nullValue()); String taskId = historyService.createHistoricTaskInstanceQuery().singleResult().getId(); ClockUtil.setCurrentTime(END_DATE); // when taskService.complete(taskId); historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processDefinitionKey(CALLED_PROCESS_KEY) .singleResult(); Date removalTime = addDays(END_DATE, 5); // then assertThat(historicProcessInstance.getRemovalTime(), is(removalTime)); }
public static HistoricProcessInstanceDto fromHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) { HistoricProcessInstanceDto dto = new HistoricProcessInstanceDto(); dto.id = historicProcessInstance.getId(); dto.businessKey = historicProcessInstance.getBusinessKey(); dto.processDefinitionId = historicProcessInstance.getProcessDefinitionId(); dto.processDefinitionKey = historicProcessInstance.getProcessDefinitionKey(); dto.processDefinitionName = historicProcessInstance.getProcessDefinitionName(); dto.processDefinitionVersion = historicProcessInstance.getProcessDefinitionVersion(); dto.startTime = historicProcessInstance.getStartTime(); dto.endTime = historicProcessInstance.getEndTime(); dto.removalTime = historicProcessInstance.getRemovalTime(); dto.durationInMillis = historicProcessInstance.getDurationInMillis(); dto.startUserId = historicProcessInstance.getStartUserId(); dto.startActivityId = historicProcessInstance.getStartActivityId(); dto.deleteReason = historicProcessInstance.getDeleteReason(); dto.rootProcessInstanceId = historicProcessInstance.getRootProcessInstanceId(); dto.superProcessInstanceId = historicProcessInstance.getSuperProcessInstanceId(); dto.superCaseInstanceId = historicProcessInstance.getSuperCaseInstanceId(); dto.caseInstanceId = historicProcessInstance.getCaseInstanceId(); dto.tenantId = historicProcessInstance.getTenantId(); dto.state = historicProcessInstance.getState(); return dto; }