diff options
author | KAPIL SINGAL <ks220y@att.com> | 2019-12-09 14:28:32 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-12-09 14:28:32 +0000 |
commit | a48981d05a85f45010ff4c8bf6e797037a9ea4fa (patch) | |
tree | 039dfad6af102f12b9d13eff4e57a27512920452 | |
parent | ea84b36447601d0d6a633ae708b72c6aaae6dc67 (diff) | |
parent | 80da76b7044ce4615b986136210c4520762debf7 (diff) |
Merge "Add default values for health-api properties"
2 files changed, 22 insertions, 11 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt index 8d4a27fc0..8fcffbf06 100644 --- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt +++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt @@ -16,9 +16,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.actuator.indicator +import kotlinx.coroutines.runBlocking import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BluePrintProcessorHealthCheck +import org.slf4j.LoggerFactory import org.springframework.boot.actuate.health.AbstractHealthIndicator import org.springframework.boot.actuate.health.Health import org.springframework.stereotype.Component @@ -30,16 +32,25 @@ import org.springframework.stereotype.Component */ @Component open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck) : - AbstractHealthIndicator() { + AbstractHealthIndicator() { + + private var logger = LoggerFactory.getLogger(BluePrintCustomIndicator::class.java) @Throws(Exception::class) override fun doHealthCheck(builder: Health.Builder) { - var result: HealthApiResponse? = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus() - if (result?.status == HealthCheckStatus.UP) { - builder.up() - } else { - builder.down() + runBlocking { + var result: HealthApiResponse? = null + try { + result = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus() + if (result?.status == HealthCheckStatus.UP) { + builder.up() + } else { + builder.down() + } + builder.withDetail("Services", result?.checks) + } catch (exception: IllegalArgumentException) { + logger.error(exception.message) + } } - builder.withDetail("Services", result?.checks) } } diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt index 080a26e6f..f64cba88b 100644 --- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt +++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt @@ -26,16 +26,16 @@ import org.springframework.context.annotation.PropertySource @PropertySource("classpath:application.properties") open class HealthCheckProperties { - @Value("\${blueprintprocessor.healthcheck.baseUrl}") + @Value("\${blueprintprocessor.healthcheck.baseUrl:}") private val bluePrintProcessorBaseURL: String? = null - @Value("#{'\${blueprintprocessor.healthcheck.mapping-service-name-with-service-link}'.split(']')}") + @Value("#{'\${blueprintprocessor.healthcheck.mapping-service-name-with-service-link:}'.split(']')}") private val blueprintprocessorServiceMapping: List<String>? = null - @Value("\${cdslistener.healthcheck.baseUrl}") + @Value("\${cdslistener.healthcheck.baseUrl:}") private val cdsListenerBaseURL: String? = null - @Value("#{'\${cdslistener.healthcheck.mapping-service-name-with-service-link}'.split(']')}") + @Value("#{'\${cdslistener.healthcheck.mapping-service-name-with-service-link:}'.split(']')}") private val cdsListenerServiceMapping: List<String>? = null open fun getBluePrintBaseURL(): String? { |