use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryExitCriteriaTest method FAILING_testExitOnParentResumeInsideStage.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryExitCriteriaTest.testExitOnParentResumeInsideStage.cmmn" })
public void FAILING_testExitOnParentResumeInsideStage() {
// 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());
// (1) when
suspend(stageId);
// (1) then
stage = queryCaseExecutionById(stageId);
assertTrue(((CaseExecutionEntity) stage).isSuspended());
firstHumanTask = queryCaseExecutionById(firstHumanTaskId);
assertTrue(((CaseExecutionEntity) firstHumanTask).isSuspended());
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertTrue(((CaseExecutionEntity) secondHumanTask).isSuspended());
// (2) when
resume(stageId);
// (2) then
stage = queryCaseExecutionById(stageId);
assertTrue(((CaseExecutionEntity) stage).isActive());
firstHumanTask = queryCaseExecutionById(firstHumanTaskId);
assertTrue(firstHumanTask.isEnabled());
secondHumanTask = queryCaseExecutionById(secondHumanTaskId);
assertNull(secondHumanTask);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryVariableOnPartEntryCriteriaTest method testSameVariableOnPartAsEntryAndExitCriteria.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testSameVariableOnPartAsEntryAndExitCriteria.cmmn" })
public void testSameVariableOnPartAsEntryAndExitCriteria() {
caseService.createCaseInstanceByKey("Case_1").getId();
CaseExecution stageExecution = queryCaseExecutionByActivityId("Stage_1");
caseService.setVariable(stageExecution.getId(), "value", 99);
CaseExecution humanTask = queryCaseExecutionByActivityId("HumanTask_1");
// exit criteria not satisfied due to the variable 'value' must be greater than 100
assertTrue(humanTask.isEnabled());
manualStart(humanTask.getId());
caseService.setVariable(stageExecution.getId(), "value", 101);
stageExecution = queryCaseExecutionByActivityId("Stage_1");
assertNull(stageExecution);
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryVariableOnPartEntryCriteriaTest method testNestedScopesWithNullVariableValue.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testSameVariableNameInDifferentScopes.cmmn" })
public void testNestedScopesWithNullVariableValue() {
String caseInstanceId = caseService.createCaseInstanceByKey("Case_1").getId();
String stageExecution1_Id = queryCaseExecutionByActivityId("Stage_1").getId();
// set the variable 'value' in the scope of the case model
caseService.setVariable(caseInstanceId, "value", 99);
// set the variable 'value' in the scope of the stage 1 with null value
caseService.setVariableLocal(stageExecution1_Id, "value", null);
CaseExecution humanTask1 = queryCaseExecutionByActivityId("HumanTask_1");
assertTrue(humanTask1.isAvailable());
CaseExecution humanTask2 = queryCaseExecutionByActivityId("HumanTask_2");
assertTrue(humanTask2.isAvailable());
// update the variable 'value' in the case model scope
caseService.setVariable(caseInstanceId, "value", 102);
// then sentry of HumanTask 1 and HumanTask 2 gets evaluated.
humanTask1 = queryCaseExecutionByActivityId("HumanTask_1");
assertTrue(humanTask1.isEnabled());
humanTask2 = queryCaseExecutionByActivityId("HumanTask_2");
// Sentry attached to HumanTask 2 is not evaluated because a variable 'value' exists in stage 2 even if the value is null
assertFalse(humanTask2.isEnabled());
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryVariableOnPartEntryCriteriaTest method testVariableDelete.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testVariableDelete.cmmn" })
public void testVariableDelete() {
String caseInstanceId = caseService.createCaseInstanceByKey("Case_1").getId();
caseService.removeVariable(caseInstanceId, "variable_1");
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1");
// removing unknown variable would not enable human task
assertFalse(firstHumanTask.isEnabled());
caseService.setVariable(caseInstanceId, "variable_1", "aVariable");
firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1");
assertFalse(firstHumanTask.isEnabled());
caseService.removeVariable(caseInstanceId, "variable_1");
firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1");
assertTrue(firstHumanTask.isEnabled());
}
use of org.camunda.bpm.engine.runtime.CaseExecution in project camunda-bpm-platform by camunda.
the class SentryVariableOnPartEntryCriteriaTest method testMultipleSentryMultipleVariableOnParts.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/variableonpart/SentryVariableOnPartEntryCriteriaTest.testMultipleSentryMultipleVariableOnPart.cmmn" })
public void testMultipleSentryMultipleVariableOnParts() {
String caseInstanceId = caseService.createCaseInstanceByKey("Case_1").getId();
caseService.setVariable(caseInstanceId, "value", 99);
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("HumanTask_1");
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("HumanTask_2");
// Sentry1 would not be satisfied as the value has to be > 100
// Sentry2 would not be satisfied as the humanTask 1 has to completed
assertFalse(secondHumanTask.isEnabled());
manualStart(firstHumanTask.getId());
complete(firstHumanTask.getId());
secondHumanTask = queryCaseExecutionByActivityId("HumanTask_2");
// Sentry1 would not be satisfied as the value has to be > 100
// But, Sentry 2 would be satisfied and enables HumanTask2
assertTrue(secondHumanTask.isEnabled());
}
Aggregations