Fixing SDCListenerCustomIndicator issues 33/99433/4
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>
Tue, 10 Dec 2019 16:44:58 +0000 (18:44 +0200)
committerKAPIL SINGAL <ks220y@att.com>
Thu, 26 Dec 2019 16:10:54 +0000 (16:10 +0000)
Issue-ID: CCSDK-1669

Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com>
Change-Id: Ifa69221c9008c344b712728f26b94f1e7114baaf

ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/actuator/indicator/SDCListenerCustomIndicator.java
ms/sdclistener/application/src/main/resources/application.yaml

index f64cba8..c1532cd 100644 (file)
@@ -52,7 +52,7 @@ open class HealthCheckProperties {
     }
 
     open fun getCDSListenerServiceInformation(): List<ServiceEndpoint> {
-        val serviceName = ServiceName.BLUEPRINT
+        val serviceName = ServiceName.CDSLISTENER
         return getListOfServiceEndPoints(cdsListenerServiceMapping, serviceName)
     }
 
@@ -78,7 +78,7 @@ open class HealthCheckProperties {
 
     private fun getServiceEndpoint(serviceEndpointInfo: List<String>): ServiceEndpoint {
         return ServiceEndpoint(
-            removeSpecialCharacter(serviceEndpointInfo.get(0)), removeSpecialCharacter(serviceEndpointInfo.get(1))
+            removeSpecialCharacter(serviceEndpointInfo[0]), removeSpecialCharacter(serviceEndpointInfo[1])
         )
     }
 
index 2ec241d..04cbebe 100644 (file)
@@ -19,11 +19,14 @@ package org.onap.ccsdk.cds.sdclistener;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.ComponentScan;
 
 @SpringBootApplication
 @EnableConfigurationProperties(SdcListenerConfiguration.class)
+@ComponentScan(basePackages = {"org.onap.ccsdk.cds.blueprintsprocessor.healthapi","org.onap.ccsdk.cds.sdclistener"})
 public class SdcListenerApplication {
     public static void main(String[] args) {
+
         SpringApplication.run(SdcListenerApplication.class, args);
     }
 
index 1a5bafc..5758512 100644 (file)
@@ -20,8 +20,8 @@ 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.SDCListenerHealthCheck;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health.Builder;
+import org.springframework.boot.actuate.health.Health;
+import org.springframework.boot.actuate.health.HealthIndicator;
 import org.springframework.stereotype.Component;
 
 /**
@@ -31,20 +31,18 @@ import org.springframework.stereotype.Component;
  * @version 1.0
  */
 @Component
-public class SDCListenerCustomIndicator extends AbstractHealthIndicator {
+public class SDCListenerCustomIndicator implements HealthIndicator {
 
     @Autowired
     private SDCListenerHealthCheck sDCListenerHealthCheck;
 
     @Override
-    protected void doHealthCheck(Builder builder) {
+    public Health health() {
         HealthApiResponse healthAPIResponse = sDCListenerHealthCheck.retrieveEndpointExecutionStatus();
         if (healthAPIResponse.getStatus() == HealthCheckStatus.UP) {
-            builder.up();
-        } else {
-            builder.down();
+
+            return Health.up().withDetail("Services", healthAPIResponse.getChecks()).build();
         }
-        builder.withDetail("Services", healthAPIResponse.getChecks());
+        return Health.down().build();
     }
-
 }
index b3f8443..424f0a5 100644 (file)
@@ -25,3 +25,28 @@ server:
 spring:
   main:
     web-environment: ${sprintWebListenerEnabled:true}
+
+
+
+cdslistener:
+  healthcheck:
+    baseUrl: http://localhost:9000/
+#servicename = SDC Listener service and service link = /api/v1/sdclistener/healthcheck (this is used to check if sdclistener is up depending on all services status)
+#if you want to add more service it will like [service-name,service-link],[],[]
+    mapping-service-name-with-service-link: "[SDC Listener service,/api/v1/sdclistener/healthcheck]"
+
+management:
+  endpoint:
+    health:
+      show-details: always
+
+
+  endpoints:
+    web:
+      exposure:
+        include: "*"
+
+endpoints:
+  user:
+    name: eHbVUbJAj4AG2522cSbrOQ==
+    password: eHbVUbJAj4AG2522cSbrOQ==