aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-11-28 09:29:41 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-11-28 09:29:41 +0200
commit4dd3e5767ace67a8ac1979152e55acb4b4034a80 (patch)
treeed772d79c34f170272e701bd317a0389a9eea237 /vid-app-common/src
parentdca4dd56b599c7ae44f8f256bd8ca8e8e05895f2 (diff)
BE unit tests for supplementaryFileParams in vf module upgrade
Issue-ID: VID-603 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: Ic2da23ab699d5b0d218b3bb1f0c0f7f936b0902e
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java31
2 files changed, 27 insertions, 8 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
index d1b76df77..cd66107e2 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
@@ -185,9 +185,9 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
}
protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName,
- String lcpCloudRegionId, String tenantId, Boolean retainAssignments, Boolean retainVolumeGroups) {
+ String lcpCloudRegionId, String tenantId, Boolean retainAssignments, Boolean retainVolumeGroups, Map<String, String> supplementaryParams) {
return new VfModule( vfModuleModelInfo, instanceName, null, Action.Upgrade.name(), lcpCloudRegionId, null, tenantId,
- null, null, true, null, null, UUID.randomUUID().toString(), null, null, retainAssignments, retainVolumeGroups, null);
+ null, supplementaryParams, true, null, null, UUID.randomUUID().toString(), null, null, retainAssignments, retainVolumeGroups, null);
}
protected ModelInfo createVnfModelInfo(boolean isAlacarte) {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
index d2370af5e..cb59129c3 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
@@ -614,7 +614,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
@Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
public void generateReplaceVfModuleRequest_whenRetainAssignmentsProvidedFromFrontend_retainAssignmentsToMsoIsTheSame(boolean retainAssignments) {
- assertThat(generatedVfModuleReplaceRequest(retainAssignments, null),
+ assertThat(generatedVfModuleReplaceRequest(retainAssignments, null, null),
jsonPartEquals("requestDetails.requestParameters.retainAssignments", retainAssignments));
}
@@ -622,21 +622,40 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
public void generateReplaceVfModuleRequest_whenRetainVolumeGroupIsTrue_rebuildVolumeGroupIsFalse() {
boolean retainVolumeGroups = true;
- assertThat(generatedVfModuleReplaceRequest(null, retainVolumeGroups),
+ assertThat(generatedVfModuleReplaceRequest(null, retainVolumeGroups, null),
jsonPartEquals("requestDetails.requestParameters.rebuildVolumeGroups", false));
}
@Test
+ public void generateReplaceVfModuleRequest_whenThereAreSupplementaryParams_thenTheyAreAddToUserParams() {
+
+ String expectedParams = "[{"
+ + " \"vre_a_volume_size_0\" : \"100\","
+ + " \"vmx_int_net_len\" : \"24\","
+ + " \"availability_zone_0\": \"abc\""
+ + " }]";
+
+ Map<String, String> supplementaryParams = ImmutableMap.of(
+ "vre_a_volume_size_0", "100",
+ "vmx_int_net_len", "24",
+ "availability_zone_0", "abc"
+ );
+
+ assertThat(generatedVfModuleReplaceRequest(null, null, supplementaryParams),
+ jsonPartEquals("requestDetails.requestParameters.userParams", expectedParams));
+ }
+
+ @Test
public void generateReplaceVfModuleRequest_verifyResultAsExpected() {
Boolean retainVolumeGroups = null;
Boolean retainAssignments = null;
String expected = TestUtils.readFileAsString("/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json");
- assertThat(generatedVfModuleReplaceRequest(retainAssignments, retainVolumeGroups), jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
+ assertThat(generatedVfModuleReplaceRequest(retainAssignments, retainVolumeGroups, null), jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
}
private RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequest(
- Boolean retainAssignments, Boolean retainVolumeGroups) {
+ Boolean retainAssignments, Boolean retainVolumeGroups, Map<String, String> supplementaryParams) {
when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(true);
when(aaiClient.getCloudOwnerByCloudRegionId("regionOne")).thenReturn("irma-aic");
@@ -644,7 +663,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
"f7a867f2-596b-4f4a-a128-421e825a6190", "newest-model-customization-uuid-vfm","newest-model-customization-name-vfm" );
VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8",
- retainAssignments, retainVolumeGroups);
+ retainAssignments, retainVolumeGroups, supplementaryParams);
ModelInfo serviceModelInfo = createServiceModelInfo("newest-model-name-service", "newest-model-version-service", "newest-model-uuid-service", "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", null, null );
@@ -655,4 +674,4 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
"5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null, "az2016", "GR_API"
);
}
-} \ No newline at end of file
+}