use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceImpl method setRetries.
@Override
public void setRetries(SetRetriesForExternalTasksDto retriesDto) {
UpdateExternalTaskRetriesBuilder builder = updateRetries(retriesDto);
int retries = retriesDto.getRetries();
try {
builder.set(retries);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceInteractionTest method testGetDeployedStartFormWithUnexistingForm.
@Test
public void testGetDeployedStartFormWithUnexistingForm() {
String message = "not found";
when(formServiceMock.getDeployedStartForm(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).thenThrow(new NotFoundException(message));
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).body("message", equalTo(message)).when().get(DEPLOYED_START_FORM_URL);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceInteractionTest method testDeleteDefinitionsByKeyNotExistingKey.
@Test
public void testDeleteDefinitionsByKeyNotExistingKey() {
DeleteProcessDefinitionsBuilder builder = repositoryServiceMock.deleteProcessDefinitions().byKey("NOT_EXISTING_KEY");
doThrow(new NotFoundException("No process definition found with key 'NOT_EXISTING_KEY'")).when(builder).delete();
given().pathParam("key", "NOT_EXISTING_KEY").expect().statusCode(Status.NOT_FOUND.getStatusCode()).body(containsString("No process definition found with key 'NOT_EXISTING_KEY'")).when().delete(SINGLE_PROCESS_DEFINITION_BY_KEY_DELETE_URL);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceInteractionTest method testEvaluateDecisionByKey_NotFound.
@Test
public void testEvaluateDecisionByKey_NotFound() {
String message = "expected message";
when(decisionEvaluationBuilderMock.evaluate()).thenThrow(new NotFoundException(message));
Map<String, Object> json = new HashMap<String, Object>();
json.put("variables", Collections.emptyMap());
given().pathParam("key", MockProvider.EXAMPLE_DECISION_DEFINITION_KEY).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", is(InvalidRequestException.class.getSimpleName())).body("message", containsString(message)).when().post(EVALUATE_DECISION_BY_KEY_URL);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class JobRestServiceInteractionTest method testSetJobPriorityNonExistentJob.
@Test
public void testSetJobPriorityNonExistentJob() {
String expectedMessage = "No job found with id '" + MockProvider.NON_EXISTING_JOB_ID + "'.";
doThrow(new NotFoundException(expectedMessage)).when(mockManagementService).setJobPriority(MockProvider.NON_EXISTING_JOB_ID, MockProvider.EXAMPLE_JOB_PRIORITY);
Map<String, Object> priorityJson = new HashMap<String, Object>();
priorityJson.put("priority", MockProvider.EXAMPLE_JOB_PRIORITY);
given().pathParam("id", MockProvider.NON_EXISTING_JOB_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_RESOURCE_SET_PRIORITY_URL);
verify(mockManagementService).setJobPriority(MockProvider.NON_EXISTING_JOB_ID, MockProvider.EXAMPLE_JOB_PRIORITY);
}
Aggregations