summaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'feature-pooling-dmaap/src/test')
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/ActiveStateTest.java34
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/StartStateTest.java12
-rw-r--r--feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java6
3 files changed, 26 insertions, 26 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 e24c3c1e..d8ed62c8 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
@@ -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.
* Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,6 +38,7 @@ import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.drools.pooling.message.BucketAssignments;
@@ -46,7 +47,6 @@ import org.onap.policy.drools.pooling.message.Leader;
import org.onap.policy.drools.pooling.message.Message;
import org.onap.policy.drools.pooling.message.Offline;
import org.onap.policy.drools.pooling.message.Query;
-import org.onap.policy.drools.utils.Triple;
public class ActiveStateTest extends SupportBasicStateTester {
@@ -304,18 +304,18 @@ public class ActiveStateTest extends SupportBasicStateTester {
// heart beat generator
timer = repeatedTasks.remove();
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getMiddle().longValue());
// my heart beat checker
timer = repeatedTasks.remove();
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getMiddle().longValue());
// predecessor's heart beat checker
timer = repeatedTasks.remove();
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getMiddle().longValue());
}
@Test
@@ -333,13 +333,13 @@ public class ActiveStateTest extends SupportBasicStateTester {
// heart beat generator
timer = repeatedTasks.remove();
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_INTER_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, timer.getMiddle().longValue());
// my heart beat checker
timer = repeatedTasks.remove();
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.first().longValue());
- assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.second().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getLeft().longValue());
+ assertEquals(STD_ACTIVE_HEARTBEAT_MS, timer.getMiddle().longValue());
}
@Test
@@ -356,7 +356,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
verify(mgr).publish(anyString(), any(Heartbeat.class));
// fire the task
- assertNull(task.third().fire());
+ assertNull(task.getRight().fire());
// should have generated a second pair of heart beats
verify(mgr, times(2)).publish(anyString(), any(Heartbeat.class));
@@ -381,7 +381,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goInactive()).thenReturn(next);
// fire the task - should not transition
- assertNull(task.third().fire());
+ assertNull(task.getRight().fire());
verify(mgr, never()).publishAdmin(any(Query.class));
}
@@ -398,7 +398,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goStart()).thenReturn(next);
// fire the task - should transition
- assertEquals(next, task.third().fire());
+ assertEquals(next, task.getRight().fire());
// should continue to distribute
verify(mgr, never()).startDistributing(null);
@@ -423,7 +423,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goQuery()).thenReturn(next);
// fire the task - should NOT transition
- assertNull(task.third().fire());
+ assertNull(task.getRight().fire());
verify(mgr, never()).publishAdmin(any(Query.class));
}
@@ -440,7 +440,7 @@ public class ActiveStateTest extends SupportBasicStateTester {
when(mgr.goQuery()).thenReturn(next);
// fire the task - should transition
- assertEquals(next, task.third().fire());
+ assertEquals(next, task.getRight().fire());
verify(mgr).publishAdmin(any(Query.class));
}
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 1fd49c50..142fbf7e 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
@@ -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.
* Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,6 +33,7 @@ import static org.mockito.Mockito.when;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.drools.pooling.message.Forward;
@@ -42,7 +43,6 @@ import org.onap.policy.drools.pooling.message.Leader;
import org.onap.policy.drools.pooling.message.Message;
import org.onap.policy.drools.pooling.message.Offline;
import org.onap.policy.drools.pooling.message.Query;
-import org.onap.policy.drools.utils.Triple;
public class StartStateTest extends SupportBasicStateTester {
@@ -92,15 +92,15 @@ public class StartStateTest extends SupportBasicStateTester {
*/
Triple<Long, Long, StateTimerTask> generator = repeatedTasks.removeFirst();
- assertEquals(STD_INTER_HEARTBEAT_MS, generator.first().longValue());
- assertEquals(STD_INTER_HEARTBEAT_MS, generator.second().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, generator.getLeft().longValue());
+ assertEquals(STD_INTER_HEARTBEAT_MS, generator.getMiddle().longValue());
// invoke the task - it should generate another heartbeat
- assertEquals(null, generator.third().fire());
+ assertEquals(null, generator.getRight().fire());
verify(mgr, times(2)).publish(MY_HOST, msg.getRight());
// and again
- assertEquals(null, generator.third().fire());
+ assertEquals(null, generator.getRight().fire());
verify(mgr, times(3)).publish(MY_HOST, msg.getRight());
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java
index a1246938..1a65c802 100644
--- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.java
+++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/state/SupportBasicStateTester.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.
* Modifications Copyright (C) 2020 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,13 +37,13 @@ import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
import org.onap.policy.drools.pooling.CancellableScheduledTask;
import org.onap.policy.drools.pooling.PoolingManager;
import org.onap.policy.drools.pooling.PoolingProperties;
import org.onap.policy.drools.pooling.message.BucketAssignments;
import org.onap.policy.drools.pooling.message.Leader;
import org.onap.policy.drools.pooling.message.Message;
-import org.onap.policy.drools.utils.Triple;
/**
* Superclass used to test subclasses of {@link State}.
@@ -179,7 +179,7 @@ public class SupportBasicStateTester {
// capture scheduleWithFixedDelay() arguments, and return a new future
when(mgr.scheduleWithFixedDelay(anyLong(), anyLong(), any(StateTimerTask.class))).thenAnswer(invocation -> {
Object[] args = invocation.getArguments();
- repeatedTasks.add(new Triple<>((Long) args[0], (Long) args[1], (StateTimerTask) args[2]));
+ repeatedTasks.add(Triple.of((Long) args[0], (Long) args[1], (StateTimerTask) args[2]));
CancellableScheduledTask sched = mock(CancellableScheduledTask.class);
repeatedSchedules.add(sched);