summaryrefslogtreecommitdiffstats
path: root/grpc
diff options
context:
space:
mode:
authorpriyanka.akhade <priyanka.akhade@huawei.com>2020-08-04 19:07:52 +0530
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-08-05 16:46:32 +0530
commit2bdd4f82bb6d2d7928044228bf0893cf6aa5921d (patch)
tree491e2cbaa8ffaf31789d6774b6bb260c2d860612 /grpc
parent6941680edbc46f1525ef739305f11781d1ddd70a (diff)
Code improvement - Pending sonar issues
Signed-off-by: priyanka.akhade <priyanka.akhade@huawei.com> Issue-ID: CLI-270 Change-Id: I11bff3e6fa5f3299ee3ad0f7bf5d3e42ee7a704c
Diffstat (limited to 'grpc')
-rw-r--r--grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java2
-rw-r--r--grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenRemoteCli.java8
-rw-r--r--grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java14
-rw-r--r--grpc/pom.xml18
4 files changed, 14 insertions, 28 deletions
diff --git a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java
index fc007a01..d50f6143 100644
--- a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java
+++ b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenInterfaceGrpcClient.java
@@ -96,7 +96,7 @@ public class OpenInterfaceGrpcClient {
}
public Result remoteCli(Args args) throws OpenInterfaceGrpcTimeoutExecption {
- logger.info(args.toString());
+ logger.info("{}", args);
Result result = Result.newBuilder().setExitCode(1).build();
try {
diff --git a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenRemoteCli.java b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenRemoteCli.java
index 1875a761..4f9e9cfd 100644
--- a/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenRemoteCli.java
+++ b/grpc/grpc-client/src/main/java/org/open/infc/grpc/client/OpenRemoteCli.java
@@ -40,7 +40,7 @@ public class OpenRemoteCli {
}
- public Result run (List <String> args) throws Exception {
+ public Result run (List <String> args) throws Exception { //NOSONAR
OpenInterfaceGrpcClient client = new OpenInterfaceGrpcClient(
host, port, timeout);
try {
@@ -50,7 +50,7 @@ public class OpenRemoteCli {
}
}
- public Output invoke (String product, String profile, String action, Map <String, String> params) throws Exception {
+ public Output invoke (String product, String profile, String action, Map <String, String> params) throws Exception { //NOSONAR
OpenInterfaceGrpcClient client = new OpenInterfaceGrpcClient(
host, port, timeout);
try {
@@ -79,7 +79,7 @@ public class OpenRemoteCli {
* @return
* @throws Exception
*/
- public static Result run (String host, int port, String reqId, List <String> args) throws Exception {
+ public static Result run (String host, int port, String reqId, List <String> args) throws Exception { //NOSONAR
OpenInterfaceGrpcClient client = new OpenInterfaceGrpcClient(
host, port);
@@ -101,7 +101,7 @@ public class OpenRemoteCli {
* @return
* @throws Exception
*/
- public static Output invoke (String host, int port, String product, String profile, String action, String reqId, Map <String, String> params) throws Exception {
+ public static Output invoke (String host, int port, String product, String profile, String action, String reqId, Map <String, String> params) throws Exception { //NOSONAR
OpenInterfaceGrpcClient client = new OpenInterfaceGrpcClient(
host, port);
diff --git a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
index c2a61320..ba9920cb 100644
--- a/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
+++ b/grpc/grpc-server/src/main/java/org/open/infc/grpc/server/OpenInterfaceGrpcServer.java
@@ -242,11 +242,7 @@ public class OpenInterfaceGrpcServer {
// use the status from the plugin.
reply.setSuccess(cmd.getResult().isPassed());
- try {
- reply.putAttrs(OnapCommandConstants.RESULTS, new JsonParser().parse(printOut).toString());
- } catch (Exception e) { // NOSONAR
- reply.putAttrs(OnapCommandConstants.RESULTS, printOut);
- }
+ setOutputAttr(reply, printOut);
output = reply.build();
logger.info("{}", output);
@@ -279,6 +275,14 @@ public class OpenInterfaceGrpcServer {
responseObserver.onCompleted();
}
+ public static void setOutputAttr(Builder reply, String printOut){
+ try {
+ reply.putAttrs(OnapCommandConstants.RESULTS, new JsonParser().parse(printOut).toString());
+ } catch (Exception e) { // NOSONAR
+ reply.putAttrs(OnapCommandConstants.RESULTS, printOut);
+ }
+ }
+
@Override
public void remoteCli(Args req, StreamObserver<Result> responseObserver) {
logger.info("{}", req);
diff --git a/grpc/pom.xml b/grpc/pom.xml
index cd31b2ec..84a508f8 100644
--- a/grpc/pom.xml
+++ b/grpc/pom.xml
@@ -123,24 +123,6 @@
</execution>
</executions>
</plugin>
- <!-- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.4.1</version>
- <executions>
- <execution>
- <id>enforce</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireUpperBoundDeps/>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin> -->
</plugins>
<pluginManagement>
<plugins>