From d6f5bfa934b9aa0571e853fc5432ab84eceb9db1 Mon Sep 17 00:00:00 2001 From: Piotr Jaszczyk Date: Wed, 29 Aug 2018 13:24:59 +0200 Subject: Improve coverage of xNF simulator Also refactor to make it possible. Change-Id: I6da6d3f33e57c524a7e353ecebd3e045d8ceed2a Issue-ID: DCAEGEN2-739 Signed-off-by: Piotr Jaszczyk --- .../dcae/collectors/veshv/healthcheck/api/HealthStatus.kt | 13 ++++++------- .../veshv/healthcheck/factory/HealthCheckApiServer.kt | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'hv-collector-health-check/src') diff --git a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/api/HealthStatus.kt b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/api/HealthStatus.kt index 79fc9321..1adf0cad 100644 --- a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/api/HealthStatus.kt +++ b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/api/HealthStatus.kt @@ -19,16 +19,15 @@ */ package org.onap.dcae.collectors.veshv.healthcheck.api -import org.onap.dcae.collectors.veshv.utils.http.Status.Companion.OK -import org.onap.dcae.collectors.veshv.utils.http.Status.Companion.SERVICE_UNAVAILABLE +import org.onap.dcae.collectors.veshv.utils.http.HttpStatus /** * @author Piotr Jaszczyk * @since August 2018 */ -enum class HealthStatus(val httpResponseStatus: Int) { - UP(OK), - DOWN(SERVICE_UNAVAILABLE), - OUT_OF_SERVICE(SERVICE_UNAVAILABLE), - UNKNOWN(SERVICE_UNAVAILABLE) +enum class HealthStatus(val httpResponseStatus: HttpStatus) { + UP(HttpStatus.OK), + DOWN(HttpStatus.SERVICE_UNAVAILABLE), + OUT_OF_SERVICE(HttpStatus.SERVICE_UNAVAILABLE), + UNKNOWN(HttpStatus.SERVICE_UNAVAILABLE) } diff --git a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt index 7e9efac7..753f73ef 100644 --- a/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt +++ b/hv-collector-health-check/src/main/kotlin/org/onap/dcae/collectors/veshv/healthcheck/factory/HealthCheckApiServer.kt @@ -51,7 +51,7 @@ class HealthCheckApiServer(private val healthState: HealthState, private val por private fun readinessHandler(req: HttpServerRequest, resp: HttpServerResponse) = healthDescription.get().run { - resp.status(status.httpResponseStatus).sendString(Flux.just(status.toString(), "\n", message)) + resp.status(status.httpResponseStatus.number).sendString(Flux.just(status.toString(), "\n", message)) } private fun livenessHandler(req: HttpServerRequest, resp: HttpServerResponse) = -- cgit 1.2.3-korg