From 21bdd6099cfdebad231dc5d4374fc2d9af7bd1d7 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Tue, 22 May 2018 12:44:45 +0000 Subject: 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 --- .../scripts/DoDeleteE2EServiceInstance.groovy | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'bpmn') 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) -- cgit 1.2.3-korg