use of org.camunda.bpm.engine.history.HistoricVariableInstance in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testMessageEndEventWithConnector.
@Deployment
public void testMessageEndEventWithConnector() {
String outputParamValue = "someMessageEndOutputValue";
String inputVariableValue = "someMessageEndInputVariableValue";
TestConnector.responseParameters.put("someOutputParameter", outputParamValue);
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("someInputVariable", inputVariableValue);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process_sending_with_connector", vars);
assertProcessEnded(processInstance.getId());
// validate input parameter
assertNotNull(TestConnector.requestParameters.get("reqParam1"));
assertEquals(inputVariableValue, TestConnector.requestParameters.get("reqParam1"));
// validate connector output
HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().variableName("out1").singleResult();
assertNotNull(variable);
assertEquals(outputParamValue, variable.getValue());
}
use of org.camunda.bpm.engine.history.HistoricVariableInstance in project camunda-bpm-platform by camunda.
the class ProcessEngineRestServiceTest method createHistoricVariableInstanceMock.
private void createHistoricVariableInstanceMock() {
List<HistoricVariableInstance> variables = new ArrayList<HistoricVariableInstance>();
HistoricVariableInstance mockInstance = MockProvider.createMockHistoricVariableInstance();
variables.add(mockInstance);
HistoricVariableInstanceQuery mockHistoricVariableInstanceQuery = mock(HistoricVariableInstanceQuery.class);
when(mockHistoricVariableInstanceQuery.list()).thenReturn(variables);
when(mockHistoryService.createHistoricVariableInstanceQuery()).thenReturn(mockHistoricVariableInstanceQuery);
}
use of org.camunda.bpm.engine.history.HistoricVariableInstance in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceRestServiceImpl method queryHistoricVariableInstances.
@Override
public List<HistoricVariableInstanceDto> queryHistoricVariableInstances(HistoricVariableInstanceQueryDto queryDto, Integer firstResult, Integer maxResults, boolean deserializeObjectValues) {
queryDto.setObjectMapper(objectMapper);
HistoricVariableInstanceQuery query = queryDto.toQuery(processEngine);
query.disableBinaryFetching();
if (!deserializeObjectValues) {
query.disableCustomObjectDeserialization();
}
List<HistoricVariableInstance> matchingHistoricVariableInstances;
if (firstResult != null || maxResults != null) {
matchingHistoricVariableInstances = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingHistoricVariableInstances = query.list();
}
List<HistoricVariableInstanceDto> historicVariableInstanceDtoResults = new ArrayList<HistoricVariableInstanceDto>();
for (HistoricVariableInstance historicVariableInstance : matchingHistoricVariableInstances) {
HistoricVariableInstanceDto resultHistoricVariableInstance = HistoricVariableInstanceDto.fromHistoricVariableInstance(historicVariableInstance);
historicVariableInstanceDtoResults.add(resultHistoricVariableInstance);
}
return historicVariableInstanceDtoResults;
}
use of org.camunda.bpm.engine.history.HistoricVariableInstance in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceRestServiceQueryTest method testSerializableVariableInstanceRetrieval.
@Test
public void testSerializableVariableInstanceRetrieval() {
MockHistoricVariableInstanceBuilder builder = MockProvider.mockHistoricVariableInstance().typedValue(MockObjectValue.fromObjectValue(Variables.objectValue("a serialized value").serializationDataFormat(Variables.SerializationDataFormats.JAVA).create()).objectTypeName(String.class.getName()));
List<HistoricVariableInstance> mockInstances = new ArrayList<HistoricVariableInstance>();
mockInstances.add(builder.build());
mockedQuery = setUpMockHistoricVariableInstanceQuery(mockInstances);
given().then().expect().statusCode(Status.OK.getStatusCode()).and().body("[0].type", equalTo(VariableTypeHelper.toExpectedValueTypeName(ValueType.OBJECT))).body("[0].value", equalTo("a serialized value")).body("[0].valueInfo." + SerializableValueType.VALUE_INFO_OBJECT_TYPE_NAME, equalTo(String.class.getName())).body("[0].valueInfo." + SerializableValueType.VALUE_INFO_SERIALIZATION_DATA_FORMAT, equalTo(Variables.SerializationDataFormats.JAVA.getName())).when().get(HISTORIC_VARIABLE_INSTANCE_RESOURCE_URL);
// should not resolve custom objects but existing API requires it
// verify(mockedQuery).disableCustomObjectDeserialization();
verify(mockedQuery, never()).disableCustomObjectDeserialization();
}
use of org.camunda.bpm.engine.history.HistoricVariableInstance in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceRestServiceQueryTest method testSpinVariableInstanceRetrieval.
@Test
public void testSpinVariableInstanceRetrieval() {
MockHistoricVariableInstanceBuilder builder = MockProvider.mockHistoricVariableInstance().typedValue(Variables.serializedObjectValue("aSpinSerializedValue").serializationDataFormat("aDataFormat").objectTypeName("aRootType").create());
List<HistoricVariableInstance> mockInstances = new ArrayList<HistoricVariableInstance>();
mockInstances.add(builder.build());
mockedQuery = setUpMockHistoricVariableInstanceQuery(mockInstances);
given().then().expect().statusCode(Status.OK.getStatusCode()).and().body("size()", is(1)).body("[0].type", equalTo(VariableTypeHelper.toExpectedValueTypeName(ValueType.OBJECT))).body("[0].value", equalTo("aSpinSerializedValue")).body("[0].valueInfo." + SerializableValueType.VALUE_INFO_OBJECT_TYPE_NAME, equalTo("aRootType")).body("[0].valueInfo." + SerializableValueType.VALUE_INFO_SERIALIZATION_DATA_FORMAT, equalTo("aDataFormat")).when().get(HISTORIC_VARIABLE_INSTANCE_RESOURCE_URL);
}
Aggregations