use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testCallCaseByVersion.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testCallCaseByVersion.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCallCaseByVersion() {
// given
String cmmnResourceName = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn";
String secondDeploymentId = repositoryService.createDeployment().addClasspathResource(cmmnResourceName).deploy().getId();
String thirdDeploymentId = repositoryService.createDeployment().addClasspathResource(cmmnResourceName).deploy().getId();
assertEquals(3, repositoryService.createCaseDefinitionQuery().count());
String caseDefinitionIdInSecondDeployment = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(ONE_TASK_CASE).deploymentId(secondDeploymentId).singleResult().getId();
// when
String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId();
// then
String callActivityId = queryExecutionByActivityId(CALL_ACTIVITY_ID).getId();
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
assertEquals(callActivityId, subCaseInstance.getSuperExecutionId());
assertEquals(caseDefinitionIdInSecondDeployment, subCaseInstance.getCaseDefinitionId());
// complete ////////////////////////////////////////////////////////
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
close(subCaseInstance.getId());
assertProcessEnded(superProcessInstanceId);
repositoryService.deleteDeployment(secondDeploymentId, true);
repositoryService.deleteDeployment(thirdDeploymentId, true);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity 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.impl.cmmn.entity.runtime.CaseExecutionEntity 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.impl.cmmn.entity.runtime.CaseExecutionEntity 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.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseCallActivityTest method testSubProcessLocalInputSingleVariableExpression.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivity.testSubProcessLocalInputSingleVariableExpression.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testSubProcessLocalInputSingleVariableExpression() {
ProcessInstance processInstance = startProcessInstanceByKey("subProcessLocalInputSingleVariableExpression");
Task beforeCallActivityTask = taskService.createTaskQuery().singleResult();
// when executing the call activity
taskService.complete(beforeCallActivityTask.getId());
// then the local input parameter can be resolved because its source expression variable
// is defined in the call activity's input mapping
CaseExecutionEntity calledInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(calledInstance);
Map<String, Object> calledInstanceVariables = caseService.getVariables(calledInstance.getId());
assertEquals(1, calledInstanceVariables.size());
assertEquals(43L, calledInstanceVariables.get("mappedInputParameter"));
// and completing it
String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId();
complete(humanTaskId);
// and executing a call activity in parameter where the source variable is not mapped by an activity
// input parameter fails
Task beforeSecondCallActivityTask = taskService.createTaskQuery().singleResult();
runtimeService.setVariable(processInstance.getId(), "globalVariable", "42");
try {
taskService.complete(beforeSecondCallActivityTask.getId());
fail("expected exception");
} catch (ProcessEngineException e) {
assertTextPresent("Cannot resolve identifier 'globalVariable'", e.getMessage());
}
}
Aggregations