diff options
author | Sara Weiss <sara.weiss@intl.att.com> | 2019-11-14 14:23:16 +0200 |
---|---|---|
committer | Sara Weiss <sara.weiss@intl.att.com> | 2019-11-14 14:48:15 +0200 |
commit | fa3fe6f8527d23ed79b9c3f503faf9df81a5eb9d (patch) | |
tree | a75b9d66f5f7ae0ee1e567f42d47d860143218c3 /vid-automation/src/test/java/org/onap | |
parent | 97c88e288f56d30b7a3a49366b933cfadbaacf4c (diff) |
API test ordering for mso vfModules requests
Issue-ID: VID-253
Signed-off-by: Sara Weiss <sara.weiss@intl.att.com>
Change-Id: I9a8594eab3f8e4eacaf503c23f04d1db6b101f90
Diffstat (limited to 'vid-automation/src/test/java/org/onap')
-rw-r--r-- | vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java | 39 |
1 files changed, 39 insertions, 0 deletions
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<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() { @@ -525,6 +546,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), |