From: subhash kumar singh Date: Tue, 22 May 2018 12:44:45 +0000 (+0000) Subject: Fix resource looping if AAI response empty X-Git-Tag: v1.2.1~34^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F48489%2F1;p=so.git Fix resource looping if AAI response empty Fix ressource looping if AAI response is empty for resource list. Change-Id: I244d3836beb98ec2689c71df5c61f24f40619d96 Issue-ID: SO-632 Signed-off-by: subhash kumar singh --- diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index a834431356..bbf61744a8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -361,24 +361,28 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { List deleteResourceList = serviceDecomposition.getServiceResources() String serviceRelationShip = execution.getVariable("serviceRelationShip") def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - + def jsonOutput = new JsonOutput() + + List relationShipList = null + if (serviceRelationShip != null) { + relationShipList = jsonSlurper.parseText(serviceRelationShip) + } + //Set the real resource instance id to the decomosed resource list - for(Resource resource: deleteResourceList){ - //reset the resource instance id , because in the decompose flow ,its a random one. - resource.setResourceId(""); + for (Resource resource: deleteResourceList) { + //reset the resource instance id , because in the decompose flow ,its a random one. + resource.setResourceId(""); //match the resource-instance-name and the model name if (relationShipList != null) { relationShipList.each { - if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){ - resource.setResourceId(it.resourceInstanceId); - } + if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { + resource.setResourceId(it.resourceInstanceId); + } } } } execution.setVariable("deleteResourceList", deleteResourceList) + utils.log("DEBUG", "delete resource list : " + deleteResourceList, isDebugEnabled) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled)