From a45f8909871dc1ddb75845f067a602951afc8d11 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 19 Feb 2018 16:56:06 -0500 Subject: Sonar fixes to drools-pdp Fixed most of the instances of the following sonar issues: Moved array designator Used diamond operator Changed System.out/err to use a logger Changed several Thread.sleep() in test code to a single sleep() Useless assignments Replaced comparison with "" to string.isEmpty() Merged if's Replaced ArrayList with List in method returns Reordered type modifiers Reordered constructor methods Defined constants for literals, or replaced them with method calls Removed "throws Xxx" for subclasses of RuntimeException Combined identical "catch" blocks Re-interrupted the current thread after catching an InterruptedException Removed tests against the literal "false" Fix indentation of new makeTopicOperError() method. Fix exception variable name in new methods, logNoUebEncoder() and logNoDmaapEncoder(). Change-Id: Iddae5210553662f733b67333b372dec8c3fe2c94 Issue-ID: POLICY-336 Signed-off-by: Jim Hahn --- .../protocol/coders/ProtocolCoderToolsetTest.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'policy-management/src/test') diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java index e3dd7c54..c7113cd4 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java @@ -20,16 +20,13 @@ package org.onap.policy.drools.protocol.coders; -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Properties; + import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -47,6 +44,11 @@ import org.onap.policy.drools.utils.Triple; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + /** * ProtocolCoder Toolset JUNITs */ @@ -157,7 +159,8 @@ public class ProtocolCoderToolsetTest { decode(protocolFilter, coderToolset, triple, tripleEncoded); } - private void decode(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset, + @SuppressWarnings("unchecked") + private void decode(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset, Triple triple, String tripleEncoded) { Triple tripleDecoded = null; @@ -273,9 +276,8 @@ public class ProtocolCoderToolsetTest { droolsControllerConfig.put(PolicyProperties.PROPERTY_NOOP_SINK_TOPICS + "." + JUNIT_PROTOCOL_CODER_TOPIC + PolicyProperties.PROPERTY_TOPIC_EVENTS_SUFFIX, Triple.class.getCanonicalName()); - - DroolsController droolsController = - DroolsController.factory.build(droolsControllerConfig, null, noopTopics); + + DroolsController.factory.build(droolsControllerConfig, null, noopTopics); } private JsonProtocolFilter createFilterSet() { -- cgit 1.2.3-korg