aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan <sharan.kalkere.ramesh@att.com>2020-09-17 22:22:00 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-09-20 16:35:44 -0400
commit5c1f91666cff5d3b21d2d8cd706d09e186e3fe7d (patch)
tree3621957dcb36ce07609dc1e6996b6f3b4ec89ff9 /bpmn/MSOCommonBPMN/src/test/java
parent150548c32b0d38d5465f81b8b45923d20bb18f1b (diff)
added changes for replace related to configuration
added changes for replace related to configuration added in some changes to the unit test in bbinputsetup Issue-ID: SO-3249 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ia45b9ba621f9806771944d800c14ee69c3bdff71
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java66
1 files changed, 63 insertions, 3 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index dd79d2772f..70bce65f5b 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -1337,6 +1337,10 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
configResourceKeys.setVnfcName(vnfcName);
Vnfc vnfc = new Vnfc();
@@ -1348,7 +1352,8 @@ public class BBInputSetupTest {
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
.setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
.setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
- .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+ .setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateConfiguration(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1374,6 +1379,52 @@ public class BBInputSetupTest {
}
@Test
+ public void testPopulateConfigurationReplace() throws JsonParseException, JsonMappingException, IOException {
+ String instanceName = "configurationName";
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setConfigurationName("configurationName");
+ serviceInstance.getConfigurations().add(configuration);
+ String resourceId = "configurationId";
+ String vnfcName = "vnfcName";
+ // Mock service
+ Service service = mapper.readValue(
+ new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
+ ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
+ configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
+ service.getConfigurationCustomizations().add(configurationCust);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+ String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setNewService(service);
+
+ ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
+ configResourceKeys.setVnfcName(vnfcName);
+ Vnfc vnfc = new Vnfc();
+ vnfc.setVnfcName(vnfcName);
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+ doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+ .setServiceModel(serviceModel).setIsReplace(true).build();
+ SPY_bbInputSetup.populateConfiguration(parameter);
+ configResourceKeys.setVnfResourceCustomizationUUID("my-test-uuid");
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
+ configResourceKeys);
+ }
+
+ @Test
public void testMapCatalogConfiguration() {
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
L3Network network = new L3Network();
@@ -1420,6 +1471,9 @@ public class BBInputSetupTest {
vnfc.setVnfcName(vnfcName);
RequestDetails requestDetails = new RequestDetails();
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+
CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
new CvnfcConfigurationCustomization();
ConfigurationResource configurationResource = new ConfigurationResource();
@@ -1432,7 +1486,8 @@ public class BBInputSetupTest {
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
.setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
.setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
- .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails)
+ .setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateConfiguration(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1462,6 +1517,10 @@ public class BBInputSetupTest {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
String bbName = AssignFlows.VNF.toString();
+
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+
Platform expectedPlatform = new Platform();
LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
String resourceId = "123";
@@ -1481,7 +1540,8 @@ public class BBInputSetupTest {
.setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName)
.setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap)
.setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId)
- .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).build();
+ .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId())
+ .setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateGenericVnf(parameter);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);