From 048bd5e527128ab84a2725cd39761648b8ec9c62 Mon Sep 17 00:00:00 2001 From: Amichai Hemli Date: Thu, 30 Apr 2020 10:53:23 +0300 Subject: When cloud region is missing then omit the cloudConfiguration object Issue-ID: VID-820 Signed-off-by: Amichai Hemli Change-Id: I0780649982c0a1ae0a5bc56da438d422a710e4bf Signed-off-by: Amichai Hemli --- .../org/onap/vid/services/MsoRequestBuilderTest.java | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'vid-app-common/src/test/java') 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 71d38b3f8..ef2a6a5fb 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 @@ -659,24 +659,36 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { assertThat(generatedVfModuleReplaceRequest(retainAssignments, retainVolumeGroups, null), jsonEquals(expected).when(IGNORING_ARRAY_ORDER)); } + @Test + public void generateReplaceVfModuleRequestWithoutCloudConfiguration_verifyResultAsExpected() { + String expected = TestUtils.readFileAsString("/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json"); + assertThat(generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(null, null, null, true), jsonNodeAbsent("requestDetails.cloudConfiguration")); + assertThat(generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(null, null, null, true), jsonEquals(expected).whenIgnoringPaths("requestDetails.cloudConfiguration").when(IGNORING_ARRAY_ORDER)); + } + private RequestDetailsWrapper generatedVfModuleReplaceRequest( Boolean retainAssignments, Boolean retainVolumeGroups, List supplementaryParams) { + return generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(retainAssignments, retainVolumeGroups, supplementaryParams, false); + } + + private RequestDetailsWrapper generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration( + Boolean retainAssignments, Boolean retainVolumeGroups, List supplementaryParams, Boolean noHomingData) { when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(true); when(aaiClient.getCloudOwnerByCloudRegionId("regionOne")).thenReturn("irma-aic"); ModelInfo vfModuleModelInfo = createVfModuleModelInfo("newest-model-name-vfm", "newest-model-version-vfm", "newest-model-uuid-vfm", "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, supplementaryParams); + VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", noHomingData? null : "regionOne", noHomingData? null :"0422ffb57ba042c0800a29dc85ca70f8", + 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 ); ModelInfo vnfModelInfo = createVnfModelInfo("newest-model-name-vnf", "newest-model-version-vnf", "newest-model-uuid-vnf", "23122c9b-dd7f-483f-bf0a-e069303db2f7", "newest-model-customization-uuid-vnf", "newest-model-customization-name-vnf" ); return msoRequestBuilder.generateVfModuleReplaceRequest(vfModuleDetails, serviceModelInfo, - "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo, - "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null, "az2016", "GR_API" + "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo, + "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null, "az2016", "GR_API" ); } } -- cgit 1.2.3-korg