use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryExitCriteriaTest method testExitTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testExitTask.cmmn" })
public void testExitTask() {
// given
String caseInstanceId = createCaseInstance().getId();
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isActive());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isActive());
assertNull(caseService.getVariable(caseInstanceId, "exit"));
// (1) when
complete(firstHumanTaskId);
// (2) then
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertNull(secondHumanTask);
Object exitVariable = caseService.getVariable(caseInstanceId, "exit");
assertNotNull(exitVariable);
assertTrue((Boolean) exitVariable);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryExitCriteriaTest method FAILING_testExitOnParentSuspendInsideStage.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testExitOnParentSuspendInsideStage.cmmn" })
public void FAILING_testExitOnParentSuspendInsideStage() {
// given
createCaseInstance();
CaseExecution stage = queryCaseExecutionByActivityId("PI_Stage_1");
String stageId = stage.getId();
manualStart(stageId);
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isEnabled());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isEnabled());
// when
suspend(stageId);
// then
stage = queryCaseExecutionById(stageId);
assertTrue(((CaseExecutionEntity) stage).isSuspended());
firstHumanTask = queryCaseExecutionById(firstHumanTaskId);
assertTrue(((CaseExecutionEntity) firstHumanTask).isSuspended());
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertNull(secondHumanTask);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryExitCriteriaTest method testAndFork.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testAndFork.cmmn" })
public void testAndFork() {
// given
createCaseInstance();
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isActive());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isActive());
CaseExecution thirdHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_3");
String thirdHumanTaskId = thirdHumanTask.getId();
assertTrue(thirdHumanTask.isActive());
// when
complete(firstHumanTaskId);
// then
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertNull(secondHumanTask);
thirdHumanTask = queryCaseExecutionById(thirdHumanTaskId);
assertNull(thirdHumanTask);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryExitCriteriaTest method testAndJoin.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testAndJoin.cmmn" })
public void testAndJoin() {
// given
String caseInstanceId = createCaseInstance().getId();
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isActive());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isActive());
CaseExecution thirdHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_3");
String thirdHumanTaskId = thirdHumanTask.getId();
assertTrue(thirdHumanTask.isActive());
// (1) when
complete(firstHumanTaskId);
// (1) then
thirdHumanTask = queryCaseExecutionById(thirdHumanTaskId);
assertTrue(thirdHumanTask.isActive());
assertNull(caseService.getVariable(caseInstanceId, "exit"));
// (2) when
complete(secondHumanTaskId);
// (2) then
thirdHumanTask = queryCaseExecutionById(thirdHumanTaskId);
assertNull(thirdHumanTask);
Object exitVariable = caseService.getVariable(caseInstanceId, "exit");
assertNotNull(exitVariable);
assertTrue((Boolean) exitVariable);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryExitCriteriaTest method testOrFork.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testOrFork.cmmn" })
public void testOrFork() {
// given
createCaseInstance();
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isActive());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isActive());
CaseExecution thirdHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_3");
String thirdHumanTaskId = thirdHumanTask.getId();
assertTrue(thirdHumanTask.isActive());
// when
caseService.withCaseExecution(firstHumanTaskId).setVariable("value", 80).complete();
// then
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertNotNull(secondHumanTask);
assertTrue(secondHumanTask.isActive());
thirdHumanTask = queryCaseExecutionById(thirdHumanTaskId);
assertNull(thirdHumanTask);
}
Aggregations