use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputSource.
/**
* assertion on variables which are set on manual start - change process definition
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceWithManualActivation.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputSource() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// when
caseService.withCaseExecution(caseTaskId).setVariable("aVariable", "abc").setVariable("anotherVariable", 999).setVariable("aThirdVariable", "def").manualStart();
// 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 ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputAll.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputAll.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputAll() {
// given
VariableMap vars = new VariableMapImpl();
vars.putValue("aVariable", "abc");
vars.putValue("anotherVariable", 999);
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).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 ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testCallCaseByVersion.
/**
* assertions on completion - take manual activation out
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testCallCaseByVersion.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCallCaseByVersion() {
// given
String bpmnResourceName = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn";
String secondDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
String thirdDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
assertEquals(4, repositoryService.createCaseDefinitionQuery().count());
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
String caseDefinitionIdInSecondDeployment = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(ONE_TASK_CASE).deploymentId(secondDeploymentId).singleResult().getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
assertEquals(caseDefinitionIdInSecondDeployment, subCaseInstance.getCaseDefinitionId());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
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 CaseTaskTest method testCallCaseAsConstant.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCallCaseAsConstant() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testCallLatestCase.
/**
* assert on default behaviour - remove manual activation
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testCallLatestCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCallLatestCase() {
// given
String cmmnResourceName = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn";
String deploymentId = repositoryService.createDeployment().addClasspathResource(cmmnResourceName).deploy().getId();
assertEquals(3, repositoryService.createCaseDefinitionQuery().count());
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
String latestCaseDefinitionId = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(ONE_TASK_CASE).latestVersion().singleResult().getId();
// then
CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
String superCaseExecutionId = subCaseInstance.getSuperCaseExecutionId();
CaseExecution superCaseExecution = queryCaseExecutionById(superCaseExecutionId);
assertEquals(caseTaskId, superCaseExecutionId);
assertEquals(superCaseInstanceId, superCaseExecution.getCaseInstanceId());
assertEquals(latestCaseDefinitionId, subCaseInstance.getCaseDefinitionId());
// complete ////////////////////////////////////////////////////////
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertCaseEnded(subCaseInstance.getId());
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
repositoryService.deleteDeployment(deploymentId, true);
}
Aggregations