use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceCaseTaskTest method testReenableAnEnabledCaseTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneCaseTaskCaseWithManualActivation.cmmn" })
public void testReenableAnEnabledCaseTask() {
// given
createCaseInstance(DEFINITION_KEY);
String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK_KEY).getId();
CaseInstance subCaseInstance = queryCaseInstanceByKey(DEFINITION_KEY_2);
assertNull(subCaseInstance);
try {
// when
caseService.withCaseExecution(caseTaskId).reenable();
fail("It should not be possible to re-enable an enabled case task.");
} catch (NotAllowedException e) {
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceCaseInstanceTest method testTerminateNonActiveCaseInstance.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" })
public void testTerminateNonActiveCaseInstance() {
// given:
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
assertNotNull(queryCaseExecutionByActivityId("CasePlanModel_1"));
CaseExecution taskExecution = queryCaseExecutionByActivityId("PI_HumanTask_1");
assertTrue(taskExecution.isEnabled());
caseService.completeCaseExecution(caseInstanceId);
try {
// when
caseService.terminateCaseExecution(caseInstanceId);
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);
}
}
Aggregations