Merge "Fix resource looping if AAI response empty"
authorChuanyu Chen <chenchuanyu@huawei.com>
Wed, 23 May 2018 01:31:00 +0000 (01:31 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 23 May 2018 01:31:00 +0000 (01:31 +0000)
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy

index a834431..bbf6174 100644 (file)
@@ -361,24 +361,28 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
             List<Resource> 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)