From 3099737067f918599e83a6a7478a92bc208fe2ed Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 31 Oct 2019 17:58:45 -0400 Subject: Add tests for policy type in notifications The junit tests verified that the policy specified in the notifications, but did not verify the policy type. Added additional tests. Issue-ID: POLICY-2190 Signed-off-by: Jim Hahn Change-Id: Iad2a06163f9dce3dff3753cddef98db9e9ad2eea --- .../onap/policy/pap/main/notification/PolicyCommonTrackerTest.java | 7 +++++++ .../onap/policy/pap/main/notification/PolicyDeployTrackerTest.java | 2 ++ .../policy/pap/main/notification/PolicyUndeployTrackerTest.java | 1 + 3 files changed, 10 insertions(+) (limited to 'main/src') diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java index cfcf4471..3318684c 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java @@ -132,6 +132,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { tracker.removeData(makeData(policy2, PDP1, PDP3), statusList); assertEquals(1, statusList.size()); assertEquals(policy2, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertTrue(map.containsKey(policy1)); assertTrue(map.containsKey(policy2)); } @@ -149,6 +150,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { tracker.removeData(makeData(policy1, PDP1, PDP2, PDP3), statusList); assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertFalse(map.containsKey(policy1)); assertTrue(map.containsKey(policy2)); } @@ -165,6 +167,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals(3, map.size()); assertFalse(map.containsKey(policy1)); @@ -185,6 +188,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals(3, map.size()); assertFalse(map.containsKey(policy1)); @@ -205,6 +209,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals(3, map.size()); assertFalse(map.containsKey(policy1)); @@ -236,6 +241,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals(1, map.size()); assertTrue(map.containsKey(policy1)); @@ -258,6 +264,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals("[2, 0, 0]", getCounts(statusList.get(0)).toString()); assertTrue(map.isEmpty()); diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyDeployTrackerTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyDeployTrackerTest.java index bd093141..832fddc9 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyDeployTrackerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyDeployTrackerTest.java @@ -71,6 +71,7 @@ public class PolicyDeployTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals("[2, 0, 0]", getCounts(statusList.get(0)).toString()); // indicate that PDP1 has failed - should get a notification, if still in the map @@ -78,6 +79,7 @@ public class PolicyDeployTrackerTest extends PolicyCommonSupport { tracker.processResponse(PDP1, Collections.emptyList(), statusList); assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals("[1, 1, 0]", getCounts(statusList.get(0)).toString()); } diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyUndeployTrackerTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyUndeployTrackerTest.java index d837cbad..ba85c489 100644 --- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyUndeployTrackerTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyUndeployTrackerTest.java @@ -71,6 +71,7 @@ public class PolicyUndeployTrackerTest extends PolicyCommonSupport { assertEquals(1, statusList.size()); assertEquals(policy1, statusList.get(0).getPolicy()); + assertEquals(type, statusList.get(0).getPolicyType()); assertEquals("[2, 0, 0]", getCounts(statusList.get(0)).toString()); // indicate that PDP1 has been re-deployed - should not get a notification, -- cgit 1.2.3-korg