diff options
author | 2018-04-17 18:00:40 -0400 | |
---|---|---|
committer | 2018-04-20 17:23:11 +0000 | |
commit | 4bc349ba8c4df586b285f2b7f140643617366e10 (patch) | |
tree | 60be3e49b486ba046d3535fae220fdb6a3dd6f6a /feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java | |
parent | ad73d3c3e46b2de77ee0a97788c51896a3fd36de (diff) |
Add comprehensive junit tests for pooling feature
Added FeatureTest.java and FeatureTest2.java.
Fixed a number of issues that were identified via the above
tests.
Moved fixes of policy-endpoints to other JIRA tickets.
Resolved potential sonar issue with commented-out code by
making STD_XXX constants into plain variables to they could be
changed via a method call.
Changed stdEventWaitMs to stdEventWaitSec.
Change-Id: Icf8fcc9b0dfe2578aa0787e0c9224a6f76a068ee
Issue-ID: POLICY-748
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java')
-rw-r--r-- | feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java | 26 |
1 files changed, 13 insertions, 13 deletions
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 7b4b0602..27284dcd 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 @@ -298,18 +298,18 @@ public class ActiveStateTest extends BasicStateTester { // heart beat generator timer = repeatedTasks.remove(); - assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue()); - assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue()); + assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue()); + assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue()); // my heart beat checker timer = repeatedTasks.remove(); - assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue()); - assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue()); + assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue()); + assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue()); // predecessor's heart beat checker timer = repeatedTasks.remove(); - assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue()); - assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue()); + assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue()); + assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue()); } @Test @@ -327,13 +327,13 @@ public class ActiveStateTest extends BasicStateTester { // heart beat generator timer = repeatedTasks.remove(); - assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue()); - assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue()); + assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue()); + assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue()); // my heart beat checker timer = repeatedTasks.remove(); - assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue()); - assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue()); + assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue()); + assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue()); } @Test @@ -389,13 +389,13 @@ public class ActiveStateTest extends BasicStateTester { // set up next state State next = mock(State.class); - when(mgr.goInactive()).thenReturn(next); + when(mgr.goStart()).thenReturn(next); // fire the task - should transition assertEquals(next, task.third().fire()); - // should indicate failure - verify(mgr).internalTopicFailed(); + // should stop distributing + verify(mgr).startDistributing(null); // should publish an offline message Offline msg = captureAdminMessage(Offline.class); |