diff options
author | Jim Hahn <jrh3@att.com> | 2021-09-02 09:39:37 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-09-02 09:52:26 -0400 |
commit | 347bc1022aba20ae134848ef1a04930e9cb69b09 (patch) | |
tree | 0ecdbc187da9f01bb9f47ea7254a4da5afaa1282 /main/src/test | |
parent | 522374b238ce34fa20d67ecfd7af0a88ce3e2663 (diff) |
Fix PAP PDP expiration timer
Added runtime exceptions to the "catch" clause so that the thread
associated with the PDP expiration timer will not terminate.
Also added to a few other "catch" clauses, particularly those in the
REST controllers.
Issue-ID: POLICY-3625
Change-Id: I9206121d3e9b91da593ae771e7586752b13949be
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/PdpModifyRequestMapTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java index 27c01e18..e626d28d 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java @@ -56,6 +56,7 @@ import org.mockito.Captor; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.pdp.concepts.Pdp; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpMessage; @@ -423,6 +424,13 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { } @Test + public void testRemoveExpiredPdps_DaoRtEx() throws Exception { + when(dao.getFilteredPdpGroups(any())).thenThrow(makeRuntimeException()); + + assertThatCode(map::removeExpiredPdps).doesNotThrowAnyException(); + } + + @Test public void testRemoveFromSubgroup() throws Exception { PdpGroup group = makeGroup(MY_GROUP); group.setPdpSubgroups(List.of(makeSubGroup(MY_SUBGROUP, PDP1, PDP2, PDP3))); @@ -454,6 +462,10 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { return new PfModelException(Status.BAD_REQUEST, "expected exception"); } + protected PfModelRuntimeException makeRuntimeException() { + return new PfModelRuntimeException(Status.BAD_REQUEST, "expected exception"); + } + @Test public void testMakePdpRequests() { // this should invoke the real method without throwing an exception |