use of org.camunda.bpm.engine.history.HistoricVariableUpdate in project camunda-bpm-platform by camunda.
the class HistoricDetailDto method fromHistoricDetail.
public static HistoricDetailDto fromHistoricDetail(HistoricDetail historicDetail) {
HistoricDetailDto dto = null;
if (historicDetail instanceof HistoricFormField) {
HistoricFormField historicFormField = (HistoricFormField) historicDetail;
dto = HistoricFormFieldDto.fromHistoricFormField(historicFormField);
} else if (historicDetail instanceof HistoricVariableUpdate) {
HistoricVariableUpdate historicVariableUpdate = (HistoricVariableUpdate) historicDetail;
dto = HistoricVariableUpdateDto.fromHistoricVariableUpdate(historicVariableUpdate);
}
dto.id = historicDetail.getId();
dto.processDefinitionKey = historicDetail.getProcessDefinitionKey();
dto.processDefinitionId = historicDetail.getProcessDefinitionId();
dto.processInstanceId = historicDetail.getProcessInstanceId();
dto.activityInstanceId = historicDetail.getActivityInstanceId();
dto.executionId = historicDetail.getExecutionId();
dto.taskId = historicDetail.getTaskId();
dto.caseDefinitionKey = historicDetail.getCaseDefinitionKey();
dto.caseDefinitionId = historicDetail.getCaseDefinitionId();
dto.caseInstanceId = historicDetail.getCaseInstanceId();
dto.caseExecutionId = historicDetail.getCaseExecutionId();
dto.tenantId = historicDetail.getTenantId();
dto.userOperationId = historicDetail.getUserOperationId();
dto.time = historicDetail.getTime();
return dto;
}
use of org.camunda.bpm.engine.history.HistoricVariableUpdate in project camunda-bpm-platform by camunda.
the class ProcessEngineRestServiceTest method testHistoryServiceEngineAccess_HistoricDetailBinaryFile.
@Ignore
@Test
public void testHistoryServiceEngineAccess_HistoricDetailBinaryFile() {
HistoricDetailQuery query = mock(HistoricDetailQuery.class);
HistoricVariableUpdate instance = mock(HistoricVariableUpdate.class);
String filename = "test.txt";
byte[] byteContent = "test".getBytes();
String encoding = "UTF-8";
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).encoding(encoding).create();
when(instance.getTypedValue()).thenReturn(variableValue);
when(query.singleResult()).thenReturn(instance);
when(mockHistoryService.createHistoricDetailQuery()).thenReturn(query);
given().pathParam("name", EXAMPLE_ENGINE_NAME).then().expect().statusCode(Status.OK.getStatusCode()).body(is(equalTo(new String(byteContent)))).and().header("Content-Disposition", "attachment; filename=" + filename).contentType(CoreMatchers.<String>either(equalTo(ContentType.TEXT.toString() + ";charset=UTF-8")).or(equalTo(ContentType.TEXT.toString() + " ;charset=UTF-8"))).when().get(HISTORY_BINARY_DETAIL_URL);
verify(mockHistoryService).createHistoricDetailQuery();
verifyZeroInteractions(processEngine);
}
use of org.camunda.bpm.engine.history.HistoricVariableUpdate in project camunda-bpm-platform by camunda.
the class HistoricDetailRestServiceInteractionTest method testGetBinaryDataForNullFileVariable.
@Test
public void testGetBinaryDataForNullFileVariable() {
String filename = "test.txt";
byte[] byteContent = null;
FileValue variableValue = Variables.fileValue(filename).file(byteContent).mimeType(ContentType.TEXT.toString()).create();
MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();
HistoricVariableUpdate detailMock = builder.typedValue(variableValue).build();
when(historicDetailQueryMock.detailId(detailMock.getId())).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.disableCustomObjectDeserialization()).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.singleResult()).thenReturn(detailMock);
given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_VAR_UPDATE_ID).then().expect().statusCode(Status.OK.getStatusCode()).and().contentType(ContentType.TEXT).and().body(is(equalTo(new String()))).when().get(VARIABLE_INSTANCE_BINARY_DATA_URL);
}
use of org.camunda.bpm.engine.history.HistoricVariableUpdate in project camunda-bpm-platform by camunda.
the class HistoricDetailRestServiceInteractionTest method testGetSingleVariableUpdateSerialized.
@Test
public void testGetSingleVariableUpdateSerialized() {
ObjectValue serializedValue = Variables.serializedObjectValue("a serialized value").serializationDataFormat("aDataFormat").objectTypeName("aTypeName").create();
MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate().typedValue(serializedValue);
HistoricVariableUpdate variableInstanceMock = builder.build();
when(historicDetailQueryMock.detailId(variableInstanceMock.getId())).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.disableCustomObjectDeserialization()).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.singleResult()).thenReturn(variableInstanceMock);
given().pathParam("id", builder.getId()).queryParam("deserializeValue", false).then().expect().statusCode(Status.OK.getStatusCode()).and().body("id", equalTo(builder.getId())).body("variableName", equalTo(builder.getName())).body("variableInstanceId", equalTo(builder.getVariableInstanceId())).body("variableType", equalTo(VariableTypeHelper.toExpectedValueTypeName(builder.getTypedValue().getType()))).body("value", equalTo("a serialized value")).body("valueInfo.serializationDataFormat", equalTo("aDataFormat")).body("valueInfo.objectTypeName", equalTo("aTypeName")).body("processDefinitionKey", equalTo(builder.getProcessDefinitionKey())).body("processDefinitionId", equalTo(builder.getProcessDefinitionId())).body("processInstanceId", equalTo(builder.getProcessInstanceId())).body("errorMessage", equalTo(builder.getErrorMessage())).body("activityInstanceId", equalTo(builder.getActivityInstanceId())).body("revision", equalTo(builder.getRevision())).body("time", equalTo(builder.getTime())).body("taskId", equalTo(builder.getTaskId())).body("executionId", equalTo(builder.getExecutionId())).body("caseDefinitionKey", equalTo(builder.getCaseDefinitionKey())).body("caseDefinitionId", equalTo(builder.getCaseDefinitionId())).body("caseInstanceId", equalTo(builder.getCaseInstanceId())).body("caseExecutionId", equalTo(builder.getCaseExecutionId())).body("tenantId", equalTo(builder.getTenantId())).when().get(HISTORIC_DETAIL_URL);
verify(historicDetailQueryMock, times(1)).disableBinaryFetching();
verify(historicDetailQueryMock, times(1)).disableCustomObjectDeserialization();
}
use of org.camunda.bpm.engine.history.HistoricVariableUpdate in project camunda-bpm-platform by camunda.
the class HistoricDetailRestServiceInteractionTest method testGetSingleVariableInstanceForBinaryVariable.
@Test
public void testGetSingleVariableInstanceForBinaryVariable() {
MockHistoricVariableUpdateBuilder builder = MockProvider.mockHistoricVariableUpdate();
HistoricVariableUpdate detailMock = builder.typedValue(Variables.byteArrayValue(null)).build();
when(historicDetailQueryMock.detailId(detailMock.getId())).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.disableBinaryFetching()).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.disableCustomObjectDeserialization()).thenReturn(historicDetailQueryMock);
when(historicDetailQueryMock.singleResult()).thenReturn(detailMock);
given().pathParam("id", MockProvider.EXAMPLE_HISTORIC_VAR_UPDATE_ID).then().expect().statusCode(Status.OK.getStatusCode()).and().body("id", equalTo(builder.getId())).body("variableName", equalTo(builder.getName())).body("variableInstanceId", equalTo(builder.getVariableInstanceId())).body("variableType", equalTo(VariableTypeHelper.toExpectedValueTypeName(builder.getTypedValue().getType()))).body("value", equalTo(builder.getValue())).body("processDefinitionKey", equalTo(builder.getProcessDefinitionKey())).body("processDefinitionId", equalTo(builder.getProcessDefinitionId())).body("processInstanceId", equalTo(builder.getProcessInstanceId())).body("errorMessage", equalTo(builder.getErrorMessage())).body("activityInstanceId", equalTo(builder.getActivityInstanceId())).body("revision", equalTo(builder.getRevision())).body("time", equalTo(builder.getTime())).body("taskId", equalTo(builder.getTaskId())).body("executionId", equalTo(builder.getExecutionId())).body("caseDefinitionKey", equalTo(builder.getCaseDefinitionKey())).body("caseDefinitionId", equalTo(builder.getCaseDefinitionId())).body("caseInstanceId", equalTo(builder.getCaseInstanceId())).body("caseExecutionId", equalTo(builder.getCaseExecutionId())).body("tenantId", equalTo(builder.getTenantId())).when().get(HISTORIC_DETAIL_URL);
verify(historicDetailQueryMock, times(1)).disableBinaryFetching();
}
Aggregations