diff options
author | Jim Hahn <jrh3@att.com> | 2019-04-30 14:39:43 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-04-30 14:39:43 -0400 |
commit | 8b35ccbcaa5c61fa9dfce1add0ec8b1d10f84c72 (patch) | |
tree | cb4acc8df527de87e55fe2e0df3825a2b55f07fd /main/src/test | |
parent | 7cab98ba7db4ae718124c762e5ea1fb25f8d447e (diff) |
Cancel PDP timers in PAP
When a response is received by PAP from a PDP, the associated timer
(and listener) are not being cancelled. As a result, when the timer
later expired, PAP was re-sending the request. Modified the code to fix
this.
Change-Id: Id63f76622c01d286c169b618f8369b849ff31085
Issue-ID: POLICY-1715
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test')
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java index 2446533e..3d90fcbb 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java @@ -109,6 +109,9 @@ public class RequestImplTest extends CommonRequestBase { PdpStateChange msg2 = new PdpStateChange(); req.reconfigure(msg2, null); + // should have cancelled the first timer + verify(timer).cancel(); + // should only be one token in the queue QueueToken<PdpMessage> token = queue.poll(); assertNotNull(token); @@ -133,6 +136,9 @@ public class RequestImplTest extends CommonRequestBase { PdpStateChange msg2 = new PdpStateChange(); req.reconfigure(msg2, null); + // should have cancelled the first timer + verify(timer).cancel(); + // should only be one token in the queue QueueToken<PdpMessage> token = queue.poll(); assertNotNull(token); @@ -193,6 +199,9 @@ public class RequestImplTest extends CommonRequestBase { verify(timers, times(1)).register(any(), any()); verify(publisher, times(1)).enqueue(any()); assertNull(queue.poll()); + + // should NOT have cancelled the timer + verify(timer, never()).cancel(); } @Test @@ -400,6 +409,7 @@ public class RequestImplTest extends CommonRequestBase { verify(listener).success(PDP1); verify(listener, never()).failure(any(), any()); + verify(timer).cancel(); } @Test @@ -424,6 +434,7 @@ public class RequestImplTest extends CommonRequestBase { verify(listener, never()).success(any()); verify(listener).failure(DIFFERENT, "PDP name does not match"); + verify(timer).cancel(); } @Test |