aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CnfWithServiceRelatedInstance.json47
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceCnf_Response.json25
3 files changed, 100 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index b358f26cb2..cb48d007b5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -1132,6 +1132,34 @@ public class ServiceInstancesTest extends BaseTest {
}
@Test
+ public void createCnfInstanceNoALaCarte() 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(".*/service/5df8b6de-2083-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("serviceCnf_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/ff305d54-75b4-431b-adb2-eb6b9e5ff000/cnfs";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/CnfWithServiceRelatedInstance.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"));
+ assertTrue(response.getBody().contains("1882939"));
+ }
+
+ @Test
public void createVfModuleInstance() throws IOException {
wireMockServer.stubFor(get(urlMatching(
"/vfModuleCustomization/search/findFirstByModelCustomizationUUIDOrderByCreatedDesc\\?MODEL_CUSTOMIZATION_UUID=cb82ffd8-252a-11e7-93ae-92361f002671"))
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CnfWithServiceRelatedInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CnfWithServiceRelatedInstance.json
new file mode 100644
index 0000000000..e23c18a866
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CnfWithServiceRelatedInstance.json
@@ -0,0 +1,47 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "cnf",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "cnf..base..module-0",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "test"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "CNFTEST-1",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx",
+ "productFamilyId": "FamilyID"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002672",
+ "modelName": "cnf",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "f78914d9-423b-11e7-93f8-0050569a7967"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": []
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lobName"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceCnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceCnf_Response.json
new file mode 100644
index 0000000000..6df019b98f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceCnf_Response.json
@@ -0,0 +1,25 @@
+{
+ "modelName": "Infra_v10_Service",
+ "description": "MSO aLaCarte CNF",
+ "modelUUID": "5df8b6de-2083-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "9647dfc4-2083-11e7-93ae-92361f002671",
+ "created": "2023-02-08 12:45:39.000",
+ "modelVersion": "2.0",
+ "serviceType": "NA",
+ "serviceRole": "NA",
+ "environmentContext": "Luna",
+ "workloadContext": "Oxygen",
+ "category": null,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672"
+ },
+ "service": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672{?projection}",
+ "templated": true
+ },
+ "vnfCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/vnfCustomizations"
+ }
+ }
+}