use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceHumanTaskTest method testTerminateNonActiveHumanTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" })
public void testTerminateNonActiveHumanTask() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
caseService.withCaseDefinition(caseDefinitionId).create();
CaseExecution taskExecution = queryCaseExecutionByActivityId("PI_HumanTask_1");
try {
// when
caseService.terminateCaseExecution(taskExecution.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 CaseServiceHumanTaskTest method testDisableADisabledHumanTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/twoTaskCase.cmmn" })
public void testDisableADisabledHumanTask() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
caseService.withCaseDefinition(caseDefinitionId).create();
CaseExecutionQuery caseExecutionQuery = caseService.createCaseExecutionQuery();
String caseExecutionId = caseExecutionQuery.activityId("PI_HumanTask_1").singleResult().getId();
// the human task is disabled
caseService.withCaseExecution(caseExecutionId).disable();
try {
// when
caseService.withCaseExecution(caseExecutionId).disable();
fail("It should not be possible to disable a already disabled human task.");
} catch (NotAllowedException e) {
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceProcessTaskTest method testReenableAnEnabledProcessTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCaseWithManualActivation.cmmn" })
public void testReenableAnEnabledProcessTask() {
// given
createCaseInstance(DEFINITION_KEY);
String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK_KEY).getId();
ProcessInstance processInstance = queryProcessInstance();
assertNull(processInstance);
try {
// when
caseService.withCaseExecution(processTaskId).reenable();
fail("It should not be possible to re-enable an enabled process task.");
} catch (NotAllowedException e) {
}
}
use of org.camunda.bpm.engine.exception.NotAllowedException in project camunda-bpm-platform by camunda.
the class CaseServiceProcessTaskTest method testTerminateNonActiveProcessTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCaseWithManualActivation.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testTerminateNonActiveProcessTask() {
// given
createCaseInstance(DEFINITION_KEY);
CaseExecution processTask = queryCaseExecutionByActivityId(PROCESS_TASK_KEY);
assertTrue(processTask.isEnabled());
try {
// when
caseService.terminateCaseExecution(processTask.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 CaseServiceStageTest method testDisableADisabledStage.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskAndOneStageWithManualActivationCase.cmmn" })
public void testDisableADisabledStage() {
// given:
// a deployed case definition
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
// an active case instance
caseService.withCaseDefinition(caseDefinitionId).create();
CaseExecutionQuery caseExecutionQuery = caseService.createCaseExecutionQuery();
String caseExecutionId = caseExecutionQuery.activityId("PI_Stage_1").singleResult().getId();
// the human task is disabled
caseService.withCaseExecution(caseExecutionId).disable();
try {
// when
caseService.withCaseExecution(caseExecutionId).disable();
fail("It should not be possible to disable a already disabled human task.");
} catch (NotAllowedException e) {
}
}
Aggregations