summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2020-01-13 05:50:00 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-13 05:50:00 +0000
commit900cf30dcc6e7932e85b6799ee2e019a48084071 (patch)
tree63543ac069200f85b793532ebadb981539fd0699
parent82d86c14991ffc3de6481fa255951986de3d4108 (diff)
parentd4313c4df202ce4c024dfd65331b324042b2141a (diff)
Merge "Provide literal usePreload=false when usePreload is <null>"
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt7
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/model/RequestParametersVfModuleTest.java49
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java15
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java14
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json1
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json2
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json2
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java1
8 files changed, 75 insertions, 16 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt
index bba4081dd..bf9e41ad9 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt
@@ -103,7 +103,7 @@ data class VfModuleOrVolumeGroupRequestDetails(
open class RequestParametersVfModuleOrVolumeGroup internal constructor(
userParams: List<UserParamTypes>,
- @get:JsonInclude(NON_NULL) val isUsePreload: Boolean?,
+ val isUsePreload: Boolean,
testApi: String?
) : BaseResourceInstantiationRequestDetails.RequestParameters(userParams, testApi)
@@ -111,7 +111,7 @@ class RequestParametersVfModuleOrVolumeGroupInstantiation(
userParams: List<UserParamTypes>,
usePreload: Boolean?,
testApi: String?
-) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi)
+) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload.orFalse(), testApi)
class RequestParametersVfModuleUpgrade(
userParams: List<UserParamTypes>,
@@ -119,7 +119,8 @@ class RequestParametersVfModuleUpgrade(
testApi: String?,
@get:JsonInclude(NON_NULL) val retainAssignments: Boolean?,
@get:JsonInclude(NON_NULL) val rebuildVolumeGroups: Boolean?
-) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload, testApi)
+) : RequestParametersVfModuleOrVolumeGroup(userParams, usePreload.orFalse(), testApi)
class UserParamMap<K, V> : HashMap<K, V>(), UserParamTypes, MutableMap<K, V>
+private fun Boolean?.orFalse(): Boolean = this ?: false
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/model/RequestParametersVfModuleTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/model/RequestParametersVfModuleTest.java
new file mode 100644
index 000000000..e339af094
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/model/RequestParametersVfModuleTest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.mso.model;
+
+import static java.util.Collections.emptyList;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.testng.annotations.Test;
+
+public class RequestParametersVfModuleTest {
+
+ @Test
+ public void RequestParametersVfModuleOrVolumeGroupInstantiation_whenUsePreloadIsNull_thenLiteralFalseIsSerialized() {
+ Boolean usePreload = null;
+ assertThat(
+ new RequestParametersVfModuleOrVolumeGroupInstantiation(emptyList(), usePreload, ""),
+ jsonPartEquals("usePreload", false)
+ );
+ }
+
+ @Test
+ public void RequestParametersVfModuleUpgrade_whenUsePreloadIsNull_thenLiteralFalseIsSerialized() {
+ Boolean usePreload = null;
+ assertThat(
+ new RequestParametersVfModuleUpgrade(emptyList(), usePreload, "", false, false),
+ jsonPartEquals("usePreload", false)
+ );
+ }
+
+}
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 83130fdd9..e2fd38c4a 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
@@ -249,8 +249,10 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
return instanceParams;
}
- protected VfModule createVfModule(String modelName, String modelVersionId, String modelCustomizationId,
- List<Map<String, String>> instanceParams, List<UserParamNameAndValue> supplementaryParams, String instanceName, String volumeGroupInstanceName, boolean isAlacarte) {
+ protected VfModule createVfModule(
+ String modelName, String modelVersionId, String modelCustomizationId,
+ List<Map<String, String>> instanceParams, List<UserParamNameAndValue> supplementaryParams, String instanceName,
+ String volumeGroupInstanceName, boolean isAlacarte, Boolean usePreload) {
ModelInfo vfModuleInfo = new ModelInfo();
vfModuleInfo.setModelType("vfModule");
vfModuleInfo.setModelName(modelName);
@@ -262,7 +264,8 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
vfModuleInfo.setModelInvariantId("22222222-f63c-463e-ba94-286933b895f9");
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,
+ "88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false,
+ usePreload, null, UUID.randomUUID().toString(), null, null,
null, null, null);
}
@@ -349,9 +352,11 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
Map<String, Map<String, VfModule>> vfModules = new HashMap<>();
List<Map<String, String>> instanceParams1 = ImmutableList.of((ImmutableMap.of("vmx_int_net_len", "24")));
- VfModule vfModule1 = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, instanceParams1, emptyList(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vPE_BV_base" : null), null, isAlacarte);
+ VfModule vfModule1 = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME,
+ instanceParams1, emptyList(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vPE_BV_base" : null), null, isAlacarte, true);
List<Map<String, String>> instanceParams2 = ImmutableList.of(vfModuleInstanceParamsMap);
- VfModule vfModule2 = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", VF_MODULE_1_MODEL_VERSION_ID, VF_MODULE_1_MODEL_CUSTOMIZATION_NAME, instanceParams2, emptyList(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion": null), (isUserProvidedNaming ? "myVgName" : null), isAlacarte);
+ VfModule vfModule2 = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", VF_MODULE_1_MODEL_VERSION_ID, VF_MODULE_1_MODEL_CUSTOMIZATION_NAME,
+ instanceParams2, emptyList(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion": null), (isUserProvidedNaming ? "myVgName" : null), isAlacarte, true);
String vfModuleModelName = vfModule1.getModelInfo().getModelName();
vfModules.put(vfModuleModelName, new LinkedHashMap<>());
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 dea9e092e..58a069ba2 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
@@ -350,14 +350,14 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
@DataProvider
public static Object[][] vfModuleRequestDetails(Method test) {
return new Object[][]{
- {"cc3514e3-5a33-55df-13ab-12abad84e7cc", true, "/payload_jsons/vfmodule_instantiation_request.json"},
- {null, true, "/payload_jsons/vfmodule_instantiation_request_without_volume_group.json"},
- {null, false, "/payload_jsons/vfmodule_instantiation_request_without_instance_name.json"}
+ {"cc3514e3-5a33-55df-13ab-12abad84e7cc", true, false, "/payload_jsons/vfmodule_instantiation_request.json"},
+ {null, true, null, "/payload_jsons/vfmodule_instantiation_request_without_volume_group.json"},
+ {null, false, true, "/payload_jsons/vfmodule_instantiation_request_without_instance_name.json"}
};
}
@Test(dataProvider = "vfModuleRequestDetails")
- public void createVfModuleRequestDetails_detailsAreAsExpected(String volumeGroupInstanceId, boolean isUserProvidedNaming, String fileName) throws IOException {
+ public void createVfModuleRequestDetails_detailsAreAsExpected(String volumeGroupInstanceId, boolean isUserProvidedNaming, Boolean usePreload, String fileName) throws IOException {
ModelInfo siModelInfo = createServiceModelInfo();
ModelInfo vnfModelInfo = createVnfModelInfo(true);
@@ -370,7 +370,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
VfModule vfModule = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
"72d9d1cd-f46d-447a-abdb-451d6fb05fa8", instanceParams, supplementaryParams,
- (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion" : null), "myVgName", true);
+ (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion" : null), "myVgName", true, usePreload);
String serviceInstanceId = "aa3514e3-5a33-55df-13ab-12abad84e7aa";
String vnfInstanceId = "bb3514e3-5a33-55df-13ab-12abad84e7bb";
@@ -397,6 +397,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
emptyList(),
"vmxnjr001_AVPN_base_vRE_BV_expansion",
"myVgName",
+ true,
true);
vfModule.getModelInfo().setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff");
vfModule.getModelInfo().setModelVersion("1");
@@ -556,7 +557,8 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
" }" +
" }" +
"}";
- VfModule vfModuleDetails = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, null, emptyList(), "vmxnjr001_AVPN_base_vPE_BV_base", null, true);
+ VfModule vfModuleDetails = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME,
+ null, emptyList(), "vmxnjr001_AVPN_base_vPE_BV_base", null, true, true);
RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> result =
msoRequestBuilder.generateDeleteVfModuleRequest(vfModuleDetails, "az2018");
MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json
index 103985c96..26aa7d70c 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json
@@ -33,6 +33,7 @@
}],
"requestParameters": {
"userParams": [],
+ "usePreload": false,
"testApi": "GR_API"
},
"modelInfo": {
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
index 84dcd730f..e5e3e9fab 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
@@ -58,7 +58,7 @@
}
],
"requestParameters": {
- "usePreload": true,
+ "usePreload": false,
"userParams": [
{
"name": "vre_a_volume_size_0",
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
index 1d0b96eca..87db583e7 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
@@ -49,7 +49,7 @@
}
],
"requestParameters": {
- "usePreload": true,
+ "usePreload": false,
"userParams": [
{
"name": "vre_a_volume_size_0",
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
index e09f973d6..07a782642 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
@@ -67,6 +67,7 @@ public class PresetMSOCreateVfModuleALaCarteE2E extends PresetMSOCreateVfModuleB
+ " }" + addRelatedInstance()
+ " ],"
+ " \"requestParameters\": {"
+ + " \"usePreload\": false,"
+ " \"userParams\": [{"
+ " \"name\": \"param\","
+ " \"value\": \"ABCD\""