summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
authorwsliwka <wojciech.sliwka@nokia.com>2019-09-17 14:31:42 +0200
committerwsliwka <wojciech.sliwka@nokia.com>2019-09-19 10:26:48 +0200
commit804882648e0c7c4bc8016870017ec43a6156253c (patch)
treeeb1ba96a9072277f2f07f8ef72af4855d510524c /vid-app-common/src/test
parent6e08835bcfe44b02f73d349b0d87aa3591bc45e4 (diff)
Disable homing_solution
Send Homing_solution=none during macro instantiation Add flag 'FLAG_DISABLE_HOMING' (by default set to true) which defines whether homing_solution should be in request to so or not Issue-ID: VID-576 Signed-off-by: wsliwka <wojciech.sliwka@nokia.com> Change-Id: I6151151a0256a5bb4e637acf08ae511f4b265dc2 Signed-off-by: wsliwka <wojciech.sliwka@nokia.com>
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java1
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java20
-rw-r--r--vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json99
3 files changed, 116 insertions, 4 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
index 2b4f4be62..ce0aa42f2 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
@@ -190,6 +190,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT
@BeforeClass
void initServicesInfoService() {
MockitoAnnotations.initMocks(this);
+ doReturn(false).when(featureManager).isActive(Features.FLAG_DISABLE_HOMING);
AsyncInstantiationRepository realAsyncInstantiationRepository = new AsyncInstantiationRepository(dataAccessService);
asyncInstantiationRepository = spy(realAsyncInstantiationRepository);
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 bd761f275..2c70b3ddc 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
@@ -26,6 +26,7 @@ import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
@@ -85,6 +86,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
@ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class})
public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
@@ -138,22 +140,32 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
@Test
public void createServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected() throws IOException {
- createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(true);
+ createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(true,
+ false);
}
@Test
public void createServiceInfo_WithUserProvidedNamingFalseAndNoVfmodules_ServiceInfoIsAsExpected() throws IOException {
- createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(false);
+ createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(false, false);
}
- private void createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(boolean withVfmodules) throws IOException {
+ @Test
+ public void shouldCreateServiceInfoWithHomingSolutionDisabled() throws IOException {
+ doReturn(true).when(featureManager).isActive(Features.FLAG_DISABLE_HOMING);
+
+ createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(true, true);
+ }
+
+ private void createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(boolean withVfmodules, boolean disabledHoming) throws IOException {
ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
1,
false, PROJECT_NAME, true);
URL resource;
- if (withVfmodules) {
+ if (disabledHoming) {
+ resource = this.getClass().getResource("/payload_jsons/bulk_service_no_homing.json");
+ } else if (withVfmodules) {
resource = this.getClass().getResource("/payload_jsons/bulk_service_request_ecomp_naming.json");
} else {
// remove the vf modules
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json
new file mode 100644
index 000000000..f61280024
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json
@@ -0,0 +1,99 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a",
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersion": "10.0"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "JULIO ERICKSON"
+ },
+ "project": {
+ "projectName": "{some project name}"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "{some subscriber id}"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "az2016"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "VMX",
+ "aLaCarte": false,
+ "userParams": [{
+ "service": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "MOW AVPN vMX BV vPE 1 Service",
+ "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a"
+ },
+ "instanceParams": [{
+ "instanceParams_test1": "some text",
+ "instanceParams_test2": "another text"
+ }],
+ "resources": {
+ "vnfs": [{
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelName": "2016-73_MOW-AVPN-vPE-BV-L",
+ "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8",
+ "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0",
+ "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "cloudOwner": "irma-aic",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lineOfBusinessName"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceParams": [{
+ "vmx_int_net_len": "24",
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "100"
+ }],
+ "vfModules": [{
+ "modelInfo": {
+ "modelCustomizationName" : "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0",
+ "modelType": "vfModule",
+ "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0",
+ "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79",
+ "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"
+ },
+ "instanceParams": [{
+ "vmx_int_net_len": "24"
+ }]
+ },
+ {
+ "modelInfo": {
+ "modelCustomizationName" : "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
+ "modelType": "vfModule",
+ "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
+ "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
+ "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8"
+ },
+ "instanceParams": [{
+ "availability_zone_0": "mtpocdv-kvm-az01",
+ "vre_a_volume_size_0": "100"
+ }]
+ }]
+ }]
+ }
+ }
+ },
+ {"Homing_Solution": "none"}
+ ]
+ }
+ }
+} \ No newline at end of file