From fa3fe6f8527d23ed79b9c3f503faf9df81a5eb9d Mon Sep 17 00:00:00 2001 From: Sara Weiss Date: Thu, 14 Nov 2019 14:23:16 +0200 Subject: API test ordering for mso vfModules requests Issue-ID: VID-253 Signed-off-by: Sara Weiss Change-Id: I9a8594eab3f8e4eacaf503c23f04d1db6b101f90 --- .../vid/api/AsyncInstantiationALaCarteApiTest.java | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'vid-automation/src/test/java/org') diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java index 25b40ed6b..92d3f79c8 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java @@ -1,12 +1,14 @@ package org.onap.vid.api; import static java.util.Collections.emptyMap; +import static java.util.stream.Collectors.toList; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.containsInRelativeOrder; import static org.hamcrest.Matchers.matchesPattern; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_INSTANCE_ID; @@ -18,12 +20,14 @@ import static vid.automation.test.services.SimulatorApi.retrieveRecordedRequests import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; + import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.UUID; + import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; @@ -408,6 +412,23 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { } } + + @Test + public void deployServiceAfterDragAndDropVFModule__verifyOrderMsoCalls() { + final ImmutableMap names = ImmutableMap + .of(SERVICE_NAME, "serviceInstanceName"); + String vnfRequestId = UUID.randomUUID().toString(); + registerPresetsForRetryTest("none", names, vnfRequestId, false); + + final List 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() { @@ -525,6 +546,24 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { )); } + + private void assertMSOcalledWithOrder() { + + List requests = retrieveRecordedRequests(); + + String path = "/mso/serviceInstantiation/v7/serviceInstances/.*/vnfs/.*/vfModules"; + List 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 vidAuditStatusesCompleted(String jobId) { return ImmutableList.of( vidAuditStatus(jobId, "PENDING", false), -- cgit 1.2.3-korg