Search in sources :

Example 1 with HistoricVariableInstance

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());
}
Also used : HashMap(java.util.HashMap) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 2 with HistoricVariableInstance

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);
}
Also used : HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery) ArrayList(java.util.ArrayList) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance)

Example 3 with HistoricVariableInstance

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;
}
Also used : HistoricVariableInstanceDto(org.camunda.bpm.engine.rest.dto.history.HistoricVariableInstanceDto) HistoricVariableInstanceQuery(org.camunda.bpm.engine.history.HistoricVariableInstanceQuery) ArrayList(java.util.ArrayList) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance)

Example 4 with HistoricVariableInstance

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();
}
Also used : MockHistoricVariableInstanceBuilder(org.camunda.bpm.engine.rest.helper.MockHistoricVariableInstanceBuilder) ArrayList(java.util.ArrayList) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) Matchers.anyString(org.mockito.Matchers.anyString) Matchers.containsString(org.hamcrest.Matchers.containsString) Test(org.junit.Test) AbstractRestServiceTest(org.camunda.bpm.engine.rest.AbstractRestServiceTest)

Example 5 with HistoricVariableInstance

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);
}
Also used : MockHistoricVariableInstanceBuilder(org.camunda.bpm.engine.rest.helper.MockHistoricVariableInstanceBuilder) ArrayList(java.util.ArrayList) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) Test(org.junit.Test) AbstractRestServiceTest(org.camunda.bpm.engine.rest.AbstractRestServiceTest)

Aggregations

HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)88 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)44 Test (org.junit.Test)42 Deployment (org.camunda.bpm.engine.test.Deployment)39 HistoricVariableInstanceQuery (org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)18 Task (org.camunda.bpm.engine.task.Task)17 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)14 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)13 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)12 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)12 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)10 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)10 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)10 HashMap (java.util.HashMap)8 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)8 VariableMap (org.camunda.bpm.engine.variable.VariableMap)8 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)7 Date (java.util.Date)6 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)6 MockHistoricVariableInstanceBuilder (org.camunda.bpm.engine.rest.helper.MockHistoricVariableInstanceBuilder)6