aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
authorAmichai Hemli <amichai.hemli@intl.att.com>2020-04-30 10:53:23 +0300
committerIttay Stern <ittay.stern@att.com>2020-05-04 11:00:46 +0000
commit048bd5e527128ab84a2725cd39761648b8ec9c62 (patch)
treee89edffa6c9523726712cb77f85267c05568508b /vid-app-common/src/test
parent80bc6dd4678e2c4057d494ba29c8dd9b0c999abc (diff)
When cloud region is missing then omit the cloudConfiguration object
Issue-ID: VID-820 Signed-off-by: Amichai Hemli <amichai.hemli@intl.att.com> Change-Id: I0780649982c0a1ae0a5bc56da438d422a710e4bf Signed-off-by: Amichai Hemli <amichai.hemli@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java20
1 files changed, 16 insertions, 4 deletions
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<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequest(
Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> supplementaryParams) {
+ return generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(retainAssignments, retainVolumeGroups, supplementaryParams, false);
+ }
+
+ private RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(
+ Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> 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"
);
}
}