use of org.onap.so.serviceinstancebeans.RequestError in project so by onap.
the class ServiceInstancesTest method deleteInstanceGroupNoPartnerNameHeader.
@Test
public void deleteInstanceGroupNoPartnerNameHeader() throws IOException {
HttpHeaders noPartnerHeaders = new HttpHeaders();
noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4");
noPartnerHeaders.set(REQUESTOR_ID, "xxxxxx");
uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c";
ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders);
// then
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-PartnerName header is specified");
}
use of org.onap.so.serviceinstancebeans.RequestError 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.RequestError in project so by onap.
the class E2EServiceInstancesTest method compareModelWithTargetVersionBadBpelResponse.
@Test
public void compareModelWithTargetVersionBadBpelResponse() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CompareModelofE2EServiceInstance")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY)));
String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/modeldifferences";
ResponseEntity<String> response = sendRequest(inputStream("/CompareModelRequest.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertTrue(realResponse.getServiceException().getText().contains("Request Failed due to BPEL error with HTTP Status"));
}
use of org.onap.so.serviceinstancebeans.RequestError in project so by onap.
the class E2EServiceInstancesTest method updateE2EServiceInstanceJSONMappingError.
@Test
public void updateE2EServiceInstanceJSONMappingError() throws IOException {
String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e";
ResponseEntity<String> response = sendRequest(inputStream("/CompareModelRequest.json"), uri, HttpMethod.PUT);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertTrue(realResponse.getServiceException().getText().contains("Mapping of request to JSON object failed"));
}
use of org.onap.so.serviceinstancebeans.RequestError in project so by onap.
the class E2EServiceInstancesTest method compareModelWithTargetVersionBadRequest.
@Test
public void compareModelWithTargetVersionBadRequest() throws IOException {
String uri = e2eServInstancesUri + "v5/9b9f02c0-298b-458a-bc9c-be3692e4f35e/modeldifferences";
ResponseEntity<String> response = sendRequest(inputStream("/Request.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertTrue(realResponse.getServiceException().getText().contains("Mapping of request to JSON object failed"));
}
Aggregations