use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testInputSourceExpression.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputSourceExpression.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSourceExpression() {
// given
VariableMap parameters = Variables.createVariables().putValue("aVariable", "abc").putValue("anotherVariable", 999);
// when
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, parameters).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals((long) 1000, variable.getValue());
} else {
fail("Found an unexpected variable: '" + name + "'");
}
}
// complete ////////////////////////////////////////////////////////
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
close(subCaseInstance.getId());
assertProcessEnded(superProcessInstanceId);
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testInputSource.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputSource.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSource() {
// given
VariableMap parameters = Variables.createVariables().putValue("aVariable", "abc").putValue("anotherVariable", 999).putValue("aThirdVariable", "def");
// when
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, parameters).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("abc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '" + name + "'");
}
}
// complete ////////////////////////////////////////////////////////
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
close(subCaseInstance.getId());
assertProcessEnded(superProcessInstanceId);
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testInputSourceAsCompositeExpression.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputSourceAsCompositeExpression.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSourceAsCompositeExpression() {
// given
VariableMap parameters = Variables.createVariables().putValue("aVariable", "abc").putValue("anotherVariable", 999);
// when
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, parameters).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("aVariable".equals(name)) {
assertEquals("aVariable", name);
assertEquals("Prefixabc", variable.getValue());
} else if ("anotherVariable".equals(name)) {
assertEquals("anotherVariable", name);
assertEquals("Prefix" + (long) 1000, variable.getValue());
} else {
fail("Found an unexpected variable: '" + name + "'");
}
}
// complete ////////////////////////////////////////////////////////
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
close(subCaseInstance.getId());
assertProcessEnded(superProcessInstanceId);
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testInputSourceDifferentTarget.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputSourceDifferentTarget.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSourceDifferentTarget() {
// given
VariableMap parameters = Variables.createVariables().putValue("aVariable", "abc").putValue("anotherVariable", 999).putValue("aThirdVariable", "def");
// when
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, parameters).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertFalse(variables.isEmpty());
assertEquals(2, variables.size());
for (VariableInstance variable : variables) {
String name = variable.getName();
if ("myVariable".equals(name)) {
assertEquals("myVariable", name);
assertEquals("abc", variable.getValue());
} else if ("myAnotherVariable".equals(name)) {
assertEquals("myAnotherVariable", name);
assertEquals(999, variable.getValue());
} else {
fail("Found an unexpected variable: '" + name + "'");
}
}
// complete ////////////////////////////////////////////////////////
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
close(subCaseInstance.getId());
assertProcessEnded(superProcessInstanceId);
}
use of org.camunda.bpm.engine.variable.VariableMap in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testInputDifferentBusinessKey.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputDifferentBusinessKey.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputDifferentBusinessKey() {
// given
String myBusinessKey = "myBusinessKey";
String myOwnBusinessKey = "myOwnBusinessKey";
VariableMap variables = Variables.createVariables().putValue(myOwnBusinessKey, myOwnBusinessKey);
// when
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables, myBusinessKey).getId();
// then
String callActivityId = queryExecutionByActivityId(CALL_ACTIVITY_ID).getId();
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
assertEquals(callActivityId, subCaseInstance.getSuperExecutionId());
assertEquals(myOwnBusinessKey, subCaseInstance.getBusinessKey());
// complete ////////////////////////////////////////////////////////
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
close(subCaseInstance.getId());
assertProcessEnded(superProcessInstanceId);
}
Aggregations