summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2020-09-03 12:56:54 +0100
committerwaynedunican <wayne.dunican@est.tech>2020-09-03 17:17:02 +0100
commit917ebfc9561115b66b03a7bb2a1ade38d3667219 (patch)
treefed344f18ce12df69a5d022401fc734f284d1bdc
parent6f154bcd5c86bf9027d297df8cbdb8310eb88754 (diff)
Sonar Bug fixes
Removal of remaining bugs in apex-pdp Issue-ID: POLICY-2774 Change-Id: I370796e7c8a41c116155155c33176512e9e0cd91 Signed-off-by: waynedunican <wayne.dunican@est.tech>
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java2
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java2
-rw-r--r--core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java2
-rw-r--r--plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutorTest.java2
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java14
5 files changed, 11 insertions, 11 deletions
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
index db13069f1..9c73be559 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java
@@ -67,7 +67,7 @@ public class SupportMessageTester {
// disabling sonar because this code tests the equals() method
assertEquals(dummyMessage, dummyMessage); // NOSONAR
assertNotNull(dummyMessage);
- assertNotEquals(dummyMessage, new StartEngine(new AxArtifactKey()));
+ assertNotEquals(dummyMessage, (Object) new StartEngine(new AxArtifactKey()));
dummyMessage = new DummyMessage(new DummyAction(null), null, null);
DummyMessage otherDummyMessage = new DummyMessage(null, null, null);
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java
index 35fe5bb9f..ffaf07a00 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java
@@ -76,7 +76,7 @@ public class ResponseTest {
// disabling sonar because this code tests the equals() method
assertEquals(message, message); // NOSONAR
assertNotNull(message);
- assertNotEquals(message, new StartEngine(new AxArtifactKey()));
+ assertNotEquals(message, (Object) new StartEngine(new AxArtifactKey()));
message = new Response(null, false, responseTo);
Response otherMessage = new Response(null, false, null);
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java
index 13d37a8f6..b2822ba93 100644
--- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java
+++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java
@@ -72,7 +72,7 @@ public class UpdateModelTest {
// disabling sonar because this code tests the equals() method
assertEquals(message, message); // NOSONAR
assertNotNull(message);
- assertNotEquals(message, new StartEngine(new AxArtifactKey()));
+ assertNotEquals(message, (Object) new StartEngine(new AxArtifactKey()));
message = new UpdateModel(null, null, false, false);
UpdateModel otherMessage = new UpdateModel(null, null, false, false);
diff --git a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutorTest.java b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutorTest.java
index 948fc02ed..20ba1291f 100644
--- a/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutorTest.java
+++ b/plugins/plugins-executor/plugins-executor-javascript/src/test/java/org/onap/policy/apex/plugins/executor/javascript/JavascriptExecutorTest.java
@@ -33,7 +33,7 @@ public class JavascriptExecutorTest {
public void testReturnOK() throws StateMachineException {
JavascriptExecutor executor = new JavascriptExecutor(
new AxArtifactKey("TestTask:0.0.1"), "true;");
- assertThatCode(() -> executor.execute(new Object()));
+ assertThatCode(() -> executor.execute(new Object())).doesNotThrowAnyException();
}
@Test
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
index 5c79fa4bc..1b80af3f2 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +25,6 @@ import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.StrBuilder;
import org.slf4j.ext.XLoggerFactory;
import org.slf4j.helpers.MessageFormatter;
@@ -188,7 +188,7 @@ public final class Console {
return;
}
- final StrBuilder err = new StrBuilder();
+ final StringBuilder err = new StringBuilder();
if (appName != null) {
err.append(this.getAppName()).append(": ");
}
@@ -196,10 +196,10 @@ public final class Console {
err.append(MessageFormatter.arrayFormat(message, objects).getMessage());
if ((types & TYPE_ERROR) == TYPE_ERROR) {
- ERR_STREAM.println(err.build());
+ ERR_STREAM.println(err.toString());
}
if ((configuration & CONFIG_COLLECT_ERRORS) == CONFIG_COLLECT_ERRORS) {
- errors.add(err.build());
+ errors.add(err.toString());
}
}
@@ -217,7 +217,7 @@ public final class Console {
return;
}
- final StrBuilder warn = new StrBuilder();
+ final StringBuilder warn = new StringBuilder();
if (appName != null) {
warn.append(this.getAppName()).append(": ");
}
@@ -225,10 +225,10 @@ public final class Console {
warn.append(MessageFormatter.arrayFormat(message, objects).getMessage());
if ((types & TYPE_WARNING) == TYPE_WARNING) {
- ERR_STREAM.println(warn.build());
+ ERR_STREAM.println(warn.toString());
}
if ((configuration & CONFIG_COLLECT_WARNINGS) == CONFIG_COLLECT_WARNINGS) {
- warnings.add(warn.build());
+ warnings.add(warn.toString());
}
}