use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testInputAllLocal.
/**
* assert on variable defined during manual start - change process definition
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputAllLocal.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testInputAllLocal() {
// given
createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
// when
caseService.withCaseExecution(caseTaskId).setVariable("aVariable", "abc").setVariableLocal("aLocalVariable", "def").manualStart();
// then only the local variable is mapped to the subCaseInstance
CaseInstance subCaseInstance = queryOneTaskCaseInstance();
List<VariableInstance> variables = runtimeService.createVariableInstanceQuery().caseInstanceIdIn(subCaseInstance.getId()).list();
assertEquals(1, variables.size());
assertEquals("aLocalVariable", variables.get(0).getName());
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testResumeCaseTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testResumeCaseTask() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
suspend(caseTaskId);
CaseInstance subCaseInstance = queryOneTaskCaseInstance();
assertTrue(subCaseInstance.isActive());
// when
resume(caseTaskId);
// then
CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
assertTrue(caseTask.isActive());
subCaseInstance = queryOneTaskCaseInstance();
assertTrue(subCaseInstance.isActive());
// complete ////////////////////////////////////////////////////////
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
terminate(subCaseInstanceId);
close(subCaseInstanceId);
assertCaseEnded(subCaseInstanceId);
terminate(caseTaskId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testNotBlockingCaseTask.
/**
* assert on default behaviour - remove manual activation
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testNotBlockingCaseTask.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testNotBlockingCaseTask() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
// then
CaseInstance subCaseInstance = queryOneTaskCaseInstance();
assertNotNull(subCaseInstance);
CaseExecution caseTask = queryCaseExecutionByActivityId(CASE_TASK);
assertNull(caseTask);
CaseInstance superCaseInstance = caseService.createCaseInstanceQuery().caseDefinitionKey(ONE_CASE_TASK_CASE).singleResult();
assertNotNull(superCaseInstance);
assertTrue(superCaseInstance.isCompleted());
// complete ////////////////////////////////////////////////////////
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
terminate(subCaseInstance.getId());
close(subCaseInstance.getId());
assertProcessEnded(subCaseInstance.getId());
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testSuspendCaseTask.
/**
* assertion on completion - remove manual start
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testSuspendCaseTask() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
CaseInstance subCaseInstance = queryOneTaskCaseInstance();
assertTrue(subCaseInstance.isActive());
// when
suspend(caseTaskId);
subCaseInstance = queryOneTaskCaseInstance();
assertTrue(subCaseInstance.isActive());
// complete ////////////////////////////////////////////////////////
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
terminate(subCaseInstanceId);
close(subCaseInstanceId);
assertCaseEnded(subCaseInstanceId);
terminate(superCaseInstanceId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
use of org.camunda.bpm.engine.runtime.CaseInstance in project camunda-bpm-platform by camunda.
the class CaseTaskTest method testTerminateCaseTask.
/**
* assert on default behaviour - remove manual activation
*/
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCase.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testTerminateCaseTask() {
// given
String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId();
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId();
CaseInstance subCaseInstance = queryOneTaskCaseInstance();
assertTrue(subCaseInstance.isActive());
// when
terminate(caseTaskId);
subCaseInstance = queryOneTaskCaseInstance();
assertTrue(subCaseInstance.isActive());
// complete ////////////////////////////////////////////////////////
String subCaseInstanceId = queryOneTaskCaseInstance().getId();
terminate(subCaseInstanceId);
close(subCaseInstanceId);
assertCaseEnded(subCaseInstanceId);
close(superCaseInstanceId);
assertCaseEnded(superCaseInstanceId);
}
Aggregations