fix null string handling and typos 23/423/1
authordavidplunkett <dp7642@att.com>
Thu, 28 Feb 2019 05:51:42 +0000 (05:51 +0000)
committerdavidplunkett <dp7642@att.com>
Thu, 28 Feb 2019 05:51:42 +0000 (05:51 +0000)
Change-Id: I6dff7fcb38a8352b9a70ef246d7943ea69297486
Signed-off-by: davidplunkett <dp7642@att.com>
akraino/src/main/java/com/akraino/bpm/delegate/DeployPostVerficationRemoteScriptExecutor.java
akraino/src/main/java/com/akraino/bpm/delegate/DeployRemoteDeploymentVerificationDelegate.java

index ac0e438..0faac5b 100644 (file)
@@ -43,7 +43,7 @@ public class DeployPostVerficationRemoteScriptExecutor implements JavaDelegate {
         
                 try {
                         String remoteserver =(String) ctx.getVariable("remotserver");
-                        int    portnumner   =(Integer)ctx.getVariable("port");
+                        int    portnumber   =(Integer)ctx.getVariable("port");
                         String username     =(String) ctx.getVariable("username");
                         String password     =(String) ctx.getVariable("password");
                         String filename     =(String) ctx.getVariable("postverificationscript");
@@ -54,13 +54,13 @@ public class DeployPostVerficationRemoteScriptExecutor implements JavaDelegate {
                         String blueprint    =(String) ctx.getVariable("blueprint");
 
                         deployResponseSenderService.sendResponse(new BuildResponse("completed", "completed", "completed", "completed","inprogress",sitename,null,null,null));
-                        logger.debug("task execution started blueprint {}, remoteserver {}, portnumner {}, username {}, password {}, filename {}, fileparams {}, src dir={}, dest dir={}",
-                                        blueprint,remoteserver,portnumner,username,password,filename,fileparams,srcdir,destdir);
+                        logger.debug("task execution started blueprint {}, remoteserver {}, portnumber {}, username {}, password {}, filename {}, fileparams {}, src dir={}, dest dir={}",
+                                                             blueprint,    remoteserver,    portnumber,    username,    password,    filename,    fileparams,    srcdir,     destdir);
 
                         String command = String.format("/bin/bash %s/%s %s", destdir, filename, (fileparams!=null?fileparams.replaceAll(",", "  "):""));
-                        if ( !filename.equals("null") || !filename.equals("") ) {
+                        if ( filename != null && !filename.equals("null") && !filename.isEmpty() ) {
                                 logger.debug("Execution command {}",command);
-                                remoteScriptExecutionService.executeRemoteScript(remoteserver,username,password,portnumner,filename,fileparams,srcdir,destdir,command);
+                                remoteScriptExecutionService.executeRemoteScript(remoteserver,username,password,portnumber,filename,fileparams,srcdir,destdir,command);
                         } else {
                                 logger.debug("Skipping invalid verification command: {}", command);
                         }
index 6d40629..971a670 100644 (file)
@@ -43,27 +43,27 @@ public class DeployRemoteDeploymentVerificationDelegate implements JavaDelegate
 
                 try {
                         String remoteserver =(String) ctx.getVariable("remotserver");
-                        int    portnumner   =(Integer)ctx.getVariable("port");
+                        int    portnumber   =(Integer)ctx.getVariable("port");
                         String username     =(String) ctx.getVariable("username");
                         String password     =(String) ctx.getVariable("password");
-                        String filename     =(String) ctx.getVariable("verifier");
-                        String fileparams   =(String) ctx.getVariable("verifierfileparams");
+                        String filename     =(String) ctx.getVariable("deploymentverifier");
+                        String fileparams   =(String) ctx.getVariable("deploymentverifierfileparams");
                         String srcdir       =(String) ctx.getVariable("srcdir");
                         String destdir      =(String) ctx.getVariable("destdir");
                         String sitename     =(String) ctx.getVariable("sitename");
                         String blueprint    =(String) ctx.getVariable("blueprint");
                         int    waittime     =(Integer)ctx.getVariable("waittime");
-                        int    iterations   =(Integer)ctx.getVariable("iterations");
+                        int    iterations   =(Integer)ctx.getVariable("noofiterations");
 
                         deployResponseSenderService.sendResponse(new BuildResponse("completed", "completed", "completed", "inprogress","not started", sitename,null,null,null));
 
-                        logger.debug("task execution started blueprint {}, remoteserver {}, portnumner {}, username {}, password {}, filename {}, waittime {}, No of iterations {}",
-                                        blueprint,remoteserver,portnumner,username,password,filename,srcdir,destdir,waittime,iterations);
+                        logger.debug("task execution started blueprint {}, remoteserver {}, portnumber {}, username {}, password {}, filename {}, waittime {}, No of iterations {}",
+                                                             blueprint,    remoteserver,    portnumber,    username,    password,    filename,    waittime,    iterations);
 
                         String command = String.format("/bin/bash %s/%s %s", destdir, filename, (fileparams!=null?fileparams.replaceAll(",", "  "):""));
-                        if ( !filename.equals("null") || !filename.equals("") ) {
+                        if ( filename != null && !filename.equals("null") && !filename.isEmpty() ) {
                                 logger.debug("Execution command: {}",command);
-                                remotedeploymentVerificationService.executeScript(remoteserver,username,password,portnumner,filename,fileparams,srcdir,destdir,waittime,iterations,command);
+                                remotedeploymentVerificationService.executeScript(remoteserver,username,password,portnumber,filename,fileparams,srcdir,destdir,waittime,iterations,command);
                         } else {
                                 logger.debug("Skipping invalid verification command: {}", command);
                         }