summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java88
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java15
13 files changed, 236 insertions, 90 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index 73d7257632..a8a249f386 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -43,6 +43,7 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mockito;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -456,6 +457,29 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
String neutronSubnetId = createNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
}
+
+ @Test
+ public void updateNetworkUpdatedTest() throws Exception {
+ UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
+ updateNetworkResponse.setNeutronNetworkId("testNeutronNetworkId");
+ HashMap<String, String> subnetMap = new HashMap<>();
+ subnetMap.put("testSubnetId", "testNeutronSubnetId");
+ updateNetworkResponse.setSubnetMap(subnetMap);
+
+ network.getSubnets().add(subnet);
+
+ execution.setVariable("updateNetworkResponse", updateNetworkResponse);
+
+ doNothing().when(aaiNetworkResources).updateNetwork(network);
+ doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
+
+ aaiUpdateTasks.updateNetworkUpdated(execution);
+ verify(aaiNetworkResources, times(1)).updateNetwork(network);
+ verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
+
+ String neutronSubnetId = updateNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
+ assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
+ }
@Test
public void updateOrchestrationStatusNetworkTest() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
index 9f2f2fbdcc..478c512b0a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
@@ -39,6 +40,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -83,35 +86,15 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{
@Test
public void updateNetworkTest() throws Exception {
- UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
- updateNetworkResponse.setMessageId("messageId");
- updateNetworkResponse.setNetworkId("networkId");
- Optional<UpdateNetworkResponse> oUpdateNetworkResponse = Optional.of(updateNetworkResponse);
-
- doReturn(oUpdateNetworkResponse).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
-
- networkAdapterUpdateTasks.updateNetwork(execution);
-
- verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
- assertEquals(updateNetworkResponse, execution.getVariable("NetworkAdapterUpdateNetworkResponse"));
- }
-
- @Test
- public void updateNetworkNoResponseTest() throws Exception {
- doReturn(Optional.empty()).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
-
+ String cloudRegionPo = "cloudRegionPo";
+ UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
+ execution.setVariable("cloudRegionPo", cloudRegionPo);
+
+ doReturn(updateNetworkRequest).when(networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
networkAdapterUpdateTasks.updateNetwork(execution);
-
- verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
- assertNull(execution.getVariable("NetworkAdapterUpdateNetworkResponse"));
+ verify(networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer);
+ assertEquals(updateNetworkRequest, execution.getVariable("networkAdapterRequest"));
}
- @Test
- public void updateNetworkExceptionTest() throws UnsupportedEncodingException, NetworkAdapterClientException {
- expectedException.expect(BpmnError.class);
- doThrow(new NetworkAdapterClientException("ERROR")).when(networkAdapterResources).updateNetwork(any(RequestContext.class),any(CloudRegion.class),
- any(OrchestrationContext.class),eq(serviceInstance),eq(network),any(Map.class),any(Customer.class));
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- networkAdapterUpdateTasks.updateNetwork(execution);
- }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java
new file mode 100644
index 0000000000..125c97109c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtilsTest.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.so.bpmn.infrastructure.flowspecific.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.util.Optional;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.BaseTaskTest;
+
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+
+public class CloudSiteCatalogUtilsTest extends BaseTaskTest {
+
+ @InjectMocks
+ private CloudSiteCatalogUtils cloudSiteCatalogUtils = new CloudSiteCatalogUtils();
+
+ @Test
+ public void testGetCloudSiteGetVersion30Test() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ cloudSite.setClli(testCloudSiteId);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId);
+ assertEquals(actualCloudSite.get().getClli(), testCloudSiteId);
+ }
+
+ @Test
+ public void testGetCloudSiteGetVersion25Test() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ cloudSite.setClli(testCloudSiteId);
+ doReturn(null).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSiteByClliAndAicVersion(testCloudSiteId, "2.5");
+ Optional<CloudSite> actualCloudSite = cloudSiteCatalogUtils.getCloudSite(testCloudSiteId);
+ assertEquals(actualCloudSite.get().getClli(), testCloudSiteId);
+ }
+
+ @Test
+ public void testGetIdentityUrlFromCloudSiteSuccessTest() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ String testIdentityUrl = "testIdentityUrl";
+ delegateExecution.setVariable("lcpCloudRegionId", testCloudSiteId);
+ cloudSite.setClli(testCloudSiteId);
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setIdentityUrl(testIdentityUrl);
+ cloudSite.setIdentityService(cloudIdentity);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution);
+ String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl");
+ assertEquals(testIdentityUrl, actualIdentityUrl);
+ }
+
+ @Test
+ public void testGetIdentityUrlFromCloudSiteNoCloudIdProvidedTest() throws Exception {
+ CloudSite cloudSite = new CloudSite();
+ String testCloudSiteId = "testCloudSiteId";
+ String testIdentityUrl = "testIdentityUrl";
+ cloudSite.setClli(testCloudSiteId);
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setIdentityUrl(testIdentityUrl);
+ cloudSite.setIdentityService(cloudIdentity);
+ doReturn(cloudSite).when(catalogDbClient).getCloudSite(testCloudSiteId);
+ cloudSiteCatalogUtils.getIdentityUrlFromCloudSite(delegateExecution);
+ String actualIdentityUrl = (String) delegateExecution.getVariable("identityUrl");
+ assertEquals(null, actualIdentityUrl);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
index 339e9cbf17..5169663add 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -72,7 +72,6 @@ public class VnfAdapterObjectMapperTest {
}
@Test
- @Ignore
public void test_createVolumeGroupRequestMapper() throws Exception {
RequestContext requestContext = new RequestContext();
requestContext.setMsoRequestId("msoRequestId");
@@ -123,7 +122,7 @@ public class VnfAdapterObjectMapperTest {
expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
- Map<String, String> volumeGroupParams = new HashMap<>();
+ Map<String, Object> volumeGroupParams = new HashMap<>();
volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
@@ -201,7 +200,7 @@ public class VnfAdapterObjectMapperTest {
expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName());
expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID());
- Map<String, String> volumeGroupParams = new HashMap<>();
+ Map<String, Object> volumeGroupParams = new HashMap<>();
volumeGroupParams.put("vnf_id", genericVnf.getVnfId());
volumeGroupParams.put("vnf_name", genericVnf.getVnfName());
volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
@@ -285,7 +284,6 @@ public class VnfAdapterObjectMapperTest {
}
@Test
- @Ignore
public void test_createVolumeGroupParams() throws Exception {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
@@ -308,7 +306,7 @@ public class VnfAdapterObjectMapperTest {
expectedVolumeGroupParams.put("paramTwo", "paramTwoValue");
expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
- Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+ Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
}
@@ -329,13 +327,12 @@ public class VnfAdapterObjectMapperTest {
expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId());
expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName());
RequestContext requestContext = new RequestContext();
- Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null);
+ Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null);
assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
}
@Test
- @Ignore
public void test_createVolumeGroupParams_with_user_params() throws Exception {
GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("vnfId");
@@ -366,7 +363,7 @@ public class VnfAdapterObjectMapperTest {
expectedVolumeGroupParams.put("paramThree", "paramThreeValue");
expectedVolumeGroupParams.put("userParamKey", "userParamValue");
- Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
+ Map<String, Object> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse);
assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
index a156c382d1..00e5c10f73 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
@@ -76,7 +76,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -150,7 +150,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -223,7 +223,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -295,7 +295,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
//
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -375,7 +375,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
//
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -450,7 +450,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value2");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -521,7 +521,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -591,7 +591,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -661,7 +661,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -798,7 +798,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setMsoRequestId("requestId");
requestContext.setUserParams(userParams);
@@ -853,7 +853,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
String json = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "grApiVmNetworkSubSectionWith5GParams.json")));
GenericResourceApiVmNetworkData network = omapper.readValue(json, GenericResourceApiVmNetworkData.class);
- Map<String, String> paramsMap = new HashMap<>();
+ Map<String, Object> paramsMap = new HashMap<>();
vfModuleObjectMapper.buildVlanInformation(paramsMap, network, "testKey", "testType");
assertEquals("1,3", paramsMap.get("testKey_testType_private_vlans"));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
index 160feed426..81d30e33c5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
@@ -67,7 +67,7 @@ public class VnfAdapterVfModuleObjectMapperTest {
@Test
public void addPairToMapTest() {
- Map<String, String> map = new HashMap<>();
+ Map<String, Object> map = new HashMap<>();
mapper.addPairToMap(map, "test", "_key", Arrays.asList("a", "b"));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
index 4d90a3fcc9..0023066949 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
@@ -22,9 +22,7 @@ package org.onap.so.client.orchestration;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import java.net.URI;
@@ -35,10 +33,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -47,19 +46,17 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
-
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCConfigurationResourcesTest extends TestDataSetup{
@InjectMocks
private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources();
- @Spy
- GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ;
+ @Mock
+ private GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ;
@Mock
protected SDNCClient MOCK_sdncClient;
@@ -82,24 +79,34 @@ public class SDNCConfigurationResourcesTest extends TestDataSetup{
@Test
public void activateVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
- assertNotNull(response);
+ verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper(
+ eq(SDNCSvcAction.ACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE),
+ eq(serviceInstance), eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class), any(URI.class));
+
}
@Test
public void assignVnrConfigurationTest() throws BadResponseException, MapperException, URISyntaxException {
GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf,"uuid",new URI("http://localhost"));
- assertNotNull(response);
+ verify(MOCK_gcTopologyMapper).assignOrActivateVnrReqMapper(
+ eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATEGENERICCONFIGURATIONINSTANCE),
+ eq(serviceInstance), eq(requestContext), eq(customer), any(Configuration.class), any(GenericVnf.class), any(String.class), any(URI.class));
+
}
@Test
public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
- assertNotNull(response);
+ verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper(
+ eq(SDNCSvcAction.UNASSIGN), eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class));
+
}
@Test
public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException , URISyntaxException{
GenericResourceApiGcTopologyOperationInformation response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration(),"uuid",new URI("http://localhost"));
- assertNotNull(response);
+ verify(MOCK_gcTopologyMapper).deactivateOrUnassignVnrReqMapper(
+ eq(SDNCSvcAction.DEACTIVATE), eq(serviceInstance), eq(requestContext), any(Configuration.class), any(String.class), any(URI.class));
+
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
index f01eeaeae8..f4d442bbc3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
@@ -24,9 +24,15 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -38,11 +44,14 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
-
-
-public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
+
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper();
@Test
@@ -80,13 +89,13 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup{
private RequestContext getRequestContext() {
RequestContext requestContext = new RequestContext();
requestContext.setMsoRequestId("MsoRequestId");
- HashMap<String, String> userParams = getUserParams();
+ Map<String, Object> userParams = getUserParams();
requestContext.setUserParams(userParams);
return requestContext;
}
- private HashMap<String, String> getUserParams() {
- HashMap<String,String> userParams = new HashMap<>();
+ private Map<String, Object> getUserParams() {
+ Map<String,Object> userParams = new HashMap<>();
userParams.put("lppCustomerId","lppCustomerId");
return userParams;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
index bf2cd347c0..3bb54278b6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
+import java.util.Map;
import org.junit.After;
import org.junit.Before;
@@ -104,7 +105,7 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup {
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
//
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
index 307fe289a1..6a14f8b567 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
@@ -29,9 +29,16 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
+import java.util.Map;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -45,10 +52,9 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import com.fasterxml.jackson.databind.ObjectMapper;
+@RunWith(MockitoJUnitRunner.class)
public class NetworkTopologyOperationRequestMapperTest {
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
@@ -59,6 +65,12 @@ public class NetworkTopologyOperationRequestMapperTest {
private RequestContext requestContext;
private L3Network network;
private CloudRegion cloudRegion;
+
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
@Before
public void before() {
@@ -93,7 +105,7 @@ public class NetworkTopologyOperationRequestMapperTest {
serviceInstance.setCollection(networkCollection);
//
requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
@@ -115,7 +127,6 @@ public class NetworkTopologyOperationRequestMapperTest {
@Test
public void createGenericResourceApiNetworkOperationInformationTest() throws Exception {
- NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
requestContext, cloudRegion);
@@ -132,7 +143,6 @@ public class NetworkTopologyOperationRequestMapperTest {
@Test
public void reqMapperTest() throws Exception {
- NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer,
requestContext, cloudRegion);
@@ -143,7 +153,6 @@ public class NetworkTopologyOperationRequestMapperTest {
@Test
public void reqMapperNoCollectionTest() throws Exception {
- NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstanceNoCollection, customer,
requestContext, cloudRegion);
@@ -154,7 +163,7 @@ public class NetworkTopologyOperationRequestMapperTest {
@Test
public void createGenericResourceApiNetworkOperationInformation_UnassignTest() throws Exception {
- NetworkTopologyOperationRequestMapper mapperUnassign = new NetworkTopologyOperationRequestMapper();
+ NetworkTopologyOperationRequestMapper mapperUnassign = mapper;
GenericResourceApiNetworkOperationInformation networkSDNCrequestUnassign = mapperUnassign.reqMapper(
SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer,
requestContext, cloudRegion);
@@ -172,7 +181,6 @@ public class NetworkTopologyOperationRequestMapperTest {
@Test
public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception {
- NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper();
//set network name NULL
network.setNetworkName(null);
GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper(
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
index 5d8b31b3bf..0bf06a0bb0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
@@ -26,8 +26,13 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
+import java.util.Map;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
@@ -41,8 +46,15 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnum
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import com.fasterxml.jackson.databind.ObjectMapper;
+@RunWith(MockitoJUnitRunner.class)
public class ServiceTopologyOperationMapperTest {
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper();
+
@Test
public void reqMapperTest() throws Exception {
// prepare and set service instance
@@ -64,12 +76,11 @@ public class ServiceTopologyOperationMapperTest {
//prepare RequestContext
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
- ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper();
GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper(
SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer,
requestContext);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
index 7d5aa9d1d9..282f23caa7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -35,6 +35,10 @@ import java.util.Map;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -54,11 +58,18 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import com.fasterxml.jackson.databind.ObjectMapper;
+@RunWith(MockitoJUnitRunner.class)
public class VfModuleTopologyOperationRequestMapperTest {
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
private final static String ERRORMESSAGE = "VF Module model info is null for testVfModuleId";
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -84,7 +95,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
//
RequestContext requestContext = new RequestContext();
- HashMap<String,String> userParams = new HashMap<String,String>();
+ Map<String,Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
@@ -124,7 +135,6 @@ public class VfModuleTopologyOperationRequestMapperTest {
CloudRegion cloudRegion = new CloudRegion();
- VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer,
cloudRegion, requestContext, null);
@@ -159,7 +169,6 @@ public class VfModuleTopologyOperationRequestMapperTest {
vfModule.setVfModuleId("testVfModuleId");
vfModule.setVfModuleName("testVfModuleName");
- VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null,
null, null, null);
@@ -197,9 +206,9 @@ public class VfModuleTopologyOperationRequestMapperTest {
//
RequestContext requestContext = new RequestContext();
RequestParameters requestParameters = new RequestParameters();
- HashMap<String,Object> userParams1 = new HashMap<String,Object>();
+ HashMap<String,Object> userParams1 = new HashMap<>();
userParams1.put("key1", "value1");
- List<Map<String,Object>> userParams = new ArrayList<Map<String,Object>>();
+ List<Map<String,Object>> userParams = new ArrayList<>();
userParams.add(userParams1);
requestParameters.setUserParams(userParams);
@@ -230,7 +239,6 @@ public class VfModuleTopologyOperationRequestMapperTest {
CloudRegion cloudRegion = new CloudRegion();
- VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(
SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer,
cloudRegion, requestContext, null);
@@ -261,7 +269,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
//
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<String, Object>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
@@ -284,7 +292,6 @@ public class VfModuleTopologyOperationRequestMapperTest {
CloudRegion cloudRegion = new CloudRegion();
- VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
expectedException.expect(MapperException.class);
expectedException.expectMessage(ERRORMESSAGE);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
index 63c3680e8c..229a8cf601 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
@@ -25,9 +25,14 @@ import static org.junit.Assert.assertNull;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import java.util.List;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,8 +50,15 @@ import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
+@RunWith(MockitoJUnitRunner.class)
public class VnfTopologyOperationRequestMapperTest {
+ @Spy
+ private GeneralTopologyObjectMapper generalTopologyObjectMapper;
+
+ @InjectMocks
+ private VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper();
+
@Test
public void reqMapperTest() throws Exception {
// prepare and set service instance
@@ -106,14 +118,13 @@ public class VnfTopologyOperationRequestMapperTest {
//prepare RequestContext
RequestContext requestContext = new RequestContext();
- HashMap<String, String> userParams = new HashMap<String, String>();
+ Map<String, Object> userParams = new HashMap<>();
userParams.put("key1", "value1");
requestContext.setUserParams(userParams);
requestContext.setProductFamilyId("productFamilyId");
CloudRegion cloudRegion = new CloudRegion();
- VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper();
GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper(
SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer,
cloudRegion, requestContext,true);