Search in sources :

Example 21 with VariableMapImpl

use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.

the class AbstractVariableScope method getVariablesTyped.

public VariableMapImpl getVariablesTyped(boolean deserializeValues) {
    VariableMapImpl variableMap = new VariableMapImpl();
    collectVariables(variableMap, null, false, deserializeValues);
    return variableMap;
}
Also used : VariableMapImpl(org.camunda.bpm.engine.variable.impl.VariableMapImpl)

Example 22 with VariableMapImpl

use of org.camunda.bpm.engine.variable.impl.VariableMapImpl in project camunda-bpm-platform by camunda.

the class ProcessDefinitionRestServiceInteractionTest method testProcessInstantiationWithTransientVariables.

@Test
public void testProcessInstantiationWithTransientVariables() throws IOException {
    Map<String, Object> json = new HashMap<String, Object>();
    json.put("variables", VariablesBuilder.create().variableTransient("foo", "bar", "string").getVariables());
    final VariableMap varMap = new VariableMapImpl();
    when(mockInstantiationBuilder.setVariables(anyMapOf(String.class, Object.class))).thenAnswer(new Answer<ProcessInstantiationBuilder>() {

        @Override
        public ProcessInstantiationBuilder answer(InvocationOnMock invocation) throws Throwable {
            varMap.putAll((VariableMap) invocation.getArguments()[0]);
            return mockInstantiationBuilder;
        }
    });
    given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.getStatusCode()).body("id", equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)).when().post(START_PROCESS_INSTANCE_URL);
    VariableMap expectedVariables = Variables.createVariables().putValueTyped("foo", Variables.stringValue("bar", true));
    verify(runtimeServiceMock).createProcessInstanceById(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID));
    verify(mockInstantiationBuilder).setVariables(expectedVariables);
    assertEquals(expectedVariables.getValueTyped("foo").isTransient(), varMap.getValueTyped("foo").isTransient());
    verify(mockInstantiationBuilder).executeWithVariablesInReturn(anyBoolean(), anyBoolean());
}
Also used : VariableMapImpl(org.camunda.bpm.engine.variable.impl.VariableMapImpl) VariableMap(org.camunda.bpm.engine.variable.VariableMap) InvocationOnMock(org.mockito.invocation.InvocationOnMock) Matchers.anyString(org.mockito.Matchers.anyString) ProcessInstantiationBuilder(org.camunda.bpm.engine.runtime.ProcessInstantiationBuilder) Test(org.junit.Test)

Aggregations

VariableMapImpl (org.camunda.bpm.engine.variable.impl.VariableMapImpl)22 VariableMap (org.camunda.bpm.engine.variable.VariableMap)15 CaseExecutionEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity)7 Deployment (org.camunda.bpm.engine.test.Deployment)7 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)4 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)3 HistoryService (org.camunda.bpm.engine.HistoryService)2 FormField (org.camunda.bpm.engine.form.FormField)2 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)2 Field (java.lang.reflect.Field)1 ProcessVariable (org.camunda.bpm.engine.cdi.annotation.ProcessVariable)1 ProcessVariableTyped (org.camunda.bpm.engine.cdi.annotation.ProcessVariableTyped)1 StartFormData (org.camunda.bpm.engine.form.StartFormData)1 TaskFormData (org.camunda.bpm.engine.form.TaskFormData)1 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)1 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)1 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)1 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)1 HistoricDetailQueryImpl (org.camunda.bpm.engine.impl.HistoricDetailQueryImpl)1