From 515147480c8807219dc4cdff1cd7e178757196ba Mon Sep 17 00:00:00 2001 From: jhh Date: Tue, 1 Mar 2022 10:54:33 -0600 Subject: Add controllers and remote servers healthchecks Issue-ID: POLICY-3977 Signed-off-by: jhh Change-Id: I4fd4db29f99989a2ef11b08f66f28535bfd15a36 Signed-off-by: jhh --- feature-healthcheck/pom.xml | 10 +- .../feature/config/feature-healthcheck.properties | 39 +- .../policy/drools/healthcheck/HealthCheck.java | 103 +++- .../drools/healthcheck/HealthCheckFeature.java | 17 +- .../drools/healthcheck/HealthCheckManager.java | 475 ++++++++++++---- .../policy/drools/healthcheck/RestHealthCheck.java | 131 ++++- .../drools/healthcheck/HealthCheckFeatureTest.java | 247 ++++----- .../drools/healthcheck/HealthCheckManagerTest.java | 596 +++++++++++++++++++++ .../policy/drools/healthcheck/HealthCheckTest.java | 283 +--------- .../drools/healthcheck/RestHealthCheckTest.java | 181 +++++++ .../drools/healthcheck/RestMockHealthCheck.java | 20 +- feature-healthcheck/src/test/resources/echo.drl | 35 ++ .../src/test/resources/echo.kmodule | 26 + feature-healthcheck/src/test/resources/echo.pom | 31 ++ .../test/resources/feature-healthcheck.properties | 55 ++ .../server/restful/RestLifecycleManagerTest.java | 1 - 16 files changed, 1708 insertions(+), 542 deletions(-) create mode 100644 feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/HealthCheckManagerTest.java create mode 100644 feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java create mode 100644 feature-healthcheck/src/test/resources/echo.drl create mode 100644 feature-healthcheck/src/test/resources/echo.kmodule create mode 100644 feature-healthcheck/src/test/resources/echo.pom create mode 100644 feature-healthcheck/src/test/resources/feature-healthcheck.properties diff --git a/feature-healthcheck/pom.xml b/feature-healthcheck/pom.xml index ec547793..8ef99173 100644 --- a/feature-healthcheck/pom.xml +++ b/feature-healthcheck/pom.xml @@ -1,8 +1,8 @@ + + + + + + diff --git a/feature-healthcheck/src/test/resources/echo.pom b/feature-healthcheck/src/test/resources/echo.pom new file mode 100644 index 00000000..2f84f4bd --- /dev/null +++ b/feature-healthcheck/src/test/resources/echo.pom @@ -0,0 +1,31 @@ + + + + + + 4.0.0 + + org.onap.policy.drools.healthcheck + echo + + 1.0.0 + diff --git a/feature-healthcheck/src/test/resources/feature-healthcheck.properties b/feature-healthcheck/src/test/resources/feature-healthcheck.properties new file mode 100644 index 00000000..63a71b6e --- /dev/null +++ b/feature-healthcheck/src/test/resources/feature-healthcheck.properties @@ -0,0 +1,55 @@ +# +# ============LICENSE_START======================================================= +# ONAP +# ================================================================================ +# Copyright (C) 2022 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. +# ============LICENSE_END========================================================= +# + +http.server.services=HEALTHCHECK,LIVENESS + +http.server.services.HEALTHCHECK.host=localhost +http.server.services.HEALTHCHECK.userName=username +http.server.services.HEALTHCHECK.password=password +http.server.services.HEALTHCHECK.restClasses=org.onap.policy.drools.healthcheck.RestMockHealthCheck +http.server.services.HEALTHCHECK.filterClasses=org.onap.policy.drools.healthcheck.TestAafHealthCheckFilter +http.server.services.HEALTHCHECK.port=7777 + +http.server.services.LIVENESS.host=localhost +http.server.services.LIVENESS.port=7776 +http.server.services.LIVENESS.restClasses=org.onap.policy.drools.healthcheck.RestMockHealthCheck + +http.client.services=HEALTHCHECK,LIVENESS,UNAUTH,STUCK + +http.client.services.HEALTHCHECK.host=localhost +http.client.services.HEALTHCHECK.port=7777 +http.client.services.HEALTHCHECK.contextUriPath=healthcheck/test +http.client.services.HEALTHCHECK.userName=username +http.client.services.HEALTHCHECK.password=password + +http.client.services.LIVENESS.host=localhost +http.client.services.LIVENESS.port=7776 +http.client.services.LIVENESS.contextUriPath=healthcheck/test + +http.client.services.UNAUTH.host=localhost +http.client.services.UNAUTH.port=7777 +http.client.services.UNAUTH.contextUriPath=healthcheck/test + +http.client.services.STUCK.host=localhost +http.client.services.STUCK.port=7776 +http.client.services.STUCK.contextUriPath=healthcheck/stuck + +liveness.controllers=* +liveness.controllers.timeout=5 diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java index 7676929d..7fcf1e5a 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import io.prometheus.client.CollectorRegistry; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -- cgit 1.2.3-korg