summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
authorSara Weiss <sara.weiss@intl.att.com>2019-11-21 14:50:12 +0200
committerIttay Stern <ittay.stern@att.com>2019-11-21 16:12:32 +0200
commit42c41dc30db2d2604a7d6743bd47138b0af521ff (patch)
treec15613063432131dd324c0adc8f1e884c976ec66 /vid-app-common/src/test
parentf7312c11d3aef1684bf211b34092e094336d4b22 (diff)
Replace vfmodule: expect optional retainVolumeGroups param
Issue-ID: VID-603 Signed-off-by: Sara Weiss <sara.weiss@intl.att.com> Signed-off-by: Ittay Stern <ittay.stern@att.com> Change-Id: I392d1e70a7f423128221b2f7a7fc0f8449d8e268
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java10
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java22
3 files changed, 24 insertions, 10 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
index 986f5d0f5..525acf944 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
@@ -320,7 +320,7 @@ public class ResourceCommandTest {
static VfModule createVfModule(Action action) {
return new VfModule(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, false, false, null, null, null, null,
- null);
+ null, null);
}
static Network createNetwork(Action action) {
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 9c0260e85..d6af2ad25 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
@@ -172,20 +172,22 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
vfModuleInfo.setModelVersion("10.0");
return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), "mdt1", null,
"88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, true, null, UUID.randomUUID().toString(), null, null,
- null);
+ null, null);
}
return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), null, null, null,
- instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null, null, null);
+ instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null,
+ null, null, null);
}
protected ModelInfo createVfModuleModelInfo(String modelName, String modelVersion, String modelVersionId, String modelInvariantId, String modelCustomizationId, String modelCustomizationName) {
return createModelInfo("vfModule", modelName, modelVersion, modelVersionId, modelInvariantId, modelCustomizationId, modelCustomizationName);
}
- protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName, String lcpCloudRegionId, String tenantId) {
+ protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName,
+ String lcpCloudRegionId, String tenantId, Boolean retainVolumeGroups) {
return new VfModule( vfModuleModelInfo, instanceName, null, Action.Upgrade.name(), lcpCloudRegionId, null, tenantId,
- null, null, true, null, null, UUID.randomUUID().toString(), null, null, null);
+ null, null, true, null, null, UUID.randomUUID().toString(), null, null, 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 a7e2d553d..036c0fb47 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
@@ -22,6 +22,7 @@ package org.onap.vid.services;
import static com.google.common.collect.Maps.newHashMap;
import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
@@ -610,23 +611,34 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
}
@Test
+ public void generateReplaceVfModuleRequest_whenRetainVolumeGroupIsTrue_rebuildVolumeGroupIsFalse() {
+ assertThat(generatedVfModuleInstantiationRequest(true),
+ jsonPartEquals("requestDetails.requestParameters.rebuildVolumeGroups", false));
+ }
+
+ @Test
public void generateReplaceVfModuleRequest_verifyResultAsExpected() {
String expected = TestUtils.readFileAsString("/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json");
+ assertThat(generatedVfModuleInstantiationRequest(null), jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
+ }
+
+ private RequestDetailsWrapper<VfModuleInstantiationRequestDetails> generatedVfModuleInstantiationRequest(
+ Boolean retainVolumeGroups) {
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");
+ VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8",
+ retainVolumeGroups);
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" );
- RequestDetailsWrapper<VfModuleInstantiationRequestDetails> result =
- msoRequestBuilder.generateVfModuleInstantiationRequest(vfModuleDetails, serviceModelInfo, "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo, "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null,"az2016", "GR_API");
-
- assertThat(result, jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
+ return msoRequestBuilder.generateVfModuleInstantiationRequest(vfModuleDetails, serviceModelInfo, "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo, "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null,
+ "az2016", "GR_API"
+ );
}
} \ No newline at end of file