From 8d77d8544d88dfb91e9287b1620212cc9821bd54 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max" Date: Thu, 23 Jan 2020 09:36:32 -0500 Subject: removed extra set line and added a test removed extra set line and added a test Issue-ID: SO-2612 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I45022ed722368192823f6cad66e8bd6649cc0719 --- .../tasks/BBInputSetupTest.java | 51 +++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'bpmn/MSOCommonBPMN/src/test/java') 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 16cdb7a3e9..50d5ed3cad 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 @@ -1430,7 +1430,6 @@ public class BBInputSetupTest { String instanceName = "vnfName"; ModelInfo modelInfo = new ModelInfo(); modelInfo.setModelType(ModelType.vnf); - ServiceInstance serviceInstance = new ServiceInstance(); GenericVnf vnf = new GenericVnf(); vnf.setVnfId("genericVnfId"); @@ -1489,6 +1488,56 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); + + assertEquals("modelCustId", modelInfo.getModelCustomizationUuid()); + + } + + @Test + public void testPopulateGenericVnfReplace() throws JsonParseException, JsonMappingException, IOException { + org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = + new org.onap.so.serviceinstancebeans.LineOfBusiness(); + String instanceName = "vnfName"; + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelType(ModelType.vnf); + ServiceInstance serviceInstance = new ServiceInstance(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("genericVnfId"); + vnf.setVnfName("vnfName"); + serviceInstance.getVnfs().add(vnf); + String vnfType = "vnfType"; + String applicationId = "applicationId"; + RequestDetails requestDetails = + mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), RequestDetails.class); + + Service service = mapper.readValue( + new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class); + Map lookupKeyMap = new HashMap<>(); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId"); + String bbName = AssignFlows.VNF.toString(); + + Platform expectedPlatform = new Platform(); + LineOfBusiness expectedLineOfBusiness = new LineOfBusiness(); + String resourceId = "123"; + doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform); + doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness); + org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf(); + vnfAAI.setModelCustomizationId("modelCustId"); + doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); + doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service); + org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup(); + doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any()); + org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = + new org.onap.so.db.catalog.beans.InstanceGroup(); + doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); + + SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, + requestDetails.getRequestInfo().getProductFamilyId(), applicationId, true); + + assertEquals("my-test-uuid", modelInfo.getModelCustomizationUuid()); + } @Test -- cgit 1.2.3-korg