diff options
author | Jim Hahn <jrh3@att.com> | 2019-06-19 14:24:31 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-06-19 14:24:31 -0400 |
commit | c6430ad773f18da97ab25e2d9e92a120fd55c482 (patch) | |
tree | feb9953ce3571dd3ad19fe2b84abb5b566e7014f /main/src/test | |
parent | 422fc737b0825d13bfd6a2acdd60226f61aab2c7 (diff) |
Update totalPoliciesCount statistic
Modified the code to set the policy count statistic at start-up
and whenever the policy list is changed.
Also fixed a couple of checkstyle issues in guard.
Change-Id: I92017fe64cd5d19c36908347193cc21d183f051e
Issue-ID: POLICY-1844
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test')
-rw-r--r-- | main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java | 7 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java index ba8f0044..7865851d 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpRestServer.java @@ -44,6 +44,8 @@ public class TestXacmlPdpRestServer extends CommonRest { private static final String HEALTHCHECK_ENDPOINT = "healthcheck"; private static final String STATISTICS_ENDPOINT = "statistics"; + private int nupdates = 0; + @Test public void testHealthCheckSuccess() throws Exception { LOGGER.info("***************************** Running testHealthCheckSuccess *****************************"); @@ -111,7 +113,9 @@ public class TestXacmlPdpRestServer extends CommonRest { private void updateXacmlPdpStatistics() { XacmlPdpStatisticsManager stats = XacmlPdpStatisticsManager.getCurrent(); - stats.updateTotalPoliciesCount(); + ++nupdates; + stats.setTotalPolicyCount(nupdates); + stats.setTotalPolicyTypesCount(nupdates); stats.updatePermitDecisionsCount(); stats.updateDenyDecisionsCount(); stats.updateIndeterminantDecisionsCount(); @@ -121,6 +125,7 @@ public class TestXacmlPdpRestServer extends CommonRest { private void validateStatisticsReport(final StatisticsReport report, final int count, final int code) { assertEquals(code, report.getCode()); assertEquals(count, report.getTotalPoliciesCount()); + assertEquals(count, report.getTotalPolicyTypesCount()); assertEquals(count, report.getPermitDecisionsCount()); assertEquals(count, report.getDenyDecisionsCount()); assertEquals(count, report.getIndeterminantDecisionsCount()); diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java index 250f21e6..030b9075 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestXacmlPdpStatistics.java @@ -37,6 +37,8 @@ public class TestXacmlPdpStatistics extends CommonRest { private static final Logger LOGGER = LoggerFactory.getLogger(TestXacmlPdpStatistics.class); + private int nupdates = 0; + @Test public void testXacmlPdpStatistics_200() throws Exception { LOGGER.info("*************************** Running testXacmlPdpStatistics_200 ***************************"); @@ -64,7 +66,9 @@ public class TestXacmlPdpStatistics extends CommonRest { private void updateXacmlPdpStatistics() { XacmlPdpStatisticsManager stats = XacmlPdpStatisticsManager.getCurrent(); - stats.updateTotalPoliciesCount(); + ++nupdates; + stats.setTotalPolicyCount(nupdates); + stats.setTotalPolicyTypesCount(nupdates); stats.updatePermitDecisionsCount(); stats.updateDenyDecisionsCount(); stats.updateIndeterminantDecisionsCount(); @@ -74,6 +78,7 @@ public class TestXacmlPdpStatistics extends CommonRest { private void validateReport(final StatisticsReport report, final int count, final int code) { assertEquals(code, report.getCode()); assertEquals(count, report.getTotalPoliciesCount()); + assertEquals(count, report.getTotalPolicyTypesCount()); assertEquals(count, report.getPermitDecisionsCount()); assertEquals(count, report.getDenyDecisionsCount()); assertEquals(count, report.getIndeterminantDecisionsCount()); |