public List<StringWrapper> values;
}
+ public static class BodyWrapper {
+ public String value;
+ }
+
public static class HttpRequest {
public StringWrapper path;
+ public BodyWrapper body;
public List<RecordedHeaders> headers;
}
public static class RecordedRequests {
public String path;
+ public String body;
public Map<String, List<String>> headers;
- public RecordedRequests(String path, Map<String, List<String>> headers) {
+ public RecordedRequests(String path, String body, Map<String, List<String>> headers) {
this.path = path;
+ this.body = body;
this.headers = headers;
}
List<HttpRequest> rawRequests = retrieveRecordedHttpRequests();
return rawRequests.stream().map(request->new RecordedRequests(
request.path.value,
+ request.body != null && request.body != null ? request.body.value : "",
request.headers.stream().collect(
Collectors.toMap(
x->x.name.value,
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;
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;
}
}
+
+ @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() {
));
}
+
+ 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),
"2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
"instanceName": "mimazepubi",
"lcpCloudRegionId": "hvf6",
+ "position": "2",
"tenantId": "624eb554b0d147c19ff8885341760481",
"rollbackOnFailure": "false",
"sdncPreLoad": false,
"instanceName": "puwesovabe",
"volumeGroupName": "puwesovabe_vol",
"lcpCloudRegionId": "AAIAIC25",
+ "position": "3",
"legacyRegion": "my region",
"tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
"rollbackOnFailure": "true",
"instanceName": "bnmgtrx",
"volumeGroupName": "",
"lcpCloudRegionId": "hvf6",
+ "position": "1",
"tenantId": "624eb554b0d147c19ff8885341760481",
"rollbackOnFailure": "false",
"sdncPreLoad": false,