diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java | 2 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/comm/msgdata/RequestImplTest.java | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java index c17d4086..1945b32d 100644 --- a/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java +++ b/main/src/main/java/org/onap/policy/pap/main/comm/msgdata/RequestImpl.java @@ -258,6 +258,8 @@ public abstract class RequestImpl implements Request { return; } + svcmgr.stop(); + String reason = checkResponse(response); if (reason != null) { logger.info("{} PDP data mismatch via {} {}: {}", getName(), infra, topic, reason); 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 |