use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceStageTest method testTerminateWithNonActiveState.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneStageCaseWithManualActivation.cmmn" })
public void testTerminateWithNonActiveState() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
caseService.withCaseDefinition(caseDefinitionId).create().getId();
CaseExecution stageExecution = queryCaseExecutionByActivityId("PI_Stage_1");
// when
try {
// when
caseService.terminateCaseExecution(stageExecution.getId());
fail("It should not be possible to terminate a task.");
} catch (NotAllowedException e) {
boolean result = e.getMessage().contains("The case execution must be in state 'active' to terminate");
assertTrue(result);
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceCaseTaskTest method testTerminateNonActiveCaseTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCaseWithManualActivation.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testTerminateNonActiveCaseTask() {
// given
createCaseInstance(DEFINITION_KEY);
CaseExecution caseTaskExecution = queryCaseExecutionByActivityId(CASE_TASK_KEY);
try {
// when
caseService.terminateCaseExecution(caseTaskExecution.getId());
fail("It should not be possible to terminate a case task.");
} catch (NotAllowedException e) {
boolean result = e.getMessage().contains("The case execution must be in state 'active' to terminate");
assertTrue(result);
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class RequiredRuleTest method testRequiredRuleEvaluatesToTrue.
@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/required/RequiredRuleTest.testVariableBasedRule.cmmn")
public void testRequiredRuleEvaluatesToTrue() {
CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("required", true));
CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
assertNotNull(taskExecution);
assertTrue(taskExecution.isRequired());
try {
caseService.completeCaseExecution(caseInstance.getId());
fail("completing the containing stage should not be allowed");
} catch (NotAllowedException e) {
// happy path
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class RequiredRuleTest method testDefaultRequiredRuleEvaluatesToTrue.
@Deployment(resources = "org/camunda/bpm/engine/test/cmmn/required/RequiredRuleTest.testDefaultVariableBasedRule.cmmn")
public void testDefaultRequiredRuleEvaluatesToTrue() {
CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", Collections.<String, Object>singletonMap("required", true));
CaseExecution taskExecution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult();
assertNotNull(taskExecution);
assertTrue(taskExecution.isRequired());
try {
caseService.completeCaseExecution(caseInstance.getId());
fail("completing the containing stage should not be allowed");
} catch (NotAllowedException e) {
// happy path
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class SentryEntryCriteriaTest method testCycle.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/sentry/SentryEntryCriteriaTest.testCycle.cmmn" })
public void testCycle() {
// given
createCaseInstance();
CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1");
String firstHumanTaskId = firstHumanTask.getId();
assertTrue(firstHumanTask.isAvailable());
CaseExecution secondHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_2");
String secondHumanTaskId = secondHumanTask.getId();
assertTrue(secondHumanTask.isAvailable());
CaseExecution thirdHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_3");
String thirdHumanTaskId = thirdHumanTask.getId();
assertTrue(thirdHumanTask.isAvailable());
try {
// (1) when
manualStart(firstHumanTaskId);
fail("It should not be possible to start the first human task manually.");
} catch (NotAllowedException e) {
}
try {
// (2) when
manualStart(secondHumanTaskId);
fail("It should not be possible to start the second human task manually.");
} catch (NotAllowedException e) {
}
try {
// (3) when
manualStart(thirdHumanTaskId);
fail("It should not be possible to third the second human task manually.");
} catch (NotAllowedException e) {
}
}
Aggregations