use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class HandleExternalTaskCmd method execute.
@Override
public Void execute(CommandContext commandContext) {
validateInput();
ExternalTaskEntity externalTask = commandContext.getExternalTaskManager().findExternalTaskById(externalTaskId);
EnsureUtil.ensureNotNull(NotFoundException.class, "Cannot find external task with id " + externalTaskId, "externalTask", externalTask);
if (!workerId.equals(externalTask.getWorkerId())) {
throw new BadUserRequestException(getErrorMessageOnWrongWorkerAccess() + "'. It is locked by worker '" + externalTask.getWorkerId() + "'.");
}
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstanceById(externalTask.getProcessInstanceId());
}
execute(externalTask);
return null;
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionTableEvaluationTest method testFailToEvaluateDecisionByIdWithoutTenantId.
public void testFailToEvaluateDecisionByIdWithoutTenantId() {
deployment(DMN_FILE);
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
try {
decisionService.evaluateDecisionTableById(decisionDefinition.getId()).variables(createVariables()).decisionDefinitionWithoutTenantId().evaluate();
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 MultiTenancyDecisionTableEvaluationTest method testFailToEvaluateDecisionByIdWithTenantId.
public void testFailToEvaluateDecisionByIdWithTenantId() {
deploymentForTenant(TENANT_ONE, DMN_FILE);
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
try {
decisionService.evaluateDecisionTableById(decisionDefinition.getId()).variables(createVariables()).decisionDefinitionTenantId(TENANT_ONE).evaluate();
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 MultiTenancyProcessInstantiationTest method testFailToStartProcessInstanceByIdAndTenantId.
public void testFailToStartProcessInstanceByIdAndTenantId() {
deploymentForTenant(TENANT_ONE, PROCESS);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
try {
runtimeService.createProcessInstanceById(processDefinition.getId()).processDefinitionTenantId(TENANT_ONE).execute();
fail("expected 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 MultiTenancyProcessInstantiationTest method testFailToRestartProcessInstanceSyncWithOtherTenantId.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testFailToRestartProcessInstanceSyncWithOtherTenantId() {
// given
ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS);
identityService.setAuthentication("user", null, Collections.singletonList(TENANT_TWO));
try {
// when
runtimeService.restartProcessInstances(processInstance.getProcessDefinitionId()).startBeforeActivity("userTask").processInstanceIds(processInstance.getId()).execute();
fail("expected exception");
} catch (BadUserRequestException e) {
// then
assertThat(e.getMessage(), containsString("Historic process instance cannot be found: historicProcessInstanceId is null"));
}
}
Aggregations