summaryrefslogtreecommitdiffstats
path: root/sshapi-call-node/provider
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-12-28 23:49:12 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2018-12-28 23:49:22 +0530
commita6ded88f4df6f21c2452af2d6079e5150a321a40 (patch)
treed6392bb0a3786f1212c4eb9ba22a5a5e5e78ac47 /sshapi-call-node/provider
parent62e62331a294052109f02686e4529fe613355990 (diff)
Sonar fix: SshApiCallNode.java
Fixed sonar issues/code-smells acros this file Issue-ID: CCSDK-881 Change-Id: Ie1a98a47cedd7781e1e965825b152a50b7912ab0 Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'sshapi-call-node/provider')
-rw-r--r--sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java b/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java
index 452d9478..146188fb 100644
--- a/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java
+++ b/sshapi-call-node/provider/src/main/java/org/onap/ccsdk/sli/plugins/sshapicall/SshApiCallNode.java
@@ -6,7 +6,9 @@
* =============================================================================
* Copyright (C) 2018 Samsung Electronics. All rights
reserved.
-* * ================================================================================
+ * ================================================================================
+ * Modifications Copyright © 2018 IBM
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -24,16 +26,9 @@
package org.onap.ccsdk.sli.plugins.sshapicall;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-
import java.io.ByteArrayOutputStream;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
-import com.google.common.base.Strings;
-import org.json.JSONObject;
import org.onap.appc.adapter.ssh.SshAdapter;
import org.onap.appc.adapter.ssh.SshConnection;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
@@ -77,6 +72,10 @@ public class SshApiCallNode implements SvcLogicJavaPlugin {
*/
private int DEF_SUCCESS_STATUS = 0;
+
+
+ private SshAdapter sshAdapter;
+
/**
* Used for jUnit test and testing interface
*/
@@ -88,8 +87,6 @@ public class SshApiCallNode implements SvcLogicJavaPlugin {
PARAM_TEST_MODE = false;
}
- private SshAdapter sshAdapter;
-
public void setSshAdapter(SshAdapter sshAdapter) {
this.sshAdapter = sshAdapter;
}
@@ -138,7 +135,8 @@ public class SshApiCallNode implements SvcLogicJavaPlugin {
int status = -1;
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ByteArrayOutputStream stderr = new ByteArrayOutputStream();
- String stdoutRes = "", stderrRes = "";
+ String stdoutRes = "";
+ String stderrRes = "";
try {
if (!PARAM_TEST_MODE) {
sshConnection = getSshConnection(p);
@@ -156,7 +154,7 @@ public class SshApiCallNode implements SvcLogicJavaPlugin {
stderrRes = stderr.toString();
} else {
- if (params.get("TestFail").equalsIgnoreCase("true"))
+ if (("true").equalsIgnoreCase(params.get("TestFail")))
status = 202;
else
status = DEF_SUCCESS_STATUS;
@@ -183,11 +181,9 @@ public class SshApiCallNode implements SvcLogicJavaPlugin {
return sshAdapter.getConnection(p.sshapiUrl, p.sshapiPort, p.sshapiUser, p.sshapiPassword);
// This is not supported yet in the API, patch has already been added to APPC
else if (p.authtype == AuthType.KEY){
- //return sshAdapter.getConnection(p.sshapiUrl, p.sshapiPort, p.sshKey);
throw new SvcLogicException("SSH Key based Auth method not supported");
}
else if (p.authtype == AuthType.NONE){
- //return sshAdapter.getConnection(p.sshapiUrl, p.sshapiPort, p.sshKey);
throw new SvcLogicException("SSH Auth type required, BASIC auth in support");
}
else if (p.authtype == AuthType.UNSPECIFIED){