use of org.onap.so.serviceinstancebeans.ServiceInstancesResponse in project so by onap.
the class ServiceInstancesTest method deleteNetworkInstance.
@Test
public void deleteNetworkInstance() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json")).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("networkResource_Response.json")).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=VNF-API-DEFAULT&action=deleteInstance")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
// expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v7", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb";
ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesResponse in project so by onap.
the class ServiceInstancesTest method deleteNetworkInstanceNoReqParams.
@Test
public void deleteNetworkInstanceNoReqParams() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + "modelName=GR-API-DEFAULT&action=deleteInstance")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
// expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v6", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb";
ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstanceNoReqParams.json"), uri, HttpMethod.DELETE, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesResponse in project so by onap.
the class ServiceInstancesTest method unassignServiceInstance.
@Test
public void unassignServiceInstance() throws IOException {
ServiceRecipe serviceRecipe = new ServiceRecipe();
serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
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/WorkflowActionBB")).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/.*")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(mapper.writeValueAsString(defaultService)).withStatus(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)));
// expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v7", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/unassign";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceUnassign.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesResponse in project so by onap.
the class ServiceInstancesTest method createVfModuleInstanceNoModelCustomization.
@Test
public void createVfModuleInstanceNoModelCustomization() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" + "[?]MODEL_INSTANCE_NAME=test&VNF_RESOURCE_MODEL_UUID=fe6478e4-ea33-3346-ac12-ab121484a3fe")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/3/vfModuleCustomizations")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/search/findFirstByModelCustomizationUUIDAndVfModuleModelUUIDOrderByCreatedDesc[?]" + "MODEL_CUSTOMIZATION_UUID=b4ea86b4-253f-11e7-93ae-92361f002672&MODEL_UUID=066de97e-253e-11e7-93ae-92361f002672")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vfModuleCustomization/2/vfModule")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction" + "[?]vnfComponentType=vfModule&action=createInstance")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVNF_API_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
// expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v6", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules";
ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelCustomization.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
use of org.onap.so.serviceinstancebeans.ServiceInstancesResponse in project so by onap.
the class ServiceInstancesTest method addRelationships.
@Test
public void addRelationships() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
// expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v7", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/addRelationships";
ResponseEntity<String> response = sendRequest(inputStream("/AddRelationships.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
Aggregations