protected static void fromHistoricVariableUpdate(HistoricVariableUpdateDto dto, HistoricVariableUpdate historicVariableUpdate) { dto.revision = historicVariableUpdate.getRevision(); dto.variableName = historicVariableUpdate.getVariableName(); dto.variableInstanceId = historicVariableUpdate.getVariableInstanceId(); if (historicVariableUpdate.getErrorMessage() == null) { try { VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(historicVariableUpdate.getTypedValue()); dto.value = variableValueDto.getValue(); dto.variableType = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); } catch (RuntimeException e) { dto.errorMessage = e.getMessage(); dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName()); } } else { dto.errorMessage = historicVariableUpdate.getErrorMessage(); dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName()); } }
protected static void fromHistoricVariableUpdate(HistoricVariableUpdateDto dto, HistoricVariableUpdate historicVariableUpdate) { dto.revision = historicVariableUpdate.getRevision(); dto.variableName = historicVariableUpdate.getVariableName(); dto.variableInstanceId = historicVariableUpdate.getVariableInstanceId(); if (historicVariableUpdate.getErrorMessage() == null) { try { VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(historicVariableUpdate.getTypedValue()); dto.value = variableValueDto.getValue(); dto.variableType = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); } catch (RuntimeException e) { dto.errorMessage = e.getMessage(); dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName()); } } else { dto.errorMessage = historicVariableUpdate.getErrorMessage(); dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName()); } }
when(mockVariable.getProcessDefinitionId()).thenReturn(processDefinitionId); when(mockVariable.getProcessInstanceId()).thenReturn(processInstanceId); when(mockVariable.getErrorMessage()).thenReturn(errorMessage); when(mockVariable.getRevision()).thenReturn(revision); when(mockVariable.getTime()).thenReturn(DateTimeUtil.parseDate(time));
assertNull(variableUpdate.getErrorMessage());
@Test public void testErrorMessage() { Task newTask = taskService.newTask(); taskService.saveTask(newTask); String variableName = "failingSerializable"; taskService.setVariable(newTask.getId(), variableName, new FailingSerializable()); HistoricDetail result = historyService.createHistoricDetailQuery() .disableBinaryFetching() .variableUpdates() .singleResult(); assertNull(((HistoricVariableUpdate)result).getValue()); assertNotNull(((HistoricVariableUpdate)result).getErrorMessage()); taskService.deleteTask(newTask.getId(), true); }
protected static void fromHistoricVariableUpdate(HistoricVariableUpdateDto dto, HistoricVariableUpdate historicVariableUpdate) { dto.revision = historicVariableUpdate.getRevision(); dto.variableName = historicVariableUpdate.getVariableName(); dto.variableInstanceId = historicVariableUpdate.getVariableInstanceId(); if (historicVariableUpdate.getErrorMessage() == null) { try { VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(historicVariableUpdate.getTypedValue()); dto.value = variableValueDto.getValue(); dto.variableType = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); } catch (RuntimeException e) { dto.errorMessage = e.getMessage(); dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName()); } } else { dto.errorMessage = historicVariableUpdate.getErrorMessage(); dto.variableType = VariableValueDto.toRestApiTypeName(historicVariableUpdate.getTypeName()); } }
assertNull(variableUpdate.getErrorMessage());
@Test public void testErrorMessage() { Task newTask = taskService.newTask(); taskService.saveTask(newTask); String variableName = "failingSerializable"; taskService.setVariable(newTask.getId(), variableName, new FailingSerializable()); HistoricDetail result = historyService.createHistoricDetailQuery() .disableBinaryFetching() .variableUpdates() .singleResult(); assertNull(((HistoricVariableUpdate)result).getValue()); assertNotNull(((HistoricVariableUpdate)result).getErrorMessage()); taskService.deleteTask(newTask.getId(), true); }