Removed db-based statistics feature 27/133927/4
authorSuresh Charan <suresh.charan@bell.ca>
Thu, 30 Mar 2023 00:01:21 +0000 (20:01 -0400)
committerSuresh Charan <suresh.charan@bell.ca>
Tue, 8 Aug 2023 20:17:43 +0000 (16:17 -0400)
Statistics code cleanup

Issue-ID: POLICY-4109
Change-Id: I5ad893deaf365c7e289b57c00260672f127d2630
Signed-off-by: Suresh Charan <suresh.charan@bell.ca>
16 files changed:
main/pom.xml
main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java [deleted file]
main/src/main/java/org/onap/policy/api/main/exception/ServiceExceptionHandler.java
main/src/main/java/org/onap/policy/api/main/rest/ApiRestController.java
main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java [deleted file]
main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java [deleted file]
main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java [deleted file]
main/src/main/java/org/onap/policy/api/main/rest/stub/ApiRestControllerStub.java
main/src/main/resources/META-INF/persistence.xml
main/src/main/resources/openapi/openapi.yaml
main/src/test/java/org/onap/policy/api/contract/ApiContractTest.java
main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
main/src/test/java/org/onap/policy/api/main/rest/TestApiStatisticsManager.java [deleted file]
main/src/test/java/org/onap/policy/api/main/rest/TestStatisticsReport.java [deleted file]
main/src/test/resources/META-INF/persistence.xml
postman/lifecycle-api-collection.json

index 2f2b5bb..893cec0 100644 (file)
@@ -3,7 +3,7 @@
    Copyright (C) 2018 Ericsson. All rights reserved.
    Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
    Copyright (C) 2019,2021 AT&T Intellectual Property. All rights reserved.
-   Modifications Copyright (C) 2020-2022 Bell Canada.
+   Modifications Copyright (C) 2020-2023 Bell Canada.
    Modifications Copyright (C) 2022-2023 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
                                 ToscaServiceTemplate=org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate,
                                 ToscaNodeTemplateArray=java.util.List,
                                 HealthCheckReport=org.onap.policy.common.endpoints.report.HealthCheckReport,
-                                StatisticsReport=org.onap.policy.api.main.rest.provider.statistics.StatisticsReport,
                                 PolicyFetchMode=org.onap.policy.api.main.rest.PolicyFetchMode
                             </importMappings>
                             <configOptions>
diff --git a/main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java b/main/src/main/java/org/onap/policy/api/main/config/PolicyApiConfig.java
deleted file mode 100644 (file)
index 0510d65..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Bell Canada. All rights reserved.
- *  Modifications Copyright (C) 2022 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.config;
-
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class PolicyApiConfig {
-
-    /**
-     * Initialize the statistics report bean.
-     *
-     * @return a new instance of StatisticsReport
-     */
-    @Bean
-    public StatisticsReport createStatisticsReport() {
-        return new StatisticsReport();
-    }
-}
\ No newline at end of file
index 1909e19..93240df 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Bell Canada. All rights reserved.
+ *  Copyright (C) 2022-2023 Bell Canada. 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.
@@ -61,8 +61,7 @@ public class ServiceExceptionHandler {
      * @param joinPoint the point of execution
      * @param exception the exception
      */
-    @AfterThrowing(pointcut = "execution(* org.onap.policy.api.main..*.*(..))"
-        + " && !execution(* org.onap.policy.api.main.rest.provider.statistics.*.*(..))", throwing = "exception")
+    @AfterThrowing(pointcut = "execution(* org.onap.policy.api.main..*.*(..))", throwing = "exception")
     public void handleTransactionException(JoinPoint joinPoint, TransactionException exception) {
         final var errorResponse = new ErrorResponse();
         errorResponse.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR);
index 47d8292..a1e6db2 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.\r
  * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.\r
  * Modifications Copyright (C) 2020-2022 Nordix Foundation.\r
- * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.\r
+ * Modifications Copyright (C) 2020-2023 Bell Canada. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -32,9 +32,6 @@ import lombok.RequiredArgsConstructor;
 import org.onap.policy.api.main.exception.PolicyApiRuntimeException;\r
 import org.onap.policy.api.main.rest.genapi.PolicyDesignApi;\r
 import org.onap.policy.api.main.rest.provider.healthcheck.HealthCheckProvider;\r
-import org.onap.policy.api.main.rest.provider.statistics.ApiStatisticsManager;\r
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsProvider;\r
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;\r
 import org.onap.policy.api.main.service.ToscaServiceTemplateService;\r
 import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;\r
 import org.onap.policy.common.endpoints.report.HealthCheckReport;\r
@@ -67,8 +64,6 @@ public class ApiRestController extends CommonRestController implements PolicyDes
 \r
     private final ToscaServiceTemplateService toscaServiceTemplateService;\r
     private final HealthCheckProvider healthCheckProvider;\r
-    private final ApiStatisticsManager mgr;\r
-    private final StatisticsProvider statisticsProvider;\r
 \r
     /**\r
      * Retrieves the healthcheck status of the API component.\r
@@ -78,21 +73,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
     @Override\r
     public ResponseEntity<HealthCheckReport> getHealthCheck(UUID requestId) {\r
         final var report = healthCheckProvider.performHealthCheck();\r
-        updateApiStatisticsCounter(Target.OTHER, HttpStatus.resolve(report.getCode()), HttpMethod.GET);\r
         return makeResponse(requestId, report, report.getCode());\r
     }\r
 \r
-    /**\r
-     * Retrieves the statistics report of the API component.\r
-     *\r
-     * @return the Response object containing the results of the API operation\r
-     */\r
-    @Override\r
-    public ResponseEntity<StatisticsReport> getStatistics(UUID requestId) {\r
-        updateApiStatisticsCounter(Target.OTHER, HttpStatus.OK, HttpMethod.GET);\r
-        return makeOkResponse(requestId, statisticsProvider.fetchCurrentStatistics());\r
-    }\r
-\r
     /**\r
      * Retrieves all available policy types.\r
      *\r
@@ -102,12 +85,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
     public ResponseEntity<ToscaServiceTemplate> getAllPolicyTypes(UUID requestId) {\r
         try {\r
             ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.fetchPolicyTypes(null, null);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             final var msg = "GET /policytypes";\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -125,12 +105,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
             UUID requestId) {\r
         try {\r
             ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.fetchPolicyTypes(policyTypeId, null);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policytypes/%s", policyTypeId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -151,12 +128,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.fetchPolicyTypes(policyTypeId, versionId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policytypes/%s/versions/%s", policyTypeId, versionId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -174,12 +148,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
             UUID requestId) {\r
         try {\r
             ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.fetchLatestPolicyTypes(policyTypeId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policytypes/%s/versions/latest", policyTypeId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -200,12 +171,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         }\r
         try {\r
             ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.createPolicyType(body);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.POST);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelRuntimeException pfme) {\r
             final var msg = "POST /policytypes";\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.POST);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -226,12 +194,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.deletePolicyType(policyTypeId, versionId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.OK, HttpMethod.DELETE);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelRuntimeException pfme) {\r
             var msg = String.format("DELETE /policytypes/%s/versions/%s", policyTypeId, versionId);\r
-            updateApiStatisticsCounter(Target.POLICY_TYPE, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.DELETE);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -253,12 +218,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.fetchPolicies(policyTypeId, policyTypeVersion, null, null, mode);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policytypes/%s/versions/%s/policies", policyTypeId, policyTypeVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -282,13 +244,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.fetchPolicies(policyTypeId, policyTypeVersion, policyId, null, mode);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("/policytypes/%s/versions/%s/policies/%s",\r
                 policyTypeId, policyTypeVersion, policyId);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -314,13 +273,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService\r
                 .fetchPolicies(policyTypeId, policyTypeVersion, policyId, policyVersion, mode);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policytypes/%s/versions/%s/policies/%s/versions/%s",\r
                 policyTypeId, policyTypeVersion, policyId, policyVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -344,13 +300,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.fetchLatestPolicies(policyTypeId, policyTypeVersion, policyId, mode);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policytypes/%s/versions/%s/policies/%s/versions/latest",\r
                 policyTypeId, policyTypeVersion, policyId);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -377,12 +330,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.createPolicy(policyTypeId, policyTypeVersion, body);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.POST);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelRuntimeException pfme) {\r
             var msg = String.format("POST /policytypes/%s/versions/%s/policies", policyTypeId, policyTypeVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.POST);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -407,13 +357,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.deletePolicy(policyTypeId, policyTypeVersion, policyId, policyVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.DELETE);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelRuntimeException pfme) {\r
             var msg = String.format("DELETE /policytypes/%s/versions/%s/policies/%s/versions/%s",\r
                 policyTypeId, policyTypeVersion, policyId, policyVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.DELETE);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -430,12 +377,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.fetchPolicies(null, null, null, null, mode);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             final var msg = "GET /policies/ --";\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             if (pfme.getErrorResponse().getResponseCode().equals(Status.NOT_FOUND)) {\r
                 pfme.getErrorResponse().setErrorMessage(ERROR_MESSAGE_NO_POLICIES_FOUND);\r
                 pfme.getErrorResponse().setErrorDetails(List.of(ERROR_MESSAGE_NO_POLICIES_FOUND));\r
@@ -461,12 +405,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.fetchPolicies(null, null, policyId, policyVersion, mode);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.GET);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelException | PfModelRuntimeException pfme) {\r
             var msg = String.format("GET /policies/%s/versions/%s", policyId, policyVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.GET);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -487,12 +428,9 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         }\r
         try {\r
             ToscaServiceTemplate serviceTemplate = toscaServiceTemplateService.createPolicies(body);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.POST);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelRuntimeException pfme) {\r
             final var msg = "POST /policies";\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.POST);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
@@ -513,120 +451,10 @@ public class ApiRestController extends CommonRestController implements PolicyDes
         try {\r
             ToscaServiceTemplate serviceTemplate =\r
                 toscaServiceTemplateService.deletePolicy(null, null, policyId, policyVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.OK, HttpMethod.DELETE);\r
             return makeOkResponse(requestId, serviceTemplate);\r
         } catch (PfModelRuntimeException pfme) {\r
             var msg = String.format("DELETE /policies/%s/versions/%s", policyId, policyVersion);\r
-            updateApiStatisticsCounter(Target.POLICY, HttpStatus.resolve(pfme.getErrorResponse().getResponseCode()\r
-                .getStatusCode()), HttpMethod.DELETE);\r
             throw new PolicyApiRuntimeException(msg, pfme.getCause(), pfme.getErrorResponse(), requestId);\r
         }\r
     }\r
-\r
-    private void updateApiStatisticsCounter(Target target, HttpStatus result, HttpMethod http) {\r
-        mgr.updateTotalApiCallCount();\r
-        switch (target) {\r
-            case POLICY:\r
-                updatePolicyStats(result, http);\r
-                break;\r
-            case POLICY_TYPE:\r
-                updatePolicyTypeStats(result, http);\r
-                break;\r
-            default:\r
-                mgr.updateApiCallSuccessCount();\r
-                break;\r
-        }\r
-    }\r
-\r
-    private void updatePolicyStats(HttpStatus result, HttpMethod http) {\r
-        if (result.equals(HttpStatus.OK)) {\r
-            switch (http) {\r
-                case GET:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    mgr.updateTotalPolicyGetCount();\r
-                    mgr.updatePolicyGetSuccessCount();\r
-                    break;\r
-                case POST:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    mgr.updateTotalPolicyPostCount();\r
-                    mgr.updatePolicyPostSuccessCount();\r
-                    break;\r
-                case DELETE:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    mgr.updateTotalPolicyDeleteCount();\r
-                    mgr.updatePolicyDeleteSuccessCount();\r
-                    break;\r
-                default:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    break;\r
-            }\r
-        } else {\r
-            switch (http) {\r
-                case GET:\r
-                    mgr.updateApiCallFailureCount();\r
-                    mgr.updateTotalPolicyGetCount();\r
-                    mgr.updatePolicyGetFailureCount();\r
-                    break;\r
-                case POST:\r
-                    mgr.updateApiCallFailureCount();\r
-                    mgr.updateTotalPolicyPostCount();\r
-                    mgr.updatePolicyPostFailureCount();\r
-                    break;\r
-                case DELETE:\r
-                    mgr.updateApiCallFailureCount();\r
-                    mgr.updateTotalPolicyDeleteCount();\r
-                    mgr.updatePolicyDeleteFailureCount();\r
-                    break;\r
-                default:\r
-                    mgr.updateApiCallFailureCount();\r
-                    break;\r
-            }\r
-        }\r
-    }\r
-\r
-    private void updatePolicyTypeStats(HttpStatus result, HttpMethod http) {\r
-        if (result.equals(HttpStatus.OK)) {\r
-            switch (http) {\r
-                case GET:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    mgr.updateTotalPolicyTypeGetCount();\r
-                    mgr.updatePolicyTypeGetSuccessCount();\r
-                    break;\r
-                case POST:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    mgr.updateTotalPolicyTypePostCount();\r
-                    mgr.updatePolicyTypePostSuccessCount();\r
-                    break;\r
-                case DELETE:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    mgr.updateTotalPolicyTypeDeleteCount();\r
-                    mgr.updatePolicyTypeDeleteSuccessCount();\r
-                    break;\r
-                default:\r
-                    mgr.updateApiCallSuccessCount();\r
-                    break;\r
-            }\r
-        } else {\r
-            switch (http) {\r
-                case GET:\r
-                    mgr.updateApiCallFailureCount();\r
-                    mgr.updateTotalPolicyTypeGetCount();\r
-                    mgr.updatePolicyTypeGetFailureCount();\r
-                    break;\r
-                case POST:\r
-                    mgr.updateApiCallFailureCount();\r
-                    mgr.updateTotalPolicyTypePostCount();\r
-                    mgr.updatePolicyTypePostFailureCount();\r
-                    break;\r
-                case DELETE:\r
-                    mgr.updateApiCallFailureCount();\r
-                    mgr.updateTotalPolicyTypeDeleteCount();\r
-                    mgr.updatePolicyTypeDeleteFailureCount();\r
-                    break;\r
-                default:\r
-                    mgr.updateApiCallFailureCount();\r
-                    break;\r
-            }\r
-        }\r
-    }\r
 }\r
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/ApiStatisticsManager.java
deleted file mode 100644 (file)
index c0d95e2..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2020-2022 Bell Canada. 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider.statistics;
-
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Component;
-
-/**
- * Class to hold statistical data for API access.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-@Component
-@RequiredArgsConstructor
-public class ApiStatisticsManager {
-
-    private final StatisticsReport report;
-
-    private long totalPolicyDeleteCount;
-    private long totalPolicyTypeDeleteCount;
-    private long policyDeleteSuccessCount;
-    private long policyDeleteFailureCount;
-    private long policyTypeDeleteSuccessCount;
-    private long policyTypeDeleteFailureCount;
-
-    /**
-     * Method to update the total api call count.
-     *
-     * @return the updated value of totalApiCallCount
-     */
-    public long updateTotalApiCallCount() {
-        return ++report.totalApiCallCount;
-    }
-
-    /**
-     * Method to update the successful api call count.
-     *
-     * @return the updated value of apiCallSuccessCount
-     */
-    public long updateApiCallSuccessCount() {
-        return ++report.apiCallSuccessCount;
-    }
-
-    /**
-     * Method to update the failed api call count.
-     *
-     * @return the updated value of apiCallFailureCount
-     */
-    public long updateApiCallFailureCount() {
-        return ++report.apiCallFailureCount;
-    }
-
-    /**
-     * Method to update the total policy GET count.
-     *
-     * @return the updated value of totalPolicyGetCount
-     */
-    public long updateTotalPolicyGetCount() {
-        return ++report.totalPolicyGetCount;
-    }
-
-    /**
-     * Method to update the total policy POST count.
-     *
-     * @return the updated value of totalPolicyPostCount
-     */
-    public long updateTotalPolicyPostCount() {
-        return ++report.totalPolicyPostCount;
-    }
-
-    /**
-     * Method to update the total policy DELETE count.
-     *
-     * @return the updated value of  totalPolicyDeleteCount
-     */
-    public long updateTotalPolicyDeleteCount() {
-        return ++totalPolicyDeleteCount;
-    }
-
-    /**
-     * Method to update the total policyType GET count.
-     *
-     * @return the updated value of totalPolicyTypeGetCount
-     */
-    public long updateTotalPolicyTypeGetCount() {
-        return ++report.totalPolicyTypeGetCount;
-    }
-
-    /**
-     * Method to update the total policyType POST count.
-     *
-     * @return the updated value of totalPolicyTypePostCount
-     */
-    public long updateTotalPolicyTypePostCount() {
-        return ++report.totalPolicyTypePostCount;
-    }
-
-    /**
-     * Method to update the total policyType DELETE count.
-     *
-     * @return the updated value of totalPolicyTypeDeleteCount
-     */
-    public long updateTotalPolicyTypeDeleteCount() {
-        return ++totalPolicyTypeDeleteCount;
-    }
-
-    /**
-     * Method to update successful policy GET count.
-     *
-     * @return the updated value of policyGetSuccessCount
-     */
-    public long updatePolicyGetSuccessCount() {
-        return ++report.policyGetSuccessCount;
-    }
-
-    /**
-     * Method to update failed policy GET count.
-     *
-     * @return the updated value of policyGetFailureCount
-     */
-    public long updatePolicyGetFailureCount() {
-        return ++report.policyGetFailureCount;
-    }
-
-    /**
-     * Method to update successful policy POST count.
-     *
-     * @return the updated value of policyPostSuccessCount
-     */
-    public long updatePolicyPostSuccessCount() {
-        return ++report.policyPostSuccessCount;
-    }
-
-    /**
-     * Method to update failed policy POST count.
-     *
-     * @return the updated value of policyPostFailureCount
-     */
-    public long updatePolicyPostFailureCount() {
-        return ++report.policyPostFailureCount;
-    }
-
-    /**
-     * Method to update successful policy DELETE count.
-     *
-     * @return the updated value of policyDeleteSuccessCount
-     */
-    public long updatePolicyDeleteSuccessCount() {
-        return ++policyDeleteSuccessCount;
-    }
-
-    /**
-     * Method to update failed policy DELETE count.
-     *
-     * @return the updated value of policyDeleteFailureCount
-     */
-    public long updatePolicyDeleteFailureCount() {
-        return ++policyDeleteFailureCount;
-    }
-
-    /**
-     * Method to update successful policyType GET count.
-     *
-     * @return the updated value of policyTypeGetSuccessCount
-     */
-    public long updatePolicyTypeGetSuccessCount() {
-        return ++report.policyTypeGetSuccessCount;
-    }
-
-    /**
-     * Method to update failed policyType GET count.
-     *
-     * @return the updated value of policyTypeGetFailureCount
-     */
-    public long updatePolicyTypeGetFailureCount() {
-        return ++report.policyTypeGetFailureCount;
-    }
-
-    /**
-     * Method to update successful policyType POST count.
-     *
-     * @return the updated value of policyTypePostSuccessCount
-     */
-    public long updatePolicyTypePostSuccessCount() {
-        return ++report.policyTypePostSuccessCount;
-    }
-
-    /**
-     * Method to update failed policyType POST count.
-     *
-     * @return the updated value of policyTypePostFailureCount
-     */
-    public long updatePolicyTypePostFailureCount() {
-        return ++report.policyTypePostFailureCount;
-    }
-
-    /**
-     * Method to update successful policyType DELETE count.
-     *
-     * @return the updated value of policyTypeDeleteSuccessCount
-     */
-    public long updatePolicyTypeDeleteSuccessCount() {
-        return ++policyTypeDeleteSuccessCount;
-    }
-
-    /**
-     * Method to update failed policyType DELETE count.
-     *
-     * @return the updated value of policyTypePostFailureCount
-     */
-    public long updatePolicyTypeDeleteFailureCount() {
-        return ++policyTypeDeleteFailureCount;
-    }
-}
\ No newline at end of file
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsProvider.java
deleted file mode 100644 (file)
index 7016ed4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2022 Bell Canada. 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider.statistics;
-
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-
-/**
- * Class to fetch API statistics.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-@Service
-@RequiredArgsConstructor
-public class StatisticsProvider {
-
-    private final StatisticsReport report;
-
-    /**
-     * Return the current API statistics.
-     *
-     * @return Report containing API statistics
-     */
-    public StatisticsReport fetchCurrentStatistics() {
-        report.setCode(200);
-        return report;
-    }
-}
\ No newline at end of file
diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java
deleted file mode 100644 (file)
index 3236392..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021 Bell Canada. 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest.provider.statistics;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-
-/**
- * Class to represent API statistics report.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-@ToString
-@Getter
-@Setter
-public class StatisticsReport {
-    private int code;
-    protected long totalApiCallCount;
-    protected long apiCallSuccessCount;
-    protected long apiCallFailureCount;
-    protected long totalPolicyGetCount;
-    protected long totalPolicyPostCount;
-    protected long totalPolicyTypeGetCount;
-    protected long totalPolicyTypePostCount;
-    protected long policyGetSuccessCount;
-    protected long policyGetFailureCount;
-    protected long policyPostSuccessCount;
-    protected long policyPostFailureCount;
-    protected long policyTypeGetSuccessCount;
-    protected long policyTypeGetFailureCount;
-    protected long policyTypePostSuccessCount;
-    protected long policyTypePostFailureCount;
-}
\ No newline at end of file
index 4b84890..38fe003 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023 Bell Canada. 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.
@@ -26,7 +27,6 @@ import lombok.RequiredArgsConstructor;
 import org.onap.policy.api.main.rest.CommonRestController;
 import org.onap.policy.api.main.rest.PolicyFetchMode;
 import org.onap.policy.api.main.rest.genapi.PolicyDesignApi;
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
 import org.onap.policy.common.endpoints.report.HealthCheckReport;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
 import org.springframework.context.annotation.Profile;
@@ -174,10 +174,4 @@ public class ApiRestControllerStub extends CommonRestController implements Polic
         return stubUtils.getStubbedResponse(ToscaServiceTemplate.class);
     }
 
-    @Override
-    public ResponseEntity<StatisticsReport> getStatistics(
-        UUID requestID) {
-        return stubUtils.getStubbedResponse(StatisticsReport.class);
-    }
-
 }
index aabe0f1..43024ee 100644 (file)
@@ -4,6 +4,7 @@
    Copyright (C) 2019-2020 Nordix Foundation.
    Modifications Copyright (C) 2021 AT&T Intellectual Property.
    Modification Copyright 2022 Nordix Foundation.
+   Modifications Copyright (C) 2023 Bell Canada. 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.
@@ -35,7 +36,6 @@
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpPolicyStatus</class>
-        <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpStatistics</class>
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
         <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class>
         <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class>
index 5ab7e79..c8f44e5 100644 (file)
@@ -30,7 +30,7 @@ tags:
     independent component running rest service that takes all policy design API calls
     from clients and then assign them to different API working functions. Besides
     that, API is also exposed for clients to retrieve healthcheck status of this API
-    rest service and the statistics report including the counters of API invocation.
+    rest service.
 paths:
   /healthcheck:
     get:
@@ -3237,118 +3237,6 @@ paths:
       x-interface info:
         api-version: 1.0.0
         last-mod-release: Dublin
-  /statistics:
-    get:
-      tags:
-      - "Policy Design"
-      summary: Retrieve current statistics
-      description: Returns current statistics including the counters of API invocation
-      operationId: getStatistics
-      parameters:
-      - name: X-ONAP-RequestID
-        in: header
-        description: RequestID for http transaction
-        schema:
-          type: string
-          format: uuid
-      responses:
-        200:
-          description: OK, the statistics report in an instance of
-            [StatisticsReport](https://github.com/onap/policy-api/blob/master/main/src/main/java/org/onap/policy/api/main/rest/provider/statistics/StatisticsReport.java)
-          headers:
-            X-LatestVersion:
-              schema:
-                type: string
-            X-PatchVersion:
-              schema:
-                type: string
-            X-MinorVersion:
-              schema:
-                type: string
-            X-onap-RequestId:
-              schema:
-                type: string
-                format: uuid
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/StatisticsReport'
-            application/yaml:
-              schema:
-                $ref: '#/components/schemas/StatisticsReport'
-        401:
-          description: Authentication Error
-          headers:
-            X-LatestVersion:
-              schema:
-                type: string
-            X-PatchVersion:
-              schema:
-                type: string
-            X-MinorVersion:
-              schema:
-                type: string
-            X-ONAP-RequestID:
-              schema:
-                type: string
-                format: uuid
-          content: {}
-        403:
-          description: Authorization Error
-          headers:
-            X-LatestVersion:
-              schema:
-                type: string
-            X-PatchVersion:
-              schema:
-                type: string
-            X-MinorVersion:
-              schema:
-                type: string
-            X-ONAP-RequestID:
-              schema:
-                type: string
-                format: uuid
-          content: {}
-        404:
-          description: Not Found
-          headers:
-            X-LatestVersion:
-              schema:
-                type: string
-            X-PatchVersion:
-              schema:
-                type: string
-            X-MinorVersion:
-              schema:
-                type: string
-            X-onap-RequestId:
-              schema:
-                type: string
-                format: uuid
-          content: {}
-        500:
-          description: Internal Server Error
-          headers:
-            X-LatestVersion:
-              schema:
-                type: string
-            X-PatchVersion:
-              schema:
-                type: string
-            X-MinorVersion:
-              schema:
-                type: string
-            X-ONAP-RequestID:
-              schema:
-                type: string
-                format: uuid
-          content: {}
-      security:
-      - basicAuth: []
-      x-interface info:
-        api-version: 1.0.0
-        last-mod-release: Dublin
 components:
   securitySchemes:
     basicAuth:
@@ -3364,9 +3252,7 @@ components:
     HealthCheckReport:
       title: HealthCheckReport
       type: object
-    StatisticsReport:
-      title: StatisticsReport
-      type: object
     PolicyFetchMode:
       title: PolicyFetchMode
-      type: object
\ No newline at end of file
+      type: object
+
index 296c011..3b90a10 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2023 Nordix Foundation.
+ *  Modifications Copyright (C) 2023 Bell Canada. 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.
@@ -85,7 +86,6 @@ public class ApiContractTest extends CommonTestRestController {
                 + "9c65fa1f-2833-4076-a64d-5b62e35cd09b/versions/latest");
         checkStubJsonGet("policytypes/380d5cb1-e43d-45b7-b10b-ebd15dfabd16/versions/1.0.0/policies/"
                 + "9c65fa1f-2833-4076-a64d-5b62e35cd09b/versions/1.2.3");
-        checkStubJsonGet("statistics");
         checkStubJsonGet("healthcheck");
 
         checkStubJsonPost("policies");
index a1d67dc..7442a8c 100644 (file)
@@ -3,7 +3,7 @@
  *  Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *  Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
  *  Modifications Copyright (C) 2019-2020,2022-2023 Nordix Foundation.
- *  Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.
+ *  Modifications Copyright (C) 2020-2023 Bell Canada. 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.
@@ -40,8 +40,6 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.policy.api.main.PolicyApiApplication;
-import org.onap.policy.api.main.rest.provider.statistics.ApiStatisticsManager;
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
 import org.onap.policy.api.main.rest.utils.CommonTestRestController;
 import org.onap.policy.common.endpoints.report.HealthCheckReport;
 import org.onap.policy.common.utils.coder.StandardCoder;
@@ -51,7 +49,6 @@ import org.onap.policy.common.utils.resources.TextFileUtils;
 import org.onap.policy.common.utils.security.SelfSignedKeyStore;
 import org.onap.policy.models.errors.concepts.ErrorResponse;
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.web.server.LocalServerPort;
 import org.springframework.test.annotation.DirtiesContext;
@@ -79,7 +76,6 @@ public class TestApiRestServer extends CommonTestRestController {
     private static final String APP_YAML = "application/yaml";
 
     private static final String HEALTHCHECK_ENDPOINT = "healthcheck";
-    private static final String STATISTICS_ENDPOINT = "statistics";
 
     private static final String OP_POLICY_NAME_VCPE = "operational.restart";
 
@@ -159,9 +155,6 @@ public class TestApiRestServer extends CommonTestRestController {
     @LocalServerPort
     private int apiPort;
 
-    @Autowired
-    private ApiStatisticsManager mgr;
-
     /**
      * Initializes parameters and set up test environment.
      *
@@ -329,27 +322,6 @@ public class TestApiRestServer extends CommonTestRestController {
         validateHealthCheckReport(NAME, SELF, true, 200, ALIVE, report);
     }
 
-    @Test
-    public void testApiStatistics_200_Json() throws Exception {
-        testApiStatistics_200(APP_JSON);
-    }
-
-    @Test
-    public void testApiStatistics_200_Yaml() throws Exception {
-        testApiStatistics_200(APP_YAML);
-    }
-
-    private void testApiStatistics_200(String mediaType) throws Exception {
-        Invocation.Builder invocationBuilder = sendHttpsRequest(CONTEXT_PATH, STATISTICS_ENDPOINT, mediaType, apiPort);
-        StatisticsReport report = invocationBuilder.get(StatisticsReport.class);
-        validateStatisticsReport(report, 200);
-        updateApiStatistics();
-        invocationBuilder = sendHttpsRequest(CONTEXT_PATH, STATISTICS_ENDPOINT, mediaType, apiPort);
-        report = invocationBuilder.get(StatisticsReport.class);
-        validateStatisticsReport(report, 200);
-        // ApiStatisticsManager.resetAllStatistics();
-    }
-
     @Test
     public void testReadPolicyTypesJson() throws Exception {
         testReadPolicyTypes(APP_JSON);
@@ -704,29 +676,6 @@ public class TestApiRestServer extends CommonTestRestController {
 
     }
 
-    private void updateApiStatistics() {
-        mgr.updateTotalApiCallCount();
-        mgr.updateApiCallSuccessCount();
-        mgr.updateApiCallFailureCount();
-        mgr.updateTotalPolicyGetCount();
-        mgr.updateTotalPolicyPostCount();
-        mgr.updateTotalPolicyTypeGetCount();
-        mgr.updateTotalPolicyTypePostCount();
-        mgr.updatePolicyGetSuccessCount();
-        mgr.updatePolicyGetFailureCount();
-        mgr.updatePolicyPostSuccessCount();
-        mgr.updatePolicyPostFailureCount();
-        mgr.updatePolicyTypeGetSuccessCount();
-        mgr.updatePolicyTypeGetFailureCount();
-        mgr.updatePolicyTypePostSuccessCount();
-        mgr.updatePolicyTypePostFailureCount();
-    }
-
-    private void validateStatisticsReport(final StatisticsReport report, final int code) {
-
-        assertEquals(code, report.getCode());
-    }
-
     private void validateHealthCheckReport(final String name, final String url, final boolean healthy, final int code,
             final String message, final HealthCheckReport report) {
 
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiStatisticsManager.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiStatisticsManager.java
deleted file mode 100644 (file)
index 0e01ee4..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019 IBM.
- * Modifications Copyright (C) 2020-2022 Bell Canada.
- * Modifications Copyright (C) 2021 AT&T 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.policy.api.main.PolicyApiApplication;
-import org.onap.policy.api.main.rest.provider.statistics.ApiStatisticsManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = PolicyApiApplication.class)
-@ActiveProfiles({ "test", "default" })
-public class TestApiStatisticsManager {
-
-    @Autowired
-    private ApiStatisticsManager mgr;
-
-    @Test
-    public void testUpdateMethods() {
-        assertEquals(1, mgr.updateTotalApiCallCount());
-        assertEquals(1, mgr.updateApiCallSuccessCount());
-        assertEquals(1, mgr.updateApiCallFailureCount());
-        assertEquals(1, mgr.updateTotalPolicyGetCount());
-        assertEquals(1, mgr.updateTotalPolicyPostCount());
-        assertEquals(1, mgr.updateTotalPolicyDeleteCount());
-        assertEquals(1, mgr.updateTotalPolicyTypeGetCount());
-        assertEquals(1, mgr.updateTotalPolicyTypePostCount());
-        assertEquals(1, mgr.updateTotalPolicyTypeDeleteCount());
-        assertEquals(1, mgr.updatePolicyGetSuccessCount());
-        assertEquals(1, mgr.updatePolicyGetFailureCount());
-        assertEquals(1, mgr.updatePolicyPostSuccessCount());
-        assertEquals(1, mgr.updatePolicyPostFailureCount());
-        assertEquals(1, mgr.updatePolicyDeleteSuccessCount());
-        assertEquals(1, mgr.updatePolicyDeleteFailureCount());
-        assertEquals(1, mgr.updatePolicyTypeGetSuccessCount());
-        assertEquals(1, mgr.updatePolicyTypeGetFailureCount());
-        assertEquals(1, mgr.updatePolicyTypePostSuccessCount());
-        assertEquals(1, mgr.updatePolicyTypePostFailureCount());
-        assertEquals(1, mgr.updatePolicyTypeDeleteSuccessCount());
-        assertEquals(1, mgr.updatePolicyTypeDeleteFailureCount());
-    }
-}
\ No newline at end of file
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestStatisticsReport.java b/main/src/test/java/org/onap/policy/api/main/rest/TestStatisticsReport.java
deleted file mode 100644 (file)
index 664c959..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy API
- * ================================================================================
- * Copyright (C) 2019 AT&T 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.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.api.main.rest;
-
-import com.openpojo.reflection.filters.FilterClassName;
-import com.openpojo.validation.Validator;
-import com.openpojo.validation.ValidatorBuilder;
-import com.openpojo.validation.rule.impl.SetterMustExistRule;
-import com.openpojo.validation.test.impl.GetterTester;
-import com.openpojo.validation.test.impl.SetterTester;
-import org.junit.Test;
-import org.onap.policy.api.main.rest.provider.statistics.StatisticsReport;
-import org.onap.policy.common.utils.test.ToStringTester;
-
-/**
- * Class to perform unit testing of {@link StatisticsReport}.
- *
- * @author Chenfei Gao (cgao@research.att.com)
- */
-public class TestStatisticsReport {
-
-    @Test
-    public void testStatisticsReport() {
-        final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterMustExistRule())
-                .with(new SetterTester()).with(new GetterTester()).build();
-        validator.validate(StatisticsReport.class.getPackage().getName(),
-                new FilterClassName(StatisticsReport.class.getName()));
-    }
-}
\ No newline at end of file
index c302de0..68f49da 100644 (file)
@@ -3,6 +3,7 @@
   ============LICENSE_START=======================================================
    Copyright (C) 2019-2020 Nordix Foundation.
    Modifications Copyright (C) 2021 AT&T Intellectual Property.
+   Modifications Copyright (C) 2023 Bell Canada. 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.
@@ -30,7 +31,6 @@
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpPolicyStatus</class>
-        <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpStatistics</class>
         <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
         <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class>
         <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class>
index 053f7ed..44dfe40 100644 (file)
             },
             "response": []
         },
-        {
-            "name": "API Statistics",
-            "request": {
-                "method": "GET",
-                "header": [
-                    {
-                        "key": "Content-Type",
-                        "type": "text",
-                        "value": "application/json"
-                    },
-                    {
-                        "key": "Accept",
-                        "type": "text",
-                        "value": "application/json"
-                    }
-                ],
-                "url": {
-                    "raw": "{{POLICY-API-URL}}/policy/api/v1/statistics",
-                    "host": [
-                        "{{POLICY-API-URL}}"
-                    ],
-                    "path": [
-                        "policy",
-                        "api",
-                        "v1",
-                        "statistics"
-                    ]
-                },
-                "description": "This is an API to fetch current statistics information for the policy-api component."
-            },
-            "response": []
-        },
         {
             "name": "Create Policy Type",
             "request": {