Search in sources :

Example 71 with ServiceInstancesResponse

use of org.onap.so.serviceinstancebeans.ServiceInstancesResponse in project so by onap.

the class ServiceInstancesTest method createServiceInstanceServiceInstancesUri.

@Test
public void createServiceInstanceServiceInstancesUri() throws IOException {
    ServiceRecipe serviceRecipe = new ServiceRecipe();
    serviceRecipe.setOrchestrationUri("/mso/async/services/CreateGenericALaCarteServiceInstance");
    serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
    serviceRecipe.setAction(Action.createInstance.toString());
    serviceRecipe.setId(1);
    serviceRecipe.setRecipeTimeout(180);
    Service defaultService = new Service();
    defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
    wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateGenericALaCarteServiceInstance")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
    wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
    wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
    // expect
    ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
    RequestReferences requestReferences = new RequestReferences();
    requestReferences.setInstanceId("1882939");
    requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
    expectedResponse.setRequestReferences(requestReferences);
    uri = servInstanceuri + "v5";
    ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST, headers);
    // then
    assertEquals(404, response.getStatusCode().value());
    ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
}
Also used : Service(org.onap.so.db.catalog.beans.Service) ServiceRecipe(org.onap.so.db.catalog.beans.ServiceRecipe) ServiceInstancesResponse(org.onap.so.serviceinstancebeans.ServiceInstancesResponse) RequestReferences(org.onap.so.serviceinstancebeans.RequestReferences) Test(org.junit.Test)

Aggregations

ServiceInstancesResponse (org.onap.so.serviceinstancebeans.ServiceInstancesResponse)71 RequestReferences (org.onap.so.serviceinstancebeans.RequestReferences)65 Test (org.junit.Test)60 Service (org.onap.so.db.catalog.beans.Service)10 ServiceRecipe (org.onap.so.db.catalog.beans.ServiceRecipe)10 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)8 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)8 Operation (io.swagger.v3.oas.annotations.Operation)5 Transactional (javax.transaction.Transactional)5 Consumes (javax.ws.rs.Consumes)5 DELETE (javax.ws.rs.DELETE)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 ResponseUpdater (org.onap.so.apihandler.filters.ResponseUpdater)5 Recipe (org.onap.so.db.catalog.beans.Recipe)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 IOException (java.io.IOException)4 ApiException (org.onap.so.apihandlerinfra.exceptions.ApiException)4 ValidateException (org.onap.so.apihandlerinfra.exceptions.ValidateException)4 URL (java.net.URL)3