use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class IncidentRestServiceInteractionTest method testResolveUnexistingIncident.
@Test
public void testResolveUnexistingIncident() {
doThrow(new NotFoundException()).when(mockRuntimeService).resolveIncident(anyString());
given().pathParam("id", MockProvider.EXAMPLE_INCIDENT_ID).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).when().delete(SINGLE_INCIDENT_URL);
verify(mockRuntimeService).resolveIncident(MockProvider.EXAMPLE_INCIDENT_ID);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testSetNonExistingJobDefinitionPriority.
@Test
public void testSetNonExistingJobDefinitionPriority() {
String expectedMessage = "expected exception message";
doThrow(new NotFoundException(expectedMessage)).when(mockManagementService).setOverridingJobPriorityForJobDefinition(eq(MockProvider.NON_EXISTING_JOB_DEFINITION_ID), eq(MockProvider.EXAMPLE_JOB_DEFINITION_PRIORITY), anyBoolean());
Map<String, Object> priorityJson = new HashMap<String, Object>();
priorityJson.put("priority", MockProvider.EXAMPLE_JOB_DEFINITION_PRIORITY);
given().pathParam("id", MockProvider.NON_EXISTING_JOB_DEFINITION_ID).contentType(ContentType.JSON).body(priorityJson).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo(expectedMessage)).when().put(JOB_DEFINITION_PRIORITY_URL);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskResourceImpl method complete.
@Override
public void complete(CompleteExternalTaskDto dto) {
ExternalTaskService externalTaskService = engine.getExternalTaskService();
VariableMap variables = VariableValueDto.toMap(dto.getVariables(), engine, objectMapper);
VariableMap localVariables = VariableValueDto.toMap(dto.getLocalVariables(), engine, objectMapper);
try {
externalTaskService.complete(externalTaskId, dto.getWorkerId(), variables, localVariables);
} catch (NotFoundException e) {
throw new RestException(Status.NOT_FOUND, e, "External task with id " + externalTaskId + " does not exist");
} catch (BadUserRequestException e) {
throw new RestException(Status.BAD_REQUEST, e, e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testUnlockNonExistingTask.
@Test
public void testUnlockNonExistingTask() {
doThrow(new NotFoundException()).when(externalTaskService).unlock(any(String.class));
given().pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("External task with id anExternalTaskId does not exist")).when().post(UNLOCK_EXTERNAL_TASK_URL);
verify(externalTaskService).unlock("anExternalTaskId");
verifyNoMoreInteractions(externalTaskService);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testHandleFailureNonExistingTask.
@Test
public void testHandleFailureNonExistingTask() {
doThrow(new NotFoundException()).when(externalTaskService).handleFailure(any(String.class), any(String.class), any(String.class), any(String.class), anyInt(), anyLong());
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("workerId", "aWorkerId");
parameters.put("errorMessage", "anErrorMessage");
parameters.put("retries", 5);
parameters.put("retryTimeout", 12345);
given().contentType(POST_JSON_CONTENT_TYPE).body(parameters).pathParam("id", "anExternalTaskId").then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("type", equalTo(RestException.class.getSimpleName())).body("message", equalTo("External task with id anExternalTaskId does not exist")).when().post(HANDLE_EXTERNAL_TASK_FAILURE_URL);
}
Aggregations