aboutsummaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src/test/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-08-25 17:05:37 -0400
committerJim Hahn <jrh3@att.com>2020-08-25 18:47:23 -0400
commit72cf248dced4e272e69a8c48f5ee24c9d345f41d (patch)
treeb09ed0f9b7ee7aac6493119d950d78d50ae08da1 /feature-pooling-dmaap/src/test/java/org
parent5c71b5a62f4208030b3c3cd18b3f42398a0a86e5 (diff)
Address more sonars in drools-pdp
Addressed the following sonars: - either log or rethrow - call "remove()" for thread-local-storage - use assertEquals - only one method call in exception test - swap arguments in assertEquals - add assertion to assertThatThrownBy() - explain @Ignore Also addressed eclipse warnings: - unused fields and methods Issue-ID: POLICY-2616 Change-Id: I6590c0d2b103885bc933014d48bf5fd92401cd80 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-pooling-dmaap/src/test/java/org')
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java20
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java3
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java4
4 files changed, 22 insertions, 9 deletions
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java
index d5b397a6..7f73a702 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/DmaapManagerTest.java
@@ -290,7 +290,7 @@ public class DmaapManagerTest {
@Test
public void testPublish() throws PoolingFeatureException {
// cannot publish before starting
- assertThatThrownBy(() -> mgr.publish(MSG)).as("publish,pre");
+ assertThatThrownBy(() -> mgr.publish(MSG)).as("publish,pre").isInstanceOf(PoolingFeatureException.class);
mgr.startPublisher();
@@ -306,7 +306,7 @@ public class DmaapManagerTest {
// stop and verify we can no longer publish
mgr.stopPublisher(0);
- assertThatThrownBy(() -> mgr.publish(MSG)).as("publish,stopped");
+ assertThatThrownBy(() -> mgr.publish(MSG)).as("publish,stopped").isInstanceOf(PoolingFeatureException.class);
}
@Test(expected = PoolingFeatureException.class)
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java
index bee25ff3..08c7ebe4 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -178,21 +178,33 @@ public class EndToEndFeatureTest {
}
}
+ /*
+ * This test should only be run manually, after configuring all of the fields,
+ * thus it is ignored.
+ */
@Ignore
@Test
- public void test_SingleHost() throws Exception {
+ public void test_SingleHost() throws Exception { // NOSONAR
run(70, 1);
}
+ /*
+ * This test should only be run manually, after configuring all of the fields,
+ * thus it is ignored.
+ */
@Ignore
@Test
- public void test_TwoHosts() throws Exception {
+ public void test_TwoHosts() throws Exception { // NOSONAR
run(200, 2);
}
+ /*
+ * This test should only be run manually, after configuring all of the fields,
+ * thus it is ignored.
+ */
@Ignore
@Test
- public void test_ThreeHosts() throws Exception {
+ public void test_ThreeHosts() throws Exception { // NOSONAR
run(200, 3);
}
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java
index 09e83852..662e0a7c 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/SerializerTest.java
@@ -97,7 +97,8 @@ public class SerializerTest {
assertEquals(msg.getChannel(), decoded.getChannel());
// invalid subclass when encoding
- assertThatThrownBy(() -> ser.encodeMsg(new Message() {})).isInstanceOf(JsonParseException.class)
+ Message msg2 = new Message() {};
+ assertThatThrownBy(() -> ser.encodeMsg(msg2)).isInstanceOf(JsonParseException.class)
.hasMessageContaining("cannot serialize");
// missing type when decoding
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java
index 82346f5c..7dc7b2fd 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -269,7 +269,7 @@ public class ProcessingStateTest extends SupportBasicStateTester {
String[] arr = captureHostArray();
- assertNotSame(arr, HOST_ARR3);
+ assertNotSame(HOST_ARR3, arr);
assertEquals(Arrays.asList(HOST_ARR3), Arrays.asList(arr));
}