use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ModificationRestServiceInteractionTest method executeModificationWithNullProcessInstanceIdsAsync.
@Test
public void executeModificationWithNullProcessInstanceIdsAsync() {
Map<String, Object> json = new HashMap<String, Object>();
String message = "Process instance ids is null";
doThrow(new BadUserRequestException(message)).when(modificationBuilderMock).executeAsync();
List<Map<String, Object>> instructions = new ArrayList<Map<String, Object>>();
instructions.add(ModificationInstructionBuilder.startAfter().activityId(EXAMPLE_ACTIVITY_ID).getJson());
instructions.add(ModificationInstructionBuilder.startTransition().transitionId("transitionId").getJson());
json.put("instructions", instructions);
given().contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).body("message", is(message)).when().post(EXECUTE_MODIFICATION_ASYNC_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncHistoricQueryBasedWithoutQueryAndWithoutProcessInstanceIds.
@Test
public void testDeleteAsyncHistoricQueryBasedWithoutQueryAndWithoutProcessInstanceIds() {
doThrow(new BadUserRequestException("processInstanceIds is empty")).when(runtimeServiceMock).deleteProcessInstancesAsync(anyListOf(String.class), eq((ProcessInstanceQuery) null), anyString(), anyBoolean(), anyBoolean());
given().contentType(ContentType.JSON).body(new DeleteProcessInstancesDto()).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_HIST_QUERY_URL);
verify(runtimeServiceMock, times(1)).deleteProcessInstancesAsync(new ArrayList<String>(), null, null, false, false);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testSetRetriesByProcessWithNegativeRetries.
@Test
public void testSetRetriesByProcessWithNegativeRetries() {
doThrow(new BadUserRequestException("retries are negative")).when(mockManagementService).setJobRetriesAsync(anyListOf(String.class), any(ProcessInstanceQuery.class), eq(-1));
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put(RETRIES, -1);
HistoricProcessInstanceQueryDto query = new HistoricProcessInstanceQueryDto();
messageBodyJson.put("processInstanceQuery", query);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(SET_JOB_RETRIES_ASYNC_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ProcessInstanceRestServiceInteractionTest method testDeleteAsyncWithBadRequestQuery.
@Test
public void testDeleteAsyncWithBadRequestQuery() {
doThrow(new BadUserRequestException("process instance ids are empty")).when(runtimeServiceMock).deleteProcessInstancesAsync(eq((List<String>) null), eq((ProcessInstanceQuery) null), anyString(), anyBoolean(), anyBoolean());
Map<String, Object> messageBodyJson = new HashMap<String, Object>();
messageBodyJson.put("deleteReason", TEST_DELETE_REASON);
given().contentType(ContentType.JSON).body(messageBodyJson).then().expect().statusCode(Status.BAD_REQUEST.getStatusCode()).when().post(DELETE_PROCESS_INSTANCES_ASYNC_URL);
}
use of org.camunda.bpm.engine.BadUserRequestException in project camunda-bpm-platform by camunda.
the class ResolveIncidentCmd method execute.
@Override
public Void execute(CommandContext commandContext) {
final Incident incident = commandContext.getIncidentManager().findIncidentById(incidentId);
EnsureUtil.ensureNotNull(NotFoundException.class, "Cannot find an incident with id '" + incidentId + "'", "incident", incident);
if (incident.getIncidentType().equals("failedJob") || incident.getIncidentType().equals("failedExternalTask")) {
throw new BadUserRequestException("Cannot resolve an incident of type " + incident.getIncidentType());
}
EnsureUtil.ensureNotNull(BadUserRequestException.class, "", "executionId", incident.getExecutionId());
ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(incident.getExecutionId());
EnsureUtil.ensureNotNull(BadUserRequestException.class, "Cannot find an execution for an incident with id '" + incidentId + "'", "execution", execution);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstance(execution);
}
execution.resolveIncident(incidentId);
return null;
}
Aggregations