use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MultiTenancyCreateCaseInstanceTest method testFailToCreateCaseInstanceByIdWithTenantId.
public void testFailToCreateCaseInstanceByIdWithTenantId() {
deploymentForTenant(TENANT_ONE, CMMN_FILE);
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult();
try {
caseService.withCaseDefinition(caseDefinition.getId()).caseDefinitionTenantId(TENANT_ONE).create();
fail("BadUserRequestException exception");
} catch (BadUserRequestException e) {
assertThat(e.getMessage(), containsString("Cannot specify a tenant-id"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MultiTenancyCreateCaseInstanceTest method testFailToCreateCaseInstanceByIdWithoutTenantId.
public void testFailToCreateCaseInstanceByIdWithoutTenantId() {
deployment(CMMN_FILE);
CaseDefinition caseDefinition = repositoryService.createCaseDefinitionQuery().singleResult();
try {
caseService.withCaseDefinition(caseDefinition.getId()).caseDefinitionWithoutTenantId().create();
fail("BadUserRequestException exception");
} catch (BadUserRequestException e) {
assertThat(e.getMessage(), containsString("Cannot specify a tenant-id"));
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMigrateNullSourceDefinition.
@Test
public void testMigrateNullSourceDefinition() {
ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.createMigrationPlan(null, processDefinition.getId()).mapActivities("userTask", "userTask").build();
fail("Should not succeed");
} catch (BadUserRequestException e) {
assertExceptionMessage(e, "Source process definition id is null");
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MigrationPlanCreationTest method testMigrateNullTargetDefinition.
@Test
public void testMigrateNullTargetDefinition() {
ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
try {
runtimeService.createMigrationPlan(processDefinition.getId(), null).mapActivities("userTask", "userTask").build();
fail("Should not succeed");
} catch (BadUserRequestException e) {
assertExceptionMessage(e, "Target process definition id is null");
}
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class CaseExecutionManager method deleteCaseInstance.
public void deleteCaseInstance(String caseInstanceId, String deleteReason, boolean cascade) {
CaseExecutionEntity execution = findCaseExecutionById(caseInstanceId);
if (execution == null) {
throw new BadUserRequestException("No case instance found for id '" + caseInstanceId + "'");
}
CommandContext commandContext = Context.getCommandContext();
commandContext.getTaskManager().deleteTasksByCaseInstanceId(caseInstanceId, deleteReason, cascade);
execution.deleteCascade();
if (cascade) {
Context.getCommandContext().getHistoricCaseInstanceManager().deleteHistoricCaseInstancesByIds(Arrays.asList(caseInstanceId));
}
}
Aggregations