use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testHandleBpmnErrorNonExistingTask.
@Test
public void testHandleBpmnErrorNonExistingTask() {
doThrow(new NotFoundException()).when(externalTaskService).handleBpmnError(any(String.class), any(String.class), any(String.class));
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("workerId", "aWorkerId");
parameters.put("errorCode", "errorCode");
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_BPMN_ERROR_URL);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testGetErrorDetailsNonExistingTask.
@Test
public void testGetErrorDetailsNonExistingTask() {
doThrow(new NotFoundException()).when(externalTaskService).getExternalTaskErrorDetails(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().get(GET_EXTERNAL_TASK_ERROR_DETAILS_URL);
verify(externalTaskService).getExternalTaskErrorDetails("anExternalTaskId");
verifyNoMoreInteractions(externalTaskService);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class ExternalTaskRestServiceInteractionTest method testSetPriorityNonExistingTask.
@Test
public void testSetPriorityNonExistingTask() {
doThrow(new NotFoundException()).when(externalTaskService).setPriority(any(String.class), anyInt());
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("priority", "5");
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().put(PRIORITY_EXTERNAL_TASK_URL);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class CaseDefinitionResourceImpl method getCaseDefinition.
@Override
public CaseDefinitionDto getCaseDefinition() {
RepositoryService repositoryService = engine.getRepositoryService();
CaseDefinition definition = null;
try {
definition = repositoryService.getCaseDefinition(caseDefinitionId);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
} catch (NotValidException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
}
return CaseDefinitionDto.fromCaseDefinition(definition);
}
use of org.camunda.bpm.engine.exception.NotFoundException in project camunda-bpm-platform by camunda.
the class DecisionRequirementsDefinitionResourceImpl method getDecisionRequirementsDefinition.
@Override
public DecisionRequirementsDefinitionDto getDecisionRequirementsDefinition() {
RepositoryService repositoryService = engine.getRepositoryService();
DecisionRequirementsDefinition definition = null;
try {
definition = repositoryService.getDecisionRequirementsDefinition(decisionRequirementsDefinitionId);
} catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
} catch (NotValidException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
} catch (ProcessEngineException e) {
throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
}
return DecisionRequirementsDefinitionDto.fromDecisionRequirementsDefinition(definition);
}
Aggregations