when(mockVariable.getTenantId()).thenReturn(tenantId); when(mockVariable.getCreateTime()).thenReturn(createTime); when(mockVariable.getRemovalTime()).thenReturn(removalTime); when(mockVariable.getRootProcessInstanceId()).thenReturn(rootProcessInstanceId);
@Test public void shouldResolveVariableInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY, Variables.createVariables() .putValue("aVariableName", Variables.stringValue("aVariableValue"))); runtimeService.setVariable(processInstance.getId(), "aVariableName", Variables.stringValue("anotherVariableValue")); HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); // assume assertThat(historicVariableInstance.getRemovalTime(), nullValue()); ClockUtil.setCurrentTime(END_DATE); String taskId = historyService.createHistoricTaskInstanceQuery().singleResult().getId(); // when taskService.complete(taskId); historicVariableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); Date removalTime = addDays(END_DATE, 5); // then assertThat(historicVariableInstance.getRemovalTime(), is(removalTime)); }
@Test public void shouldResolveVariableInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY, Variables.createVariables() .putValue("aVariableName", Variables.stringValue("aVariableValue"))); // when runtimeService.setVariable(processInstance.getId(), "aVariableName", Variables.stringValue("anotherVariableValue")); HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); Date removalTime = addDays(START_DATE, 5); // then assertThat(historicVariableInstance.getRemovalTime(), is(removalTime)); }
public static HistoricVariableInstanceDto fromHistoricVariableInstance(HistoricVariableInstance historicVariableInstance) { HistoricVariableInstanceDto dto = new HistoricVariableInstanceDto(); dto.id = historicVariableInstance.getId(); dto.name = historicVariableInstance.getName(); dto.processDefinitionKey = historicVariableInstance.getProcessDefinitionKey(); dto.processDefinitionId = historicVariableInstance.getProcessDefinitionId(); dto.processInstanceId = historicVariableInstance.getProcessInstanceId(); dto.executionId = historicVariableInstance.getExecutionId(); dto.activityInstanceId = historicVariableInstance.getActivityInstanceId(); dto.caseDefinitionKey = historicVariableInstance.getCaseDefinitionKey(); dto.caseDefinitionId = historicVariableInstance.getCaseDefinitionId(); dto.caseInstanceId = historicVariableInstance.getCaseInstanceId(); dto.caseExecutionId = historicVariableInstance.getCaseExecutionId(); dto.taskId = historicVariableInstance.getTaskId(); dto.tenantId = historicVariableInstance.getTenantId(); dto.state = historicVariableInstance.getState(); dto.createTime = historicVariableInstance.getCreateTime(); dto.removalTime = historicVariableInstance.getRemovalTime(); dto.rootProcessInstanceId = historicVariableInstance.getRootProcessInstanceId(); if(historicVariableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, historicVariableInstance.getTypedValue()); } else { dto.errorMessage = historicVariableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(historicVariableInstance.getTypeName()); } return dto; }
public static HistoricVariableInstanceDto fromHistoricVariableInstance(HistoricVariableInstance historicVariableInstance) { HistoricVariableInstanceDto dto = new HistoricVariableInstanceDto(); dto.id = historicVariableInstance.getId(); dto.name = historicVariableInstance.getName(); dto.processDefinitionKey = historicVariableInstance.getProcessDefinitionKey(); dto.processDefinitionId = historicVariableInstance.getProcessDefinitionId(); dto.processInstanceId = historicVariableInstance.getProcessInstanceId(); dto.executionId = historicVariableInstance.getExecutionId(); dto.activityInstanceId = historicVariableInstance.getActivityInstanceId(); dto.caseDefinitionKey = historicVariableInstance.getCaseDefinitionKey(); dto.caseDefinitionId = historicVariableInstance.getCaseDefinitionId(); dto.caseInstanceId = historicVariableInstance.getCaseInstanceId(); dto.caseExecutionId = historicVariableInstance.getCaseExecutionId(); dto.taskId = historicVariableInstance.getTaskId(); dto.tenantId = historicVariableInstance.getTenantId(); dto.state = historicVariableInstance.getState(); dto.createTime = historicVariableInstance.getCreateTime(); dto.removalTime = historicVariableInstance.getRemovalTime(); dto.rootProcessInstanceId = historicVariableInstance.getRootProcessInstanceId(); if(historicVariableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, historicVariableInstance.getTypedValue()); } else { dto.errorMessage = historicVariableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(historicVariableInstance.getTypeName()); } return dto; }
@Test public void shouldResolveVariableInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY, Variables.createVariables() .putValue("aVariableName", Variables.stringValue("aVariableValue"))); runtimeService.setVariable(processInstance.getId(), "aVariableName", Variables.stringValue("anotherVariableValue")); HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); // assume assertThat(historicVariableInstance.getRemovalTime(), nullValue()); ClockUtil.setCurrentTime(END_DATE); String taskId = historyService.createHistoricTaskInstanceQuery().singleResult().getId(); // when taskService.complete(taskId); historicVariableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); Date removalTime = addDays(END_DATE, 5); // then assertThat(historicVariableInstance.getRemovalTime(), is(removalTime)); }
@Test public void shouldResolveVariableInstance() { // given testRule.deploy(CALLING_PROCESS); testRule.deploy(CALLED_PROCESS); ClockUtil.setCurrentTime(START_DATE); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLING_PROCESS_KEY, Variables.createVariables() .putValue("aVariableName", Variables.stringValue("aVariableValue"))); // when runtimeService.setVariable(processInstance.getId(), "aVariableName", Variables.stringValue("anotherVariableValue")); HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery().singleResult(); Date removalTime = addDays(START_DATE, 5); // then assertThat(historicVariableInstance.getRemovalTime(), is(removalTime)); }
public static HistoricVariableInstanceDto fromHistoricVariableInstance(HistoricVariableInstance historicVariableInstance) { HistoricVariableInstanceDto dto = new HistoricVariableInstanceDto(); dto.id = historicVariableInstance.getId(); dto.name = historicVariableInstance.getName(); dto.processDefinitionKey = historicVariableInstance.getProcessDefinitionKey(); dto.processDefinitionId = historicVariableInstance.getProcessDefinitionId(); dto.processInstanceId = historicVariableInstance.getProcessInstanceId(); dto.executionId = historicVariableInstance.getExecutionId(); dto.activityInstanceId = historicVariableInstance.getActivityInstanceId(); dto.caseDefinitionKey = historicVariableInstance.getCaseDefinitionKey(); dto.caseDefinitionId = historicVariableInstance.getCaseDefinitionId(); dto.caseInstanceId = historicVariableInstance.getCaseInstanceId(); dto.caseExecutionId = historicVariableInstance.getCaseExecutionId(); dto.taskId = historicVariableInstance.getTaskId(); dto.tenantId = historicVariableInstance.getTenantId(); dto.state = historicVariableInstance.getState(); dto.createTime = historicVariableInstance.getCreateTime(); dto.removalTime = historicVariableInstance.getRemovalTime(); dto.rootProcessInstanceId = historicVariableInstance.getRootProcessInstanceId(); if(historicVariableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, historicVariableInstance.getTypedValue()); } else { dto.errorMessage = historicVariableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(historicVariableInstance.getTypeName()); } return dto; }