diff options
author | Murali-P <murali.p@huawei.com> | 2017-04-21 14:14:41 +0530 |
---|---|---|
committer | Murali-P <murali.p@huawei.com> | 2017-04-21 14:14:41 +0530 |
commit | 80e9fc2dbae7bfb8a17f60710e3c1785ddf5b869 (patch) | |
tree | 021dd7004af4cae0e818316711e6cef831334055 /vnf-sdk-function-test | |
parent | b1d4c7ffbc0463001dd9b66d4d768e869e364073 (diff) |
Log the command
Resolved:VNFSDK-21
VNF SDK function test
Change-Id: I3ebcc3929c097f6f0a6458f5c3cb7c9c1b2d704c
Signed-off-by: Murali-P <murali.p@huawei.com>
Diffstat (limited to 'vnf-sdk-function-test')
-rw-r--r-- | vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/TaskExecution.java | 20 |
1 files changed, 14 insertions, 6 deletions
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) { |