summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/test
diff options
context:
space:
mode:
authorRashmi Pujar <rashmi.pujar1@bell.ca>2021-11-26 07:44:23 -0500
committerRashmi Pujar <rashmi.pujar1@bell.ca>2021-11-30 11:23:53 -0500
commitdf756c6862e4a94b43e85c3b95b50fb305c9ee76 (patch)
tree9acc4abfc21753711abffadabd5ab9610ac99714 /services/services-engine/src/test
parent886976ee99995c83dac4b6a7805c3d1514c5ce18 (diff)
Prometheus metrics for policy deploy/undeploy requests for APEX
Added counters for: - Policy deploy/undeploy requests total - Policy deploy/undeploy successful requests total - Policy deploy/undeploy failed requests total Cleaned up unused method resetAllStatistics. Fixed some checkstyle warnings Update to latest snapshot for parent, and common modules Depends on https://gerrit.onap.org/r/c/policy/parent/+/125974 for build to pass. Issue-ID: POLICY-3760 Change-Id: I4a9447c9caea7a018dba86057b9dae3871910709 Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca>
Diffstat (limited to 'services/services-engine/src/test')
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManagerTest.java23
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java11
2 files changed, 4 insertions, 30 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManagerTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManagerTest.java
index 4c541bd12..a63cea5eb 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManagerTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexPolicyStatisticsManagerTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2021 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,26 +66,6 @@ public class ApexPolicyStatisticsManagerTest {
assertUndeploys(2, 1, 1);
}
- @Test
- public void testResetAllStatistics() {
- statisticsManager.updatePolicyDeployCounter(true);
- statisticsManager.updatePolicyDeployCounter(true);
- statisticsManager.updatePolicyDeployCounter(false);
- statisticsManager.updatePolicyUndeployCounter(false);
- statisticsManager.updatePolicyExecutedCounter(true);
-
- assertDeploys(3, 2, 1);
- assertUndeploys(1, 0, 1);
- assertExecuted(1, 1, 0);
-
- statisticsManager.resetAllStatistics();
-
- assertDeploys(0, 0, 0);
- assertUndeploys(0, 0, 0);
- assertExecuted(0, 0, 0);
-
- }
-
private void assertDeploys(long count, long success, long fail) {
assertEquals(count, statisticsManager.getPolicyDeployCount());
assertEquals(success, statisticsManager.getPolicyDeploySuccessCount());
@@ -103,4 +84,4 @@ public class ApexPolicyStatisticsManagerTest {
assertEquals(fail, statisticsManager.getPolicyExecutedFailCount());
}
-}
+} \ No newline at end of file
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java
index 067a6b1b4..504e8df14 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -455,13 +456,5 @@ public class EngineWorkerTest {
assertNotNull(policyCounter);
assertEquals(policyCounter.getPolicyExecutedCount(),
policyCounter.getPolicyExecutedFailCount() + policyCounter.getPolicyExecutedSuccessCount());
- policyCounter.resetAllStatistics();
- assertEquals(0, policyCounter.getPolicyExecutedCount());
- assertEquals(0, policyCounter.getPolicyExecutedFailCount());
- assertEquals(0, policyCounter.getPolicyExecutedSuccessCount());
- assertEquals(0, policyCounter.getPolicyDeployCount());
- assertEquals(0, policyCounter.getPolicyDeployFailCount());
- assertEquals(0, policyCounter.getPolicyDeploySuccessCount());
-
}
-}
+} \ No newline at end of file