use of org.onap.so.serviceinstancebeans.ServiceException in project so by onap.
the class E2EServiceInstancesTest method deleteE2EServiceInstance.
@Test
public void deleteE2EServiceInstance() throws IOException {
RequestError expectedResponse = new RequestError();
ServiceException exception = new ServiceException();
exception.setMessageId("SVC1000");
exception.setText("No communication to catalog DB null");
expectedResponse.setServiceException(exception);
String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e";
ResponseEntity<String> response = sendRequest(inputStream("/DeleteRequest.json"), uri, HttpMethod.DELETE);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
}
use of org.onap.so.serviceinstancebeans.ServiceException in project so by onap.
the class CloudConfigurationNotFoundMapper method toResponse.
@Override
public Response toResponse(CloudConfigurationNotFoundException e) {
logger.error("Cloud Configuration Not Found", e);
RequestError error = new RequestError();
ServiceException value = new ServiceException();
value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
value.setText(e.getMessage());
error.setServiceException(value);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
}
use of org.onap.so.serviceinstancebeans.ServiceException in project so by onap.
the class RequestConflictMapper method toResponse.
@Override
public Response toResponse(RequestConflictedException e) {
logger.error("Request Conflict Error", e);
RequestError error = new RequestError();
ServiceException value = new ServiceException();
value.setMessageId(ErrorNumbers.SVC_GENERAL_SERVICE_ERROR);
value.setText(e.getMessage());
error.setServiceException(value);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
}
use of org.onap.so.serviceinstancebeans.ServiceException in project so by onap.
the class OrchestrationRequestsTest method testUnlockOrchestrationRequest.
@Test
public void testUnlockOrchestrationRequest() throws Exception {
setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
ObjectMapper mapper = new ObjectMapper();
String requestJSON = new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<String>(requestJSON, headers);
UriComponentsBuilder builder;
ResponseEntity<String> response;
RequestError expectedRequestError;
RequestError actualRequestError;
ServiceException se;
// Test invalid JSON
expectedRequestError = new RequestError();
se = new ServiceException();
se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
se.setText("Orchestration RequestId 0017f68c-eb2d-45bb-b7c7-ec31b37dc349 has a status of UNLOCKED and can not be unlocked");
expectedRequestError.setServiceException(se);
builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v6/0017f68c-eb2d-45bb-b7c7-ec31b37dc349/unlock"));
response = restTemplate.exchange(builder.toUriString(), HttpMethod.POST, entity, String.class);
actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
assertThat(actualRequestError, sameBeanAs(expectedRequestError));
}
use of org.onap.so.serviceinstancebeans.ServiceException in project so by onap.
the class RequestIdFilterTest method getRequestError.
private RequestError getRequestError() throws IOException {
RequestError requestError = new RequestError();
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
ServiceException serviceException = new ServiceException();
serviceException.setMessageId("SVC0002");
serviceException.setText("RequestId: 32807a28-1a14-4b88-b7b3-2950918aa769 already exists in the RequestDB InfraActiveRequests table");
requestError.setServiceException(serviceException);
return requestError;
}
Aggregations