Health check to work without user_id 73/41673/2
authorsheetalm <sheetal.mudholkar@amdocs.com>
Mon, 9 Apr 2018 07:02:48 +0000 (12:32 +0530)
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Mon, 9 Apr 2018 12:11:18 +0000 (12:11 +0000)
healthcheck rest should work without the need for user_id in header
For health check user "public" is used
No need to fetch current session context to get tenant.
So changing tenant to be "dox"

Change-Id: Ie8296cde6245fe5e4b59a5c0b2052d06c878cb12
Issue-ID: SDC-1198
Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java

index bb2d9ea..04844b0 100644 (file)
@@ -21,7 +21,6 @@
 package org.openecomp.sdcrests.health.rest.services;
 
 import org.apache.cxf.jaxrs.impl.ResponseBuilderImpl;
-import org.openecomp.sdc.common.session.SessionContext;
 import org.openecomp.sdc.common.session.SessionContextProviderFactory;
 import org.openecomp.sdc.health.HealthCheckManager;
 import org.openecomp.sdc.health.HealthCheckManagerFactory;
@@ -58,21 +57,17 @@ public class HealthCheckImpl implements org.openecomp.sdcrests.health.rest.Healt
   public Response checkHealth() {
     HealthCheckResult healthCheckResult = new HealthCheckResult();
 
-    SessionContext context =
-        SessionContextProviderFactory.getInstance().createInterface().get();
-
-    SessionContextProviderFactory.getInstance().createInterface().create("public",
-        context.getTenant());
+    SessionContextProviderFactory.getInstance().createInterface().create("public", "dox");
 
     try {
       Collection<HealthInfo> healthInfos = healthCheckManager.checkHealth();
       healthCheckResult.setComponentsInfo(healthInfos);
       boolean someIsDown = healthInfos.stream()
           .anyMatch(healthInfo -> healthInfo.getHealthCheckStatus().equals(HealthCheckStatus.DOWN));
-      healthInfos.stream().
-          filter(healthInfo -> healthInfo.getHealthCheckComponent()
-              .equals(org.openecomp.sdc.health.data.MonitoredModules.BE)).
-          findFirst()
+      healthInfos.stream()
+          .filter(healthInfo -> healthInfo.getHealthCheckComponent()
+              .equals(org.openecomp.sdc.health.data.MonitoredModules.BE))
+          .findFirst()
           .ifPresent(healthInfo -> healthCheckResult.setSdcVersion(healthInfo.getVersion()));
       if (someIsDown) {
         Response.ResponseBuilder responseBuilder = new ResponseBuilderImpl();