From d9d360318e1a4ae67958356d0fe3fb207f90fbf8 Mon Sep 17 00:00:00 2001 From: sheetalm Date: Mon, 9 Apr 2018 12:32:48 +0530 Subject: Health check to work without user_id 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 --- .../sdcrests/health/rest/services/HealthCheckImpl.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java index bb2d9ea565..04844b08b2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/healthcheck-rest/healthcheck-rest-services/src/main/java/org/openecomp/sdcrests/health/rest/services/HealthCheckImpl.java @@ -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 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(); -- cgit 1.2.3-korg