summaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src/test/java/org
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-09-13 20:37:15 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-09-13 20:56:08 -0400
commitad83319991bdd6a25416eff9f0adde148e2eee35 (patch)
treebbaa601361802763cebf014160b87fa897d62a58 /feature-pooling-dmaap/src/test/java/org
parentc733c08b7201ffdee81c7dab2ed50a1ce8fd5bbb (diff)
Fix checkstyle for features submodules.
These are the remaining submodules that have checkstyle. Pretty clean compile after this. There were a couple of sonar fixes in there also. Issue-ID: POLICY-882 Change-Id: I8191ea1aa261f4a7b9d3d21c108572fd31db1b8c Signed-off-by: Pamela Dragosh <pdragosh@research.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.java6
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java145
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest2.java94
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureExceptionTest.java3
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureRtExceptionTest.java3
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java8
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java36
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java6
-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/extractor/ClassExtractorsTest.java5
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTestSupport.java2
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ExtractorExceptionTest.java1
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/FieldExtractorTest.java1
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MapExtractorTest.java8
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MethodExtractorTest.java1
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BasicMessageTester.java7
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java7
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/ForwardTest.java1
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java1
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageWithAssignmentsTester.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/BasicStateTester.java6
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/FilterUtilsTest.java1
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/InactiveStateTest.java5
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ProcessingStateTest.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/QueryStateTest.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java4
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java4
29 files changed, 255 insertions, 123 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 d48dea5b..e554a34a 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
@@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Arrays;
import java.util.LinkedList;
import java.util.concurrent.CountDownLatch;
@@ -70,6 +71,11 @@ public class DmaapManagerTest {
DmaapManager.setFactory(saveFactory);
}
+ /**
+ * Setup.
+ *
+ * @throws Exception throws an exception
+ */
@Before
public void setUp() throws Exception {
listener = mock(TopicListener.class);
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java
index 3c3466be..709f1b06 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java
@@ -27,6 +27,9 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.onap.policy.drools.pooling.PoolingProperties.PREFIX;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Arrays;
import java.util.Deque;
@@ -51,21 +54,19 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.common.endpoints.event.comm.FilterableTopicSource;
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.TopicSource;
+import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.pooling.message.Message;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.drools.utils.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
/**
* End-to-end tests of the pooling feature. Launches one or more "hosts", each one having
@@ -118,6 +119,10 @@ public class FeatureTest {
*/
private Context ctx;
+ /**
+ * Setup before class.
+ *
+ */
@BeforeClass
public static void setUpBeforeClass() {
saveFeatureFactory = PoolingFeature.getFactory();
@@ -127,6 +132,9 @@ public class FeatureTest {
// note: invoke runSlow() to slow things down
}
+ /**
+ * Tear down after class.
+ */
@AfterClass
public static void tearDownAfterClass() {
PoolingFeature.setFactory(saveFeatureFactory);
@@ -134,11 +142,17 @@ public class FeatureTest {
DmaapManager.setFactory(saveDmaapFactory);
}
+ /**
+ * Setup.
+ */
@Before
public void setUp() {
ctx = null;
}
+ /**
+ * Tear down.
+ */
@After
public void tearDown() {
if (ctx != null) {
@@ -189,15 +203,15 @@ public class FeatureTest {
* Invoke this to slow the timers down.
*/
protected static void runSlow() {
- stdReactivateWaitMs = 10000;
- stdIdentificationMs = 10000;
- stdStartHeartbeatMs = 15000;
- stdActiveHeartbeatMs = 12000;
- stdInterHeartbeatMs = 5000;
- stdOfflinePubWaitMs = 2;
- stdPollMs = 2;
- stdInterPollMs = 2000;
- stdEventWaitSec = 1000;
+ stdReactivateWaitMs = 10000;
+ stdIdentificationMs = 10000;
+ stdStartHeartbeatMs = 15000;
+ stdActiveHeartbeatMs = 12000;
+ stdInterHeartbeatMs = 5000;
+ stdOfflinePubWaitMs = 2;
+ stdPollMs = 2;
+ stdInterPollMs = 2000;
+ stdEventWaitSec = 1000;
}
/**
@@ -232,7 +246,7 @@ public class FeatureTest {
/**
* Counts the number of decode errors.
*/
- private final AtomicInteger nDecodeErrors = new AtomicInteger(0);
+ private final AtomicInteger numDecodeErrors = new AtomicInteger(0);
/**
* Number of events we're still waiting to receive.
@@ -246,14 +260,15 @@ public class FeatureTest {
private Host currentHost = null;
/**
+ * Constructor.
*
* @param nEvents number of events to be processed
*/
- public Context(int nEvents) {
+ public Context(int events) {
featureFactory = new FeatureFactory(this);
managerFactory = new ManagerFactory(this);
dmaapFactory = new DmaapFactory(this);
- eventCounter = new CountDownLatch(nEvents);
+ eventCounter = new CountDownLatch(events);
PoolingFeature.setFactory(featureFactory);
PoolingManagerImpl.setFactory(managerFactory);
@@ -298,10 +313,10 @@ public class FeatureTest {
* Verifies that all hosts processed at least one message.
*/
public void checkAllSawAMsg() {
- int x = 0;
+ int msgs = 0;
for (Host host : hosts) {
- assertTrue("x=" + x, host.messageSeen());
- ++x;
+ assertTrue("msgs=" + msgs, host.messageSeen());
+ ++msgs;
}
}
@@ -309,7 +324,7 @@ public class FeatureTest {
* Sets {@link #currentHost} to the specified host, and then invokes the given
* function. Resets {@link #currentHost} to {@code null} before returning.
*
- * @param host
+ * @param host host
* @param func function to invoke
*/
public void withHost(Host host, VoidFunction func) {
@@ -321,7 +336,7 @@ public class FeatureTest {
/**
* Offers an event to the external topic.
*
- * @param event
+ * @param event event
*/
public void offerExternal(String event) {
externalTopic.offer(event);
@@ -330,7 +345,7 @@ public class FeatureTest {
/**
* Adds an internal channel to the set of channels.
*
- * @param channel
+ * @param channel channel
* @param queue the channel's queue
*/
public void addInternal(String channel, BlockingQueue<String> queue) {
@@ -340,7 +355,7 @@ public class FeatureTest {
/**
* Offers a message to all internal channels.
*
- * @param message
+ * @param message message
*/
public void offerInternal(String message) {
channel2queue.values().forEach(queue -> queue.offer(message));
@@ -349,8 +364,8 @@ public class FeatureTest {
/**
* Offers amessage to an internal channel.
*
- * @param channel
- * @param message
+ * @param channel channel
+ * @param message message
*/
public void offerInternal(String channel, String message) {
BlockingQueue<String> queue = channel2queue.get(channel);
@@ -362,7 +377,7 @@ public class FeatureTest {
/**
* Decodes an event.
*
- * @param event
+ * @param event event
* @return the decoded event, or {@code null} if it cannot be decoded
*/
public Object decodeEvent(String event) {
@@ -372,15 +387,17 @@ public class FeatureTest {
/**
* Associates a controller with its drools controller.
*
- * @param controller
- * @param droolsController
+ * @param controller controller
+ * @param droolsController drools controller
*/
public void addController(PolicyController controller, DroolsController droolsController) {
drools2policy.put(droolsController, controller);
}
/**
- * @param droolsController
+ * Get controller.
+ *
+ * @param droolsController drools controller
* @return the controller associated with a drools controller, or {@code null} if
* it has no associated controller
*/
@@ -389,6 +406,8 @@ public class FeatureTest {
}
/**
+ * Constructor.
+ *
* @return queue for the external topic
*/
public BlockingQueue<String> getExternalTopic() {
@@ -396,21 +415,23 @@ public class FeatureTest {
}
/**
+ * Get decode errors.
*
* @return the number of decode errors so far
*/
public int getDecodeErrors() {
- return nDecodeErrors.get();
+ return numDecodeErrors.get();
}
/**
* Increments the count of decode errors.
*/
public void bumpDecodeErrors() {
- nDecodeErrors.incrementAndGet();
+ numDecodeErrors.incrementAndGet();
}
/**
+ * Get remaining events.
*
* @return the number of events that haven't been processed
*/
@@ -428,10 +449,10 @@ public class FeatureTest {
/**
* Waits, for a period of time, for all events to be processed.
*
- * @param time
- * @param units
+ * @param time time
+ * @param units units
* @return {@code true} if all events have been processed, {@code false} otherwise
- * @throws InterruptedException
+ * @throws InterruptedException throws interrupted
*/
public boolean awaitEvents(long time, TimeUnit units) throws InterruptedException {
return eventCounter.await(time, units);
@@ -478,8 +499,9 @@ public class FeatureTest {
private final DroolsController drools = mock(DroolsController.class);
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public Host(Context context) {
this.context = context;
@@ -502,6 +524,8 @@ public class FeatureTest {
}
/**
+ * Get name.
+ *
* @return the host name
*/
public String getName() {
@@ -543,9 +567,9 @@ public class FeatureTest {
/**
* Offers an event to the feature, before the policy controller handles it.
*
- * @param protocol
- * @param topic2
- * @param event
+ * @param protocol protocol
+ * @param topic2 topic
+ * @param event event
* @return {@code true} if the event was handled, {@code false} otherwise
*/
public boolean beforeOffer(CommInfrastructure protocol, String topic2, String event) {
@@ -555,10 +579,10 @@ public class FeatureTest {
/**
* Offers an event to the feature, after the policy controller handles it.
*
- * @param protocol
- * @param topic
- * @param event
- * @param success
+ * @param protocol protocol
+ * @param topic topic
+ * @param event event
+ * @param success success
* @return {@code true} if the event was handled, {@code false} otherwise
*/
public boolean afterOffer(CommInfrastructure protocol, String topic, String event, boolean success) {
@@ -569,7 +593,7 @@ public class FeatureTest {
/**
* Offers an event to the feature, before the drools controller handles it.
*
- * @param fact
+ * @param fact fact
* @return {@code true} if the event was handled, {@code false} otherwise
*/
public boolean beforeInsert(Object fact) {
@@ -579,7 +603,7 @@ public class FeatureTest {
/**
* Offers an event to the feature, after the drools controller handles it.
*
- * @param fact
+ * @param fact fact
* @param successInsert {@code true} if it was successfully inserted by the drools
* controller, {@code false} otherwise
* @return {@code true} if the event was handled, {@code false} otherwise
@@ -596,6 +620,7 @@ public class FeatureTest {
}
/**
+ * Message seen.
*
* @return {@code true} if a message was seen for this host, {@code false}
* otherwise
@@ -605,6 +630,8 @@ public class FeatureTest {
}
/**
+ * Get internal queue.
+ *
* @return the queue associated with this host's internal topic
*/
public BlockingQueue<String> getInternalQueue() {
@@ -628,10 +655,10 @@ public class FeatureTest {
@Override
public Void answer(InvocationOnMock args) throws Throwable {
- int i = 0;
- CommInfrastructure commType = args.getArgument(i++);
- String topic = args.getArgument(i++);
- String event = args.getArgument(i++);
+ int index = 0;
+ CommInfrastructure commType = args.getArgument(index++);
+ String topic = args.getArgument(index++);
+ String event = args.getArgument(index++);
if (host.beforeOffer(commType, topic, event)) {
return null;
@@ -676,8 +703,9 @@ public class FeatureTest {
private final Serializer serializer = new Serializer();
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public TopicSinkImpl(Context context) {
this.context = context;
@@ -732,8 +760,9 @@ public class FeatureTest {
private AtomicReference<Pair<CountDownLatch, CountDownLatch>> pair = new AtomicReference<>(null);
/**
+ * Constructor.
*
- * @param context
+ * @param context context
* @param internal {@code true} if to read from the internal topic, {@code false}
* to read from the external topic
*/
@@ -778,7 +807,8 @@ public class FeatureTest {
try {
do {
processMessages(newPair.first(), listener);
- } while (!newPair.first().await(stdInterPollMs, TimeUnit.MILLISECONDS));
+ }
+ while (!newPair.first().await(stdInterPollMs, TimeUnit.MILLISECONDS));
logger.info("topic source thread completed");
@@ -850,8 +880,8 @@ public class FeatureTest {
* Polls for messages from the topic and offers them to the listener.
*
* @param stopped triggered if processing should stop
- * @param listener
- * @throws InterruptedException
+ * @param listener listener
+ * @throws InterruptedException throws interrupted exception
*/
private void processMessages(CountDownLatch stopped, TopicListener listener) throws InterruptedException {
@@ -874,7 +904,7 @@ public class FeatureTest {
private static class TopicImpl implements Topic {
/**
- *
+ * Constructor.
*/
public TopicImpl() {
super();
@@ -954,8 +984,9 @@ public class FeatureTest {
private final Context context;
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public FeatureFactory(Context context) {
this.context = context;
@@ -1029,8 +1060,9 @@ public class FeatureTest {
private final TypeReference<TreeMap<String, String>> typeRef = new TypeReference<TreeMap<String, String>>() {};
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public ManagerFactory(Context context) {
@@ -1065,8 +1097,9 @@ public class FeatureTest {
private final Context context;
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public DmaapFactory(Context context) {
this.context = context;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest2.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest2.java
index 70bacb1b..050ca612 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest2.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest2.java
@@ -70,7 +70,7 @@ import org.slf4j.LoggerFactory;
* following are not: <dl> <dt>PolicyEngine, PolicyController, DroolsController</dt> <dd>mocked</dd>
* </dl>
*
- * <p> The following fields must be set before executing this: <ul> <li>UEB_SERVERS</li>
+ * <p>The following fields must be set before executing this: <ul> <li>UEB_SERVERS</li>
* <li>INTERNAL_TOPIC</li> <li>EXTERNAL_TOPIC</li> </ul>
*/
public class FeatureTest2 {
@@ -135,7 +135,10 @@ public class FeatureTest2 {
*/
private Context ctx;
-
+ /**
+ * Setup before class.
+ *
+ */
@BeforeClass
public static void setUpBeforeClass() {
saveFeatureFactory = PoolingFeature.getFactory();
@@ -149,6 +152,10 @@ public class FeatureTest2 {
internalSink.start();
}
+ /**
+ * Tear down after class.
+ *
+ */
@AfterClass
public static void tearDownAfterClass() {
PoolingFeature.setFactory(saveFeatureFactory);
@@ -159,11 +166,17 @@ public class FeatureTest2 {
internalSink.stop();
}
+ /**
+ * Setup.
+ */
@Before
public void setUp() {
ctx = null;
}
+ /**
+ * Tear down.
+ */
@After
public void tearDown() {
if (ctx != null) {
@@ -275,7 +288,7 @@ public class FeatureTest2 {
/**
* Counts the number of decode errors.
*/
- private final AtomicInteger nDecodeErrors = new AtomicInteger(0);
+ private final AtomicInteger decodeErrors = new AtomicInteger(0);
/**
* Number of events we're still waiting to receive.
@@ -283,13 +296,14 @@ public class FeatureTest2 {
private final CountDownLatch eventCounter;
/**
+ * Constructor.
*
* @param nEvents number of events to be processed
*/
- public Context(int nEvents) {
+ public Context(int events) {
featureFactory = new FeatureFactory(this);
managerFactory = new ManagerFactory(this);
- eventCounter = new CountDownLatch(nEvents);
+ eventCounter = new CountDownLatch(events);
PoolingFeature.setFactory(featureFactory);
PoolingManagerImpl.setFactory(managerFactory);
@@ -333,17 +347,17 @@ public class FeatureTest2 {
* Verifies that all hosts processed at least one message.
*/
public void checkAllSawAMsg() {
- int x = 0;
+ int msgs = 0;
for (Host host : hosts) {
- assertTrue("x=" + x, host.messageSeen());
- ++x;
+ assertTrue("msgs=" + msgs, host.messageSeen());
+ ++msgs;
}
}
/**
* Offers an event to the external topic.
*
- * @param event
+ * @param event event
*/
public void offerExternal(String event) {
externalSink.send(event);
@@ -352,7 +366,7 @@ public class FeatureTest2 {
/**
* Decodes an event.
*
- * @param event
+ * @param event event
* @return the decoded event, or {@code null} if it cannot be decoded
*/
public Object decodeEvent(String event) {
@@ -362,15 +376,17 @@ public class FeatureTest2 {
/**
* Associates a controller with its drools controller.
*
- * @param controller
- * @param droolsController
+ * @param controller controller
+ * @param droolsController drools controller
*/
public void addController(PolicyController controller, DroolsController droolsController) {
drools2policy.put(droolsController, controller);
}
/**
- * @param droolsController
+ * Get controller.
+ *
+ * @param droolsController drools controller
* @return the controller associated with a drools controller, or {@code null} if it has no
* associated controller
*/
@@ -379,21 +395,23 @@ public class FeatureTest2 {
}
/**
+ * Get decode errors.
*
* @return the number of decode errors so far
*/
public int getDecodeErrors() {
- return nDecodeErrors.get();
+ return decodeErrors.get();
}
/**
* Increments the count of decode errors.
*/
public void bumpDecodeErrors() {
- nDecodeErrors.incrementAndGet();
+ decodeErrors.incrementAndGet();
}
/**
+ * Get remaining events.
*
* @return the number of events that haven't been processed
*/
@@ -411,10 +429,10 @@ public class FeatureTest2 {
/**
* Waits, for a period of time, for all events to be processed.
*
- * @param time
- * @param units
+ * @param time time
+ * @param units units
* @return {@code true} if all events have been processed, {@code false} otherwise
- * @throws InterruptedException
+ * @throws InterruptedException throws interrupted exception
*/
public boolean awaitEvents(long time, TimeUnit units) throws InterruptedException {
return eventCounter.await(time, units);
@@ -424,7 +442,7 @@ public class FeatureTest2 {
* Waits, for a period of time, for all hosts to enter the Active state.
*
* @param timeMs maximum time to wait, in milliseconds
- * @throws InterruptedException
+ * @throws InterruptedException throws interrupted exception
*/
public void awaitAllActive(long timeMs) throws InterruptedException {
long tend = timeMs + System.currentTimeMillis();
@@ -457,8 +475,9 @@ public class FeatureTest2 {
private final DroolsController drools = mock(DroolsController.class);
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public Host(Context context) {
@@ -485,7 +504,7 @@ public class FeatureTest2 {
* @param timeMs time to wait, in milliseconds
* @return {@code true} if the host entered the Active state within the given amount of
* time, {@code false} otherwise
- * @throws InterruptedException
+ * @throws InterruptedException throws interrupted exception
*/
public boolean awaitActive(long timeMs) throws InterruptedException {
return feature.getActiveLatch().await(timeMs, TimeUnit.MILLISECONDS);
@@ -531,9 +550,9 @@ public class FeatureTest2 {
/**
* Offers an event to the feature, before the policy controller handles it.
*
- * @param protocol
- * @param topic2
- * @param event
+ * @param protocol protocol
+ * @param topic2 topic
+ * @param event event
* @return {@code true} if the event was handled, {@code false} otherwise
*/
public boolean beforeOffer(CommInfrastructure protocol, String topic2, String event) {
@@ -543,10 +562,10 @@ public class FeatureTest2 {
/**
* Offers an event to the feature, after the policy controller handles it.
*
- * @param protocol
- * @param topic
- * @param event
- * @param success
+ * @param protocol protocol
+ * @param topic topic
+ * @param event event
+ * @param success success
* @return {@code true} if the event was handled, {@code false} otherwise
*/
public boolean afterOffer(CommInfrastructure protocol, String topic, String event, boolean success) {
@@ -557,7 +576,7 @@ public class FeatureTest2 {
/**
* Offers an event to the feature, before the drools controller handles it.
*
- * @param fact
+ * @param fact fact
* @return {@code true} if the event was handled, {@code false} otherwise
*/
public boolean beforeInsert(Object fact) {
@@ -567,7 +586,7 @@ public class FeatureTest2 {
/**
* Offers an event to the feature, after the drools controller handles it.
*
- * @param fact
+ * @param fact fact
* @param successInsert {@code true} if it was successfully inserted by the drools
* controller, {@code false} otherwise
* @return {@code true} if the event was handled, {@code false} otherwise
@@ -584,6 +603,7 @@ public class FeatureTest2 {
}
/**
+ * Message seen.
*
* @return {@code true} if a message was seen for this host, {@code false} otherwise
*/
@@ -608,10 +628,10 @@ public class FeatureTest2 {
@Override
public Void answer(InvocationOnMock args) throws Throwable {
- int i = 0;
- CommInfrastructure commType = args.getArgument(i++);
- String topic = args.getArgument(i++);
- String event = args.getArgument(i++);
+ int index = 0;
+ CommInfrastructure commType = args.getArgument(index++);
+ String topic = args.getArgument(index++);
+ String event = args.getArgument(index++);
if (host.beforeOffer(commType, topic, event)) {
return null;
@@ -649,8 +669,9 @@ public class FeatureTest2 {
private final Context context;
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public FeatureFactory(Context context) {
this.context = context;
@@ -727,8 +748,9 @@ public class FeatureTest2 {
private final TypeReference<TreeMap<String, String>> typeRef = new TypeReference<TreeMap<String, String>>() {};
/**
+ * Constructor.
*
- * @param context
+ * @param context context
*/
public ManagerFactory(Context context) {
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureExceptionTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureExceptionTest.java
index 34b604c9..731736a1 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureExceptionTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureExceptionTest.java
@@ -20,7 +20,8 @@
package org.onap.policy.drools.pooling;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureRtExceptionTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureRtExceptionTest.java
index cbb24421..fcd23322 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureRtExceptionTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureRtExceptionTest.java
@@ -20,7 +20,8 @@
package org.onap.policy.drools.pooling;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;
import org.onap.policy.drools.pooling.PoolingFeatureRtException;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
index c57a9f6f..07fc757b 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
@@ -31,6 +31,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
@@ -38,8 +39,8 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.pooling.PoolingFeature.Factory;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyEngine;
@@ -95,6 +96,11 @@ public class PoolingFeatureTest {
PoolingFeature.setFactory(saveFactory);
}
+ /**
+ * Setup.
+ *
+ * @throws Exception exception
+ */
@Before
public void setUp() throws Exception {
props = initProperties();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
index d90bac4b..e6b6e4cd 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
@@ -34,6 +34,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.LinkedList;
import java.util.Properties;
import java.util.Queue;
@@ -46,9 +47,9 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
-import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
+import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.pooling.PoolingManagerImpl.Factory;
import org.onap.policy.drools.pooling.extractor.ClassExtractors;
import org.onap.policy.drools.pooling.message.BucketAssignments;
@@ -125,6 +126,11 @@ public class PoolingManagerImplTest {
PoolingManagerImpl.setFactory(saveFactory);
}
+ /**
+ * Setup.
+ *
+ * @throws Exception throws exception
+ */
@Before
public void setUp() throws Exception {
plainProps = new Properties();
@@ -202,7 +208,7 @@ public class PoolingManagerImplTest {
PolicyController ctlr = mock(PolicyController.class);
PoolingFeatureRtException ex = expectException(PoolingFeatureRtException.class,
- () -> new PoolingManagerImpl(MY_HOST, ctlr, poolProps, active));
+ () -> new PoolingManagerImpl(MY_HOST, ctlr, poolProps, active));
assertNotNull(ex.getCause());
assertTrue(ex.getCause() instanceof ClassCastException);
}
@@ -214,7 +220,7 @@ public class PoolingManagerImplTest {
when(factory.makeDmaapManager(any())).thenThrow(ex);
PoolingFeatureRtException ex2 = expectException(PoolingFeatureRtException.class,
- () -> new PoolingManagerImpl(MY_HOST, controller, poolProps, active));
+ () -> new PoolingManagerImpl(MY_HOST, controller, poolProps, active));
assertEquals(ex, ex2.getCause());
}
@@ -304,26 +310,26 @@ public class PoolingManagerImplTest {
Forward msg = new Forward(mgr.getHost(), CommInfrastructure.UEB, TOPIC2, THE_EVENT, REQUEST_ID);
mgr.handle(msg);
- verify(dmaap, times(START_PUB+1)).publish(any());
+ verify(dmaap, times(START_PUB + 1)).publish(any());
mgr.beforeStop();
verify(dmaap).stopConsumer(mgr);
verify(sched).shutdownNow();
- verify(dmaap, times(START_PUB+2)).publish(any());
+ verify(dmaap, times(START_PUB + 2)).publish(any());
verify(dmaap).publish(contains("offline"));
assertTrue(mgr.getCurrent() instanceof IdleState);
// verify that next message is handled locally
mgr.handle(msg);
- verify(dmaap, times(START_PUB+2)).publish(any());
+ verify(dmaap, times(START_PUB + 2)).publish(any());
verify(controller).onTopicEvent(CommInfrastructure.UEB, TOPIC2, THE_EVENT);
}
@Test
public void testBeforeStop_NotRunning() throws Exception {
- State st = mgr.getCurrent();
+ final State st = mgr.getCurrent();
mgr.beforeStop();
@@ -339,7 +345,7 @@ public class PoolingManagerImplTest {
// call beforeStart but not afterStart
mgr.beforeStart();
- State st = mgr.getCurrent();
+ final State st = mgr.getCurrent();
mgr.beforeStop();
@@ -624,7 +630,7 @@ public class PoolingManagerImplTest {
// route the message to this host
mgr.startDistributing(makeAssignments(true));
- CountDownLatch latch = catchRecursion(false);
+ final CountDownLatch latch = catchRecursion(false);
Forward msg = new Forward(mgr.getHost(), CommInfrastructure.UEB, TOPIC2, THE_EVENT, REQUEST_ID);
mgr.handle(msg);
@@ -644,7 +650,7 @@ public class PoolingManagerImplTest {
// route the message to this host
mgr.startDistributing(makeAssignments(true));
- CountDownLatch latch = catchRecursion(true);
+ final CountDownLatch latch = catchRecursion(true);
Forward msg = new Forward(mgr.getHost(), CommInfrastructure.UEB, TOPIC2, THE_EVENT, REQUEST_ID);
mgr.handle(msg);
@@ -870,7 +876,7 @@ public class PoolingManagerImplTest {
assertTrue(mgr.beforeInsert(CommInfrastructure.UEB, TOPIC2, THE_EVENT, DECODED_EVENT));
- verify(dmaap, times(START_PUB+1)).publish(any());
+ verify(dmaap, times(START_PUB + 1)).publish(any());
}
@Test
@@ -921,7 +927,7 @@ public class PoolingManagerImplTest {
// route the message to this host
mgr.startDistributing(makeAssignments(true));
- CountDownLatch latch = catchRecursion(true);
+ final CountDownLatch latch = catchRecursion(true);
Forward msg = new Forward(mgr.getHost(), CommInfrastructure.UEB, TOPIC2, THE_EVENT, REQUEST_ID);
mgr.handle(msg);
@@ -943,7 +949,7 @@ public class PoolingManagerImplTest {
// generate RuntimeException when onTopicEvent() is invoked
doThrow(new IllegalArgumentException("expected")).when(controller).onTopicEvent(any(), any(), any());
- CountDownLatch latch = catchRecursion(true);
+ final CountDownLatch latch = catchRecursion(true);
Forward msg = new Forward(mgr.getHost(), CommInfrastructure.UEB, TOPIC2, THE_EVENT, REQUEST_ID);
mgr.handle(msg);
@@ -975,7 +981,7 @@ public class PoolingManagerImplTest {
}
@Test
- public void testHandleInternal_IOEx() throws Exception {
+ public void testHandleInternal_IoEx() throws Exception {
startMgr();
mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, "invalid message");
@@ -1028,7 +1034,7 @@ public class PoolingManagerImplTest {
// route the message to the other host
mgr.startDistributing(makeAssignments(false));
assertTrue(mgr.beforeInsert(CommInfrastructure.UEB, TOPIC2, THE_EVENT, DECODED_EVENT));
- verify(dmaap, times(START_PUB+1)).publish(any());
+ verify(dmaap, times(START_PUB + 1)).publish(any());
}
@Test
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java
index eac8bfb1..cc716a2a 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingPropertiesTest.java
@@ -32,6 +32,7 @@ import static org.onap.policy.drools.pooling.PoolingProperties.POOLING_TOPIC;
import static org.onap.policy.drools.pooling.PoolingProperties.PREFIX;
import static org.onap.policy.drools.pooling.PoolingProperties.REACTIVATE_MS;
import static org.onap.policy.drools.pooling.PoolingProperties.START_HEARTBEAT_MS;
+
import java.util.Properties;
import java.util.function.Function;
import org.junit.Before;
@@ -57,6 +58,11 @@ public class PoolingPropertiesTest {
private Properties plain;
private PoolingProperties pooling;
+ /**
+ * Setup.
+ *
+ * @throws Exception throws an exception
+ */
@Before
public void setUp() throws Exception {
plain = makeProperties();
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 4206a836..0b098c13 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
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull;
import static org.onap.policy.drools.pooling.state.FilterUtils.makeAnd;
import static org.onap.policy.drools.pooling.state.FilterUtils.makeEquals;
import static org.onap.policy.drools.pooling.state.FilterUtils.makeOr;
+
import java.util.Map;
import java.util.TreeMap;
import org.junit.Test;
@@ -42,7 +43,7 @@ public class SerializerTest {
@Test
@SuppressWarnings("unchecked")
public void testEncodeFilter() throws Exception {
- Serializer ser = new Serializer();
+ final Serializer ser = new Serializer();
/*
* Ensure raw maps serialize as expected. Use a TreeMap so the field
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTest.java
index e6269a9a..c277a00f 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTest.java
@@ -23,6 +23,7 @@ package org.onap.policy.drools.pooling.extractor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
+
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
@@ -44,6 +45,10 @@ public class ClassExtractorsTest {
private Properties props;
private ClassExtractors map;
+ /**
+ * Setup.
+ *
+ */
@Before
public void setUp() {
props = new Properties();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTestSupport.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTestSupport.java
index 98b679d4..df42fe0f 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTestSupport.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTestSupport.java
@@ -28,7 +28,7 @@ public class ClassExtractorsTestSupport {
private ClassExtractorsTestSupport2 nested = new ClassExtractorsTestSupport2();
/**
- *
+ * Constructor.
*/
public ClassExtractorsTestSupport() {
super();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ExtractorExceptionTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ExtractorExceptionTest.java
index d1458de7..aef0a925 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ExtractorExceptionTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ExtractorExceptionTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.drools.pooling.extractor;
import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import org.onap.policy.common.utils.test.ExceptionsTester;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/FieldExtractorTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/FieldExtractorTest.java
index 9794bffa..7536d007 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/FieldExtractorTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/FieldExtractorTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.pooling.extractor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+
import java.lang.reflect.Field;
import org.junit.Before;
import org.junit.Test;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MapExtractorTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MapExtractorTest.java
index 48985bf3..afaa2b65 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MapExtractorTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MapExtractorTest.java
@@ -20,7 +20,9 @@
package org.onap.policy.drools.pooling.extractor;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
@@ -48,7 +50,7 @@ public class MapExtractorTest {
public void testExtract_MissingValue() {
Map<String,Object> map = new HashMap<>();
- map.put(KEY+"x", VALUE+"x");
+ map.put(KEY + "x", VALUE + "x");
// object is a map, but doesn't have the key
assertNull(ext.extract(map));
@@ -58,7 +60,7 @@ public class MapExtractorTest {
public void testExtract() {
Map<String,Object> map = new HashMap<>();
- map.put(KEY+"x", VALUE+"x");
+ map.put(KEY + "x", VALUE + "x");
map.put(KEY, VALUE);
// object is a map and contains the key
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MethodExtractorTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MethodExtractorTest.java
index ae5858e7..41f731fb 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MethodExtractorTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/MethodExtractorTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.pooling.extractor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+
import java.lang.reflect.Method;
import org.junit.Before;
import org.junit.Test;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BasicMessageTester.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BasicMessageTester.java
index 69d7e67c..2dab38d1 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BasicMessageTester.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BasicMessageTester.java
@@ -23,9 +23,10 @@ package org.onap.policy.drools.pooling.message;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.onap.policy.drools.pooling.PoolingFeatureException;
-import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Superclass used to test subclasses of {@link Message}.
@@ -49,6 +50,7 @@ public abstract class BasicMessageTester<T extends Message> {
private final Class<T> subclazz;
/**
+ * Constructor.
*
* @param subclazz subclass of {@link Message} being tested
*/
@@ -60,7 +62,6 @@ public abstract class BasicMessageTester<T extends Message> {
* Creates a default Message and verifies that the source and channel are
* {@code null}.
*
- * @return the default Message
*/
@Test
public final void testDefaultConstructor() {
@@ -71,8 +72,6 @@ public abstract class BasicMessageTester<T extends Message> {
* Tests that the Message has the correct source, and that the channel is
* {@code null}.
*
- * @param msg message to be checked
- * @param expectedSource what the source is expected to be
*/
@Test
public final void testConstructorWithArgs() {
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
index c14e8dba..5788141b 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/BucketAssignmentsTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import java.util.Arrays;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -41,7 +42,7 @@ public class BucketAssignmentsTest {
@Test
public void testBucketAssignmentsStringArray() {
- String arr[] = {"abc", "def"};
+ String[] arr = {"abc", "def"};
BucketAssignments asgn = new BucketAssignments(arr);
assertNotNull(asgn.getHostArray());
@@ -51,13 +52,13 @@ public class BucketAssignmentsTest {
@Test
public void testGetHostArray_testSetHostArray() {
- String arr[] = {"abc", "def"};
+ String[] arr = {"abc", "def"};
BucketAssignments asgn = new BucketAssignments(arr);
assertNotNull(asgn.getHostArray());
assertEquals(arr.toString(), asgn.getHostArray().toString());
- String arr2[] = {"xyz"};
+ String[] arr2 = {"xyz"};
asgn.setHostArray(arr2);
assertNotNull(asgn.getHostArray());
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/ForwardTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/ForwardTest.java
index 2549fa94..c51cafed 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/ForwardTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/ForwardTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java
index 432dcc3c..4e683ff9 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.pooling.message;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+
import org.junit.Test;
public class MessageTest extends BasicMessageTester<Message> {
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageWithAssignmentsTester.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageWithAssignmentsTester.java
index 2b670dcc..e5dfae9b 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageWithAssignmentsTester.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/MessageWithAssignmentsTester.java
@@ -22,6 +22,7 @@ package org.onap.policy.drools.pooling.message;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+
import org.junit.Test;
/**
@@ -31,7 +32,7 @@ import org.junit.Test;
*/
public abstract class MessageWithAssignmentsTester<T extends MessageWithAssignments> extends BasicMessageTester<T> {
// values set by makeValidMessage()
- public static final String[] VALID_ARRAY = {VALID_HOST, VALID_HOST+"_xxx"};
+ public static final String[] VALID_ARRAY = {VALID_HOST, VALID_HOST + "_xxx"};
public static final BucketAssignments VALID_ASGN = new BucketAssignments(VALID_ARRAY);
/**
@@ -41,6 +42,7 @@ public abstract class MessageWithAssignmentsTester<T extends MessageWithAssignme
private boolean nullAssignments;
/**
+ * Constructor.
*
* @param subclazz subclass of {@link MessageWithAssignments} being tested
*/
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java
index f2701038..9cb835c9 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java
@@ -33,6 +33,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Arrays;
import java.util.Map;
import org.junit.Before;
@@ -50,6 +51,9 @@ public class ActiveStateTest extends BasicStateTester {
private ActiveState state;
+ /**
+ * Setup.
+ */
@Before
public void setUp() throws Exception {
super.setUp();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/BasicStateTester.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/BasicStateTester.java
index 75ca7564..20f49a0e 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/BasicStateTester.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/BasicStateTester.java
@@ -27,6 +27,7 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -113,6 +114,11 @@ public class BasicStateTester {
super();
}
+ /**
+ * Setup.
+ *
+ * @throws Exception throws exception
+ */
public void setUp() throws Exception {
onceSchedules = new LinkedList<>();
onceTasks = new LinkedList<>();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/FilterUtilsTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/FilterUtilsTest.java
index ba517194..f4eb870e 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/FilterUtilsTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/FilterUtilsTest.java
@@ -31,6 +31,7 @@ import static org.onap.policy.drools.pooling.state.FilterUtils.JSON_VALUE;
import static org.onap.policy.drools.pooling.state.FilterUtils.makeAnd;
import static org.onap.policy.drools.pooling.state.FilterUtils.makeEquals;
import static org.onap.policy.drools.pooling.state.FilterUtils.makeOr;
+
import java.util.Map;
import org.junit.Test;
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java
index 497dbbb7..cf2c9c7c 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/IdleStateTest.java
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -42,6 +43,9 @@ public class IdleStateTest extends BasicStateTester {
private IdleState state;
+ /**
+ * Setup.
+ */
@Before
public void setUp() throws Exception {
super.setUp();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/InactiveStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/InactiveStateTest.java
index ae53ce05..ee7fd5e5 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/InactiveStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/InactiveStateTest.java
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -41,6 +42,10 @@ public class InactiveStateTest extends BasicStateTester {
private InactiveState state;
+ /**
+ * Setup.
+ *
+ */
@Before
public void setUp() throws Exception {
super.setUp();
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 7ac58439..4f634516 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
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Arrays;
import java.util.Map;
import org.junit.Before;
@@ -45,6 +46,9 @@ public class ProcessingStateTest extends BasicStateTester {
private ProcessingState state;
private HostBucket hostBucket;
+ /**
+ * Setup.
+ */
@Before
public void setUp() throws Exception {
super.setUp();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/QueryStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/QueryStateTest.java
index 7cd37581..5601932e 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/QueryStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/QueryStateTest.java
@@ -30,6 +30,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -44,6 +45,9 @@ public class QueryStateTest extends BasicStateTester {
private QueryState state;
+ /**
+ * Setup.
+ */
@Before
public void setUp() throws Exception {
super.setUp();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java
index 18f12ff8..faafb8cb 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -46,6 +47,9 @@ public class StartStateTest extends BasicStateTester {
private StartState state;
+ /**
+ * Setup.
+ */
@Before
public void setUp() throws Exception {
super.setUp();
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java
index e3d383d9..42bb35f2 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StateTest.java
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -47,6 +48,9 @@ public class StateTest extends BasicStateTester {
private State state;
+ /**
+ * Setup.
+ */
@Before
public void setUp() throws Exception {
super.setUp();