Allow platform multi-selection for VNF in modern UI
[vid.git] / vid-automation / src / test / java / org / onap / vid / api / AsyncInstantiationALaCarteApiTest.java
index 9b1dc65..8fe0580 100644 (file)
@@ -409,6 +409,23 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
         }
     }
 
+
+    @Test
+    public void deployServiceAfterDragAndDropVFModule__verifyOrderMsoCalls() {
+        final ImmutableMap<PresetMSOServiceInstanceGen2WithNames.Keys, String> names = ImmutableMap
+            .of(SERVICE_NAME, "serviceInstanceName");
+        String vnfRequestId = UUID.randomUUID().toString();
+        registerPresetsForRetryTest("none", names, vnfRequestId, false);
+
+        final List<String> uuids = createBulkOfInstances(false, 1, names,
+            CREATE_BULK_OF_ALACARTE_NO_TESTAPI_REQUEST_CYPRESS);
+
+        final String jobId = uuids.get(0);
+
+        assertServiceInfoSpecific2(jobId, JobStatus.COMPLETED, names.get(SERVICE_NAME));
+        assertMSOcalledWithOrder();
+    }
+
     @Test
     public void verifyMetricsLogInAsyncInstantiation() {
 
@@ -418,9 +435,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
 
         deploy1ServiceFromCypress__verifyStatusAndMsoCalls_andRetry("none", emptyMap(), emptyMap(), true);
         List<String> logLines =  LoggerFormatTest.getLogLinesAsList(LogName.metrics2019, 200, 1, restTemplate, uri);
-        List<RecordedRequests> requests = retrieveRecordedRequests();
-        List<RecordedRequests> underTestRequests =
-            requests.stream().filter(x->x.path.contains(msoURL)).collect(toList());
+        List<RecordedRequests> underTestRequests = retrieveRecordedRequests();
 
         underTestRequests.forEach(request-> {
             assertThat("X-ONAP-RequestID", request.headers.get("X-ONAP-RequestID"), contains(matchesPattern(UUID_REGEX)));
@@ -430,14 +445,16 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
         });
 
         List<String> allInvocationIds = new LinkedList<>();
-        List<String> allRequestsIds = new LinkedList<>();
+        List<String> allMsoRequestsIds = new LinkedList<>();
 
         underTestRequests.forEach(request->{
             String invocationId = request.headers.get("X-InvocationID").get(0);
             allInvocationIds.add(invocationId);
 
             String requestId = request.headers.get("X-ONAP-RequestID").get(0);
-            allRequestsIds.add(requestId);
+            if (request.path.contains(msoURL)) {
+                allMsoRequestsIds.add(requestId);
+            }
 
             assertThat("request id and invocation id must be found in two rows",
                 logLines,
@@ -459,7 +476,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
 
         //make sure no RequestId is repeated twice
         assertThat("expect all RequestIds to be unique",
-            allRequestsIds, containsInAnyOrder(new HashSet<>(allRequestsIds).toArray()));
+            allMsoRequestsIds, containsInAnyOrder(new HashSet<>(allMsoRequestsIds).toArray()));
 
     }
 
@@ -526,6 +543,24 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
         ));
     }
 
+
+    private void assertMSOcalledWithOrder() {
+
+        List<RecordedRequests> requests = retrieveRecordedRequests();
+
+        String path = "/mso/serviceInstantiation/v7/serviceInstances/.*/vnfs/.*/vfModules";
+        List<String> msoVFModulesRequests =
+            requests.stream().filter(x -> x.path.matches(path)).map(x -> x.body).collect(toList());
+
+        assertThat("request for vfNodule send with position order",
+            msoVFModulesRequests,
+            contains(
+                containsString("2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"),
+                containsString("2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2"),
+                containsString("2017488PasqualeVpe..PASQUALE_vRE_BV..module-1")
+            ));
+    }
+
     private ImmutableList<JobAuditStatus> vidAuditStatusesCompleted(String jobId) {
         return ImmutableList.of(
                 vidAuditStatus(jobId, "PENDING", false),