SDNC-12 refactoring to support easy mocking
[sdnc/core.git] / sli / provider / src / main / java / org / openecomp / sdnc / sli / provider / CallNodeExecutor.java
index a500b6f..7b79c19 100644 (file)
@@ -78,7 +78,16 @@ public class CallNodeExecutor extends SvcLogicNodeExecutor {
                {
                        rpc  = SvcLogicExpressionResolver.evaluate(rpcExpr, node, ctx);
                }
-
+               
+               if ((rpc == null) || (rpc.length() == 0))
+               {
+                       if (myGraph != null)
+                       {
+                               rpc = myGraph.getRpc();
+                               LOG.debug("myGraph.getRpc() returned "+rpc);
+                       }
+               }
+               
                String mode = null;
                
                moduleExpr = node.getAttribute("mode");
@@ -108,21 +117,24 @@ public class CallNodeExecutor extends SvcLogicNodeExecutor {
                String parentGraph = ctx.getAttribute("currentGraph");
         ctx.setAttribute("parentGraph", parentGraph);
                
-               SvcLogicStore store = SvcLogicActivator.getStore();
+               SvcLogicStore store = getStore();
                
         if (store != null) {
-            SvcLogicGraph calledGraph = store.fetch(module, rpc, version, mode);
+                       SvcLogicGraph calledGraph = store.fetch(module, rpc, version, mode);
+            LOG.debug("Parent " + parentGraph + " is calling child " + calledGraph.toString());
+            ctx.setAttribute("currentGraph", calledGraph.toString());
             if (calledGraph != null) {
-                svc.execute(calledGraph, ctx);
-                LOG.debug("Parent " + parentGraph + " is calling child " + calledGraph.toString());
-                ctx.setAttribute("currentGraph", calledGraph.toString());
-                outValue = ctx.getStatus();
+                               svc.execute(calledGraph, ctx);
+                               
+                               outValue = ctx.getStatus();
             } else {
-                LOG.debug("Parent " + parentGraph + " failed to call child [" + module + "," + rpc + "," + version + "," + mode + "] because the graph could not be found");
-            }
-        } else {
-            LOG.debug("Could not get SvcLogicStore reference");
-        }
+                LOG.error("Could not find service logic for [" + module + "," + rpc + "," + version + "," + mode + "]");
+                       }
+               }
+               else
+               {
+                       LOG.debug("Could not get SvcLogicStore reference");
+               }
                
                SvcLogicNode nextNode = node.getOutcomeValue(outValue);
                if (nextNode != null) {
@@ -150,5 +162,4 @@ public class CallNodeExecutor extends SvcLogicNodeExecutor {
 
        }
 
-
 }