use of org.camunda.bpm.engine.runtime.VariableInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testSetVariableInScopeExplicitUpdate.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testSetVariableInScope.bpmn20.xml")
@Test
public void testSetVariableInScopeExplicitUpdate() {
// when a process instance is started and the task after the subprocess reached
runtimeService.startProcessInstanceByKey("testProcess", Collections.<String, Object>singletonMap("shouldExplicitlyUpdateVariable", true));
// then there should be only the "shouldExplicitlyUpdateVariable" variable
VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().singleResult();
assertNotNull(variableInstance);
assertEquals("shouldExplicitlyUpdateVariable", variableInstance.getName());
}
use of org.camunda.bpm.engine.runtime.VariableInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testChangeToSerializableUsingApi.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testBasicVariableOperations.bpmn20.xml" })
@Test
public void testChangeToSerializableUsingApi() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("aVariable", "test");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskAssigneeProcess", variables);
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery().variableName("aVariable");
VariableInstance variable = query.singleResult();
assertEquals(ValueType.STRING.getName(), variable.getTypeName());
runtimeService.setVariable(processInstance.getId(), "aVariable", new SerializableVariable("foo"));
variable = query.singleResult();
assertEquals(ValueType.OBJECT.getName(), variable.getTypeName());
}
use of org.camunda.bpm.engine.runtime.VariableInstance in project camunda-bpm-platform by camunda.
the class RuntimeServiceTest method testSetVariableInScopeImplicitUpdate.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/RuntimeServiceTest.testSetVariableInScope.bpmn20.xml")
@Test
public void testSetVariableInScopeImplicitUpdate() {
// when a process instance is started and the task after the subprocess reached
runtimeService.startProcessInstanceByKey("testProcess", Collections.<String, Object>singletonMap("shouldExplicitlyUpdateVariable", true));
// then there should be only the "shouldExplicitlyUpdateVariable" variable
VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().singleResult();
assertNotNull(variableInstance);
assertEquals("shouldExplicitlyUpdateVariable", variableInstance.getName());
}
use of org.camunda.bpm.engine.runtime.VariableInstance in project camunda-bpm-platform by camunda.
the class TransientVariableTest method testExclusiveGateway.
@Test
public void testExclusiveGateway() {
// given
testRule.deploy("org/camunda/bpm/engine/test/bpmn/gateway/ExclusiveGatewayTest.testDivergingExclusiveGateway.bpmn20.xml");
// when
runtimeService.startProcessInstanceByKey("exclusiveGwDiverging", Variables.createVariables().putValueTyped("input", Variables.integerValue(1, true)));
// then
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().list();
assertEquals(0, variables.size());
Task task = taskService.createTaskQuery().singleResult();
assertEquals("theTask1", task.getTaskDefinitionKey());
}
use of org.camunda.bpm.engine.runtime.VariableInstance in project camunda-bpm-platform by camunda.
the class TransientVariableTest method testFormFieldsWithCustomTransientFlags.
@Test
public void testFormFieldsWithCustomTransientFlags() {
// given
testRule.deploy("org/camunda/bpm/engine/test/api/form/TransientVariableTest.taskFormFieldsWithTransientFlags.bpmn20.xml");
runtimeService.startProcessInstanceByKey("testProcess");
Task task = taskService.createTaskQuery().singleResult();
// when
Map<String, Object> formValues = new HashMap<String, Object>();
formValues.put("stringField", Variables.stringValue("foobar", true));
formValues.put("longField", 9L);
engineRule.getFormService().submitTaskForm(task.getId(), formValues);
// then
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().list();
assertEquals(1, variables.size());
assertEquals(variables.get(0).getValue(), 9L);
}
Aggregations