From 80e9fc2dbae7bfb8a17f60710e3c1785ddf5b869 Mon Sep 17 00:00:00 2001
From: Murali-P <murali.p@huawei.com>
Date: Fri, 21 Apr 2017 14:14:41 +0530
Subject: Log the command

Resolved:VNFSDK-21
VNF SDK function test

Change-Id: I3ebcc3929c097f6f0a6458f5c3cb7c9c1b2d704c
Signed-off-by: Murali-P <murali.p@huawei.com>
---
 .../org/openo/vnfsdk/functest/TaskExecution.java     | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

(limited to 'vnf-sdk-function-test')

diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/TaskExecution.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/TaskExecution.java
index 3f044bb..57e4baf 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/TaskExecution.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/TaskExecution.java
@@ -51,7 +51,8 @@ public class TaskExecution {
 
         Map<String, String> mapValues = null;
         try {
-            mapValues = mapper.readValue(new FileInputStream(confDir + ApplicationConstants.ROBOTMETADATA_JSON), Map.class);
+            mapValues =
+                    mapper.readValue(new FileInputStream(confDir + ApplicationConstants.ROBOTMETADATA_JSON), Map.class);
         } catch(IOException e) {
 
             LOGGER.error(ApplicationConstants.JSON_METADATA_FILE_FAILED, e);
@@ -71,7 +72,8 @@ public class TaskExecution {
 
         String remoteScriptFile = remoteScriptDir + "/" + mapValues.get("MAIN_SCRIPT");
         String remoteArgs = "--argumentfile " + remoteScriptDir + "/" + "config.args ";
-        String remoteCommand = ApplicationConstants.ROBOT_SPACE + "-d " + remoteScriptResult + remoteArgs + remoteScriptFile;
+        String remoteCommand =
+                ApplicationConstants.ROBOT_SPACE + "-d " + remoteScriptResult + remoteArgs + remoteScriptFile;
         mapValues.put("REMOTE_COMMAND", "\"" + remoteCommand + "\"");
 
         String robotvariables = "";
@@ -95,6 +97,7 @@ public class TaskExecution {
         try {
             String command =
                     shellcommand + "robot --argumentfile " + argumentFilePath + robotvariables + " " + robotScript;
+            LOGGER.info("Command execute to execute the script:" + command);
             process = Runtime.getRuntime().exec(command);
             inputStream = process.getInputStream();
             while((ch = inputStream.read()) != -1) {
@@ -106,7 +109,7 @@ public class TaskExecution {
         }
     }
 
-    public void executeRobotScript(UUID envId, UUID executeId ) {
+    public void executeRobotScript(UUID envId, UUID executeId) {
 
         String nl = File.separator;
         String curDir = System.getProperty(ApplicationConstants.USER_DIR);
@@ -116,7 +119,8 @@ public class TaskExecution {
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> mapValues = null;
         try {
-            mapValues = mapper.readValue(new FileInputStream(confDir + ApplicationConstants.ROBOTMETADATA_JSON), Map.class);
+            mapValues =
+                    mapper.readValue(new FileInputStream(confDir + ApplicationConstants.ROBOTMETADATA_JSON), Map.class);
         } catch(IOException e) {
 
             LOGGER.error(ApplicationConstants.JSON_METADATA_FILE_FAILED, e);
@@ -137,7 +141,8 @@ public class TaskExecution {
         remoteArgs = remoteArgs + " -v " + "NODE_USERNAME" + ":" + functestEnv.getUserName() + " ";
         remoteArgs = remoteArgs + " -v " + "NODE_PASSWORD" + ":" + functestEnv.getPassword() + " ";
 
-        String remoteCommand = ApplicationConstants.ROBOT_SPACE + "-d " + remoteScriptResult + remoteArgs + remoteScriptFile;
+        String remoteCommand =
+                ApplicationConstants.ROBOT_SPACE + "-d " + remoteScriptResult + remoteArgs + remoteScriptFile;
 
         // set the parameters required by the execute script
         remoteCommand = "\"" + remoteCommand + "\"";
@@ -157,6 +162,7 @@ public class TaskExecution {
         int ch;
         try {
             String command = shellcommand + ApplicationConstants.ROBOT + remoteArgs + robotScript;
+            LOGGER.info("Command execute to execute the script:" + command);
             process = Runtime.getRuntime().exec(command);
             inputStream = process.getInputStream();
             while((ch = inputStream.read()) != -1) {
@@ -185,7 +191,8 @@ public class TaskExecution {
         Map<String, String> mapValues = null;
         try {
 
-            mapValues = mapper.readValue(new FileInputStream(confDir + ApplicationConstants.ROBOTMETADATA_JSON ), Map.class);
+            mapValues =
+                    mapper.readValue(new FileInputStream(confDir + ApplicationConstants.ROBOTMETADATA_JSON), Map.class);
         } catch(Exception e) {
 
             LOGGER.error(ApplicationConstants.JSON_METADATA_FILE_FAILED, e);
@@ -221,6 +228,7 @@ public class TaskExecution {
         int ch;
         try {
             String command = shellcommand + ApplicationConstants.ROBOT_SPACE + robotvariables + robotScript;
+            LOGGER.info("Command execute to upload the script:" + command);
             process = Runtime.getRuntime().exec(command);
             inputStream = process.getInputStream();
             while((ch = inputStream.read()) != -1) {
-- 
cgit