use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionTaskTest method testEvaluateDecisionRefTenantIdConstant.
public void testEvaluateDecisionRefTenantIdConstant() {
deployment(CMMN_CONST);
deploymentForTenant(TENANT_ONE, DMN_FILE);
deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TWO);
CaseInstance caseInstance = createCaseInstance(CASE_DEFINITION_KEY);
assertThat((String) caseService.getVariable(caseInstance.getId(), "decisionVar"), is(RESULT_OF_VERSION_ONE));
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class VariableInstanceQueryTest method testQueryByCaseInstanceIds.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseInstanceIds() {
CaseInstance instance1 = caseService.withCaseDefinitionByKey("oneTaskCase").setVariable("aVariableName", "abc").create();
CaseInstance instance2 = caseService.withCaseDefinitionByKey("oneTaskCase").setVariable("anotherVariableName", "xyz").create();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
query.caseInstanceIdIn(instance1.getId(), instance2.getId()).orderByVariableName().asc();
List<VariableInstance> result = query.list();
assertEquals(2, result.size());
for (VariableInstance variableInstance : result) {
if (variableInstance.getName().equals("aVariableName")) {
assertEquals("aVariableName", variableInstance.getName());
assertEquals("abc", variableInstance.getValue());
} else if (variableInstance.getName().equals("anotherVariableName")) {
assertEquals("anotherVariableName", variableInstance.getName());
assertEquals("xyz", variableInstance.getValue());
} else {
fail("Unexpected variable: " + variableInstance.getName());
}
}
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class VariableInstanceQueryTest method testQueryByCaseExecutionIds.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseExecutionIds() {
CaseInstance instance1 = caseService.withCaseDefinitionByKey("oneTaskCase").setVariable("aVariableName", "abc").create();
CaseInstance instance2 = caseService.withCaseDefinitionByKey("oneTaskCase").setVariable("anotherVariableName", "xyz").create();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
query.caseExecutionIdIn(instance1.getId(), instance2.getId()).orderByVariableName().asc();
List<VariableInstance> result = query.list();
assertEquals(2, result.size());
for (VariableInstance variableInstance : result) {
if (variableInstance.getName().equals("aVariableName")) {
assertEquals("aVariableName", variableInstance.getName());
assertEquals("abc", variableInstance.getValue());
} else if (variableInstance.getName().equals("anotherVariableName")) {
assertEquals("anotherVariableName", variableInstance.getName());
assertEquals("xyz", variableInstance.getValue());
} else {
fail("Unexpected variable: " + variableInstance.getName());
}
}
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class VariableInstanceQueryTest method testQueryByCaseActivityInstanceIds.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseActivityInstanceIds() {
CaseInstance instance1 = caseService.withCaseDefinitionByKey("oneTaskCase").setVariable("aVariableName", "abc").create();
CaseInstance instance2 = caseService.withCaseDefinitionByKey("oneTaskCase").setVariable("anotherVariableName", "xyz").create();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
query.activityInstanceIdIn(instance1.getId(), instance2.getId()).orderByVariableName().asc();
List<VariableInstance> result = query.list();
assertEquals(2, result.size());
for (VariableInstance variableInstance : result) {
if (variableInstance.getName().equals("aVariableName")) {
assertEquals("aVariableName", variableInstance.getName());
assertEquals("abc", variableInstance.getValue());
} else if (variableInstance.getName().equals("anotherVariableName")) {
assertEquals("anotherVariableName", variableInstance.getName());
assertEquals("xyz", variableInstance.getValue());
} else {
fail("Unexpected variable: " + variableInstance.getName());
}
}
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testCallCaseOutputAllVariablesTypedToProcess.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputAll.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" })
public void testCallCaseOutputAllVariablesTypedToProcess() {
startProcessInstanceByKey("process");
CaseInstance caseInstance = queryOneTaskCaseInstance();
String variableName = "foo";
String variableName2 = "null";
TypedValue variableValue = Variables.stringValue("bar");
TypedValue variableValue2 = Variables.integerValue(null);
caseService.withCaseExecution(caseInstance.getId()).setVariable(variableName, variableValue).setVariable(variableName2, variableValue2).execute();
complete(caseInstance.getId());
Task task = taskService.createTaskQuery().singleResult();
TypedValue value = runtimeService.getVariableTyped(task.getProcessInstanceId(), variableName);
assertThat(value, is(variableValue));
value = runtimeService.getVariableTyped(task.getProcessInstanceId(), variableName2);
assertThat(value, is(variableValue2));
}
Aggregations