diff options
author | Jim Hahn <jrh3@att.com> | 2019-04-10 08:48:10 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-04-10 20:39:23 -0400 |
commit | c1df0a9b44dacc6defe1df5f1a2f72ac5c6ec433 (patch) | |
tree | ea440c3cd8dd9f70ff361ec813055e61d96abc7d /main/src/test/java/org/onap | |
parent | e9df7cf30026787a3cbbae81b4442234609423cd (diff) |
Remove PDP from all active groups
The code to disable a PDP used the group name, extracted from a
prior PdpUpdate request, to identify the group from which the PDP
should be removed. This is not sufficient, as the requests tracker
may have never seen an update request. Therefore, the code was
modified to simply remove the PDP from all active groups. Also
made removeFromGroups(pdpName) public so that it can be used by
other PAP code.
Change-Id: Iedec88cb23e586944563dcc5ac82ff3b9f122f8c
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test/java/org/onap')
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java | 14 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/comm/PdpRequestsTest.java | 22 |
2 files changed, 0 insertions, 36 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 199ebcf1..a92ff95b 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 @@ -293,8 +293,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { public void testDisablePdp() { map.addRequest(update); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - // indicate failure invokeFailureHandler(1); @@ -316,8 +314,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { map.addRequest(change); map.stopPublishing(PDP1); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - invokeFailureHandler(1); // should not have stopped publishing a second time @@ -338,8 +334,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { public void testRemoveFromGroup() throws Exception { map.addRequest(change); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - PdpGroup group = makeGroup(MY_GROUP, MY_VERSION); group.setPdpSubgroups(Arrays.asList(makeSubGroup(MY_SUBGROUP + "a", PDP1 + "a"), makeSubGroup(MY_SUBGROUP, PDP1), makeSubGroup(MY_SUBGROUP + "c", PDP1 + "c"))); @@ -364,8 +358,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { public void testRemoveFromGroup_DaoEx() throws Exception { map.addRequest(change); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - when(dao.getFilteredPdpGroups(any())).thenThrow(new PfModelException(Status.BAD_REQUEST, "expected exception")); invokeFailureHandler(1); @@ -382,8 +374,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { public void testRemoveFromGroup_NoGroups() throws Exception { map.addRequest(change); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - invokeFailureHandler(1); verify(dao, never()).updatePdpGroups(any()); @@ -393,8 +383,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { public void testRemoveFromGroup_NoMatchingSubgroup() throws Exception { map.addRequest(change); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - PdpGroup group = makeGroup(MY_GROUP, MY_VERSION); group.setPdpSubgroups(Arrays.asList(makeSubGroup(MY_SUBGROUP, DIFFERENT))); @@ -409,8 +397,6 @@ public class PdpModifyRequestMapTest extends CommonRequestBase { public void testRemoveFromSubgroup() throws Exception { map.addRequest(change); - when(requests.getLastGroupName()).thenReturn(MY_GROUP); - PdpGroup group = makeGroup(MY_GROUP, MY_VERSION); group.setPdpSubgroups(Arrays.asList(makeSubGroup(MY_SUBGROUP, PDP1, PDP1 + "x", PDP1 + "y"))); diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpRequestsTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpRequestsTest.java index e219c1d5..1bf73225 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpRequestsTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpRequestsTest.java @@ -23,7 +23,6 @@ package org.onap.policy.pap.main.comm; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.never; @@ -60,27 +59,6 @@ public class PdpRequestsTest extends CommonRequestBase { } @Test - public void testRecordGroup_testGetLatestGroupXxx() { - assertNull(data.getLastGroupName()); - - data.addSingleton(update); - assertEquals(MY_GROUP, data.getLastGroupName()); - - UpdateReq req = makeUpdateReq(PDP1, MY_GROUP, MY_SUBGROUP); - req.getMessage().setPdpGroup(DIFFERENT); - data.addSingleton(req); - assertEquals(DIFFERENT, data.getLastGroupName()); - - // doesn't record info from other message types - StateChangeReq req2 = change; - req2.getMessage().setPdpGroup(MY_GROUP); - data.addSingleton(req2); - - // should be unchanged - assertEquals(DIFFERENT, data.getLastGroupName()); - } - - @Test public void testAddSingleton() { data.addSingleton(update); |