diff options
author | Jim Hahn <jrh3@att.com> | 2020-07-21 09:55:38 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-07-21 16:25:53 -0400 |
commit | 248a660d61fa03caa4710cf8cfe144eb245b807b (patch) | |
tree | 9f7c9aa7fda6d9ab9977bf2398a0136a787dc62a /models-interactions/model-actors/actor.test | |
parent | f203526d0f86d385976da394bd1f0f918e4445d9 (diff) |
Fix some sonars in policy-models
Fixed the following sonar issues in some of the project directories:
- use assertNull, assertEquals, etc.
- swap assertEquals arguments
- extract a constant
- don't invoke toString() in logger calls
- TODOs
- generic types
Issue-ID: POLICY-2714
Change-Id: Id8803f9bf617ea9fc173a67b8606600709b55bdc
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.test')
5 files changed, 14 insertions, 17 deletions
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java index c8b69677f..fc4545966 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java @@ -45,8 +45,10 @@ import org.onap.policy.simulators.Util; /** * Superclass for various BidirectionalTopicOperation tests. + * + * @param <Q> request type */ -public abstract class BasicBidirectionalTopicOperation extends BasicOperation { +public abstract class BasicBidirectionalTopicOperation<Q> extends BasicOperation { protected static final String MY_SINK = "my-sink"; protected static final String MY_SOURCE = "my-source"; protected static final int TIMEOUT_SEC = 10; @@ -74,8 +76,7 @@ public abstract class BasicBidirectionalTopicOperation extends BasicOperation { @Mock protected BidirectionalTopicConfig config; - @SuppressWarnings("rawtypes") - private TopicServer topicServer; + private TopicServer<Q> topicServer; /** * Constructs the object using a default actor and operation name. @@ -161,8 +162,7 @@ public abstract class BasicBidirectionalTopicOperation extends BasicOperation { * @param source topic from which the simulator should receive messages * @return a new topic server/simulator */ - @SuppressWarnings("rawtypes") - protected abstract TopicServer makeServer(TopicSink sink, TopicSource source); + protected abstract TopicServer<Q> makeServer(TopicSink sink, TopicSource source); /** * Initializes a configuration. diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java index 4331edb04..02225759c 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicHttpOperation.java @@ -42,10 +42,8 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig; /** * Superclass for various HttpOperation tests. - * - * @param <Q> request type */ -public class BasicHttpOperation<Q> extends BasicOperation { +public class BasicHttpOperation extends BasicOperation { protected static final String MY_CLIENT = "my-client"; protected static final String BASE_URI = "http://my-host:6969/base-uri/"; protected static final String PATH = "my-path/"; diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java index afb8f075e..17ddb391a 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java @@ -48,7 +48,7 @@ public class BasicBidirectionalTopicOperationTest { @Mock private BiConsumer<String, StandardCoderObject> listener; - private BasicBidirectionalTopicOperation oper; + private BasicBidirectionalTopicOperation<String> oper; @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -133,7 +133,7 @@ public class BasicBidirectionalTopicOperationTest { .withMessage("response is not a Map"); } - private static class MyOperation extends BasicBidirectionalTopicOperation { + private static class MyOperation extends BasicBidirectionalTopicOperation<String> { public MyOperation() { super(); } @@ -149,8 +149,7 @@ public class BasicBidirectionalTopicOperationTest { } @Override - @SuppressWarnings("rawtypes") - protected TopicServer makeServer(TopicSink sink, TopicSource source) { + protected TopicServer<String> makeServer(TopicSink sink, TopicSource source) { return new TopicServer<String>(sink, source, null, String.class) { @Override protected String process(String request) { diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java index c19aa487c..2327fec00 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicHttpOperationTest.java @@ -35,18 +35,18 @@ public class BasicHttpOperationTest { private static final String ACTOR = "my-actor"; private static final String OPERATION = "my-operation"; - private BasicHttpOperation<String> oper; + private BasicHttpOperation oper; @Before public void setUp() throws Exception { - oper = new BasicHttpOperation<>(ACTOR, OPERATION); + oper = new BasicHttpOperation(ACTOR, OPERATION); oper.setUpBasic(); } @Test public void testBasicHttpOperation() { - oper = new BasicHttpOperation<>(); + oper = new BasicHttpOperation(); assertEquals(BasicOperation.DEFAULT_ACTOR, oper.actorName); assertEquals(BasicOperation.DEFAULT_OPERATION, oper.operationName); } diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java index 5eb35e9d0..047378baf 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicOperationTest.java @@ -47,13 +47,13 @@ public class BasicOperationTest { @Before public void setUp() throws Exception { - oper = new BasicHttpOperation<>(ACTOR, OPERATION); + oper = new BasicHttpOperation(ACTOR, OPERATION); oper.setUpBasic(); } @Test public void testBasicHttpOperation() { - oper = new BasicHttpOperation<>(); + oper = new BasicHttpOperation(); assertEquals(BasicHttpOperation.DEFAULT_ACTOR, oper.actorName); assertEquals(BasicHttpOperation.DEFAULT_OPERATION, oper.operationName); } |