diff options
Diffstat (limited to 'vid-app-common/src/test/java')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java | 4 | ||||
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java | 31 |
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 +} |