fix lookup of si if customer exists 05/74505/1
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Tue, 11 Dec 2018 15:50:04 +0000 (10:50 -0500)
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
Tue, 11 Dec 2018 15:51:01 +0000 (10:51 -0500)
fix lookup of service instance in aai if customer exists
remove the unwanted mock in the bb input setup test

Change-Id: I12a666fef771c127a69eef254228753204cadd73
Issue-ID: SO-1321
Signed-off-by: Kalkere Ramesh, Sharan (sk720x) <sk720x@att.com>
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java

index b794e41..513a19b 100644 (file)
@@ -865,8 +865,13 @@ public class BBInputSetup implements JavaDelegate {
                        String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception {
                ServiceInstance serviceInstance = this.getServiceInstanceHelper(requestDetails, customer, project, owningEntity,
                                lookupKeyMap, serviceInstanceId, aLaCarte, service, bbName);
-               org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = this.bbInputSetupUtils
-                               .getAAIServiceInstanceById(serviceInstanceId);
+               org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null;
+               if(customer != null && customer.getServiceSubscription() != null) {
+                       serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(), 
+                                       customer.getServiceSubscription().getServiceType(), serviceInstanceId);
+               } else {
+                       serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+               }
                if (serviceInstanceAAI != null
                                && !serviceInstanceAAI.getModelVersionId().equalsIgnoreCase(service.getModelUUID())) {
                        Service tempService = this.bbInputSetupUtils
index f6e433b..a04c38d 100644 (file)
@@ -1314,7 +1314,6 @@ public class BBInputSetupTest {
                doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId());
                doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service);
                doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
-               doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
                SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
                                serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null);
                verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);