aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap
diff options
context:
space:
mode:
authorAmichai Hemli <amichai.hemli@intl.att.com>2020-04-01 02:06:52 +0300
committerIttay Stern <ittay.stern@att.com>2020-04-02 10:52:56 +0300
commit92210925190803f5b4a698cf83de2fb75dbcb79d (patch)
treed7d4b5296140d2ab19ce027f100005d9570a9973 /vid-app-common/src/test/java/org/onap
parent22517acace92de50b38d0943ec8307d90068c768 (diff)
when deleting a vf module from the modern ui verify that correct delete is sent to mSO
Issue-ID: VID-798 Change-Id: I1c8422ccbd15f12b6e516abb6e77229daa65ffe1 Signed-off-by: Amichai Hemli <amichai.hemli@intl.att.com> Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java73
1 files changed, 73 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
index 6b15c879f..c70bbd76a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
@@ -1286,6 +1286,79 @@ public class AsyncInstantiationIntegrationTest extends AsyncInstantiationBaseTes
assertThat(requestCaptor.getValue(), jsonEquals(expectedPayloadToMso).when(IGNORING_ARRAY_ORDER));
}
+ @Test
+ public void whenDeletingVfModule_thenExpectedDeleteRequestSent()
+ {
+ String currentServiceInstanceId = "6196ab1f-2349-4b32-9b6c-cffeb0ccc79c";
+ String currentVnfInstanceId = "d520268f-7489-4662-be59-f81495b3a069";
+ String currentVfModuleInstanceId = "b0732bed-3ddf-43cc-b193-7f18db84e476";
+
+ assertTestPayloadFitsExpectedIds(deleteVfModuleBulkPayload(), currentServiceInstanceId, currentVnfInstanceId, currentVfModuleInstanceId);
+
+ String deleteRequestId = randomUuid();
+ String userId = "az2016";
+
+
+ String expectedMsoDeletePath = "/serviceInstantiation/v7/serviceInstances/"
+ + currentServiceInstanceId + "/vnfs/" + currentVnfInstanceId + "/vfModules/" + currentVfModuleInstanceId;
+
+ when(restMso.restCall(eq(HttpMethod.DELETE), eq(RequestReferencesContainer.class), any(), eq(expectedMsoDeletePath), eq(Optional.of(userId))))
+ .thenReturn(createResponse(202, currentVfModuleInstanceId, deleteRequestId));
+
+ when(restMso.GetForObject(eq("/orchestrationRequests/v7/" + deleteRequestId), eq(AsyncRequestStatus.class)))
+ .thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR),
+ asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR),
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+
+ enableAddCloudOwnerOnMsoRequest();
+
+
+ UUID jobUUID = asyncInstantiationBL.pushBulkJob(deleteVfModuleBulkPayload(), userId).get(0);
+ processJobsCountTimesAndAssertStatus(jobUUID, 20, COMPLETED);
+
+
+ ArgumentCaptor<RequestDetailsWrapper> requestCaptor = ArgumentCaptor.forClass(RequestDetailsWrapper.class);
+ verify(restMso, times(1)).restCall(
+ eq(HttpMethod.DELETE),
+ eq(RequestReferencesContainer.class),
+ requestCaptor.capture(),
+ eq(expectedMsoDeletePath),
+ eq(Optional.of(userId))
+ );
+
+ assertThat(requestCaptor.getValue(), jsonEquals(getDeleteVfModulePayloadToMso()));
+ }
+
+
+ private ServiceInstantiation deleteVfModuleBulkPayload() {
+ return readJsonResourceFileAsObject("/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json", ServiceInstantiation.class);
+ }
+
+ private String getDeleteVfModulePayloadToMso() {
+ return "{ " +
+ " \"requestDetails\": { " +
+ " \"requestInfo\": { " +
+ " \"source\": \"VID\", " +
+ " \"requestorId\": \"az2016\" " +
+ " }, " +
+ " \"modelInfo\": { " +
+ " \"modelType\": \"vfModule\", " +
+ " \"modelName\": \"XbiTestModuleReplace..base_ocg..module-0\", " +
+ " \"modelVersionId\": \"04b21d26-9780-4956-8329-b22b049329f4\", " +
+ " \"modelVersion\": \"1.0\", " +
+ " \"modelInvariantId\": \"d887658e-2a89-4baf-83e2-b189601a1a7c\", " +
+ " \"modelCustomizationName\": \"XbiTestModuleReplace..base_ocg..module-0\", " +
+ " \"modelCustomizationId\": \"3f1f0fcb-8a88-4612-a794-3912613ed9e8\" " +
+ " }, " +
+ " \"cloudConfiguration\": { " +
+ " \"lcpCloudRegionId\": \"olson5a\", " +
+ " \"cloudOwner\": \"irma-aic\", " +
+ " \"tenantId\": \"7ff7b1a4fe954f71ab79d3160ec3eb08\" " +
+ " } " +
+ " } " +
+ "}";
+ }
+
private void assertTestPayloadFitsExpectedIds(ServiceInstantiation upgradeVfModulePayload, String serviceInstanceId,
String vnfInstanceId, String vfModuleInstanceId) {
/*