2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.components.distribution.engine;
23 import java.util.concurrent.Callable;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 public class UebHealthCheckCall implements Callable<Boolean> {
30 CambriaHandler cambriaHandler = new CambriaHandler();
35 private static Logger healthLogger = LoggerFactory.getLogger(DistributionEngineClusterHealth.UEB_HEALTH_LOG_CONTEXT);
37 private static Logger logger = LoggerFactory.getLogger(UebHealthCheckCall.class.getName());
39 public UebHealthCheckCall(String server, String publicApiKey) {
42 this.publicApiKey = publicApiKey;
46 public Boolean call() {
48 healthLogger.trace("Going to run health check towards ueb server {}", server);
50 boolean result = false;
51 CambriaErrorResponse cambriaErrorResponse = cambriaHandler.getApiKey(server, publicApiKey);
53 logger.debug("After running Health check towards ueb server {}. Result is {}", server, cambriaErrorResponse);
55 if (cambriaErrorResponse.httpCode < CambriaErrorResponse.HTTP_INTERNAL_SERVER_ERROR) {
56 logger.debug("After running Health check towards ueb server {}. Error code is {}. Set result to true", server, cambriaErrorResponse.httpCode);
60 healthLogger.trace("Result after running health check towards ueb server {} is {}. Returned result is {} ", server, cambriaErrorResponse, result);
65 public String getServer() {
69 public CambriaHandler getCambriaHandler() {
70 return cambriaHandler;
73 public void setCambriaHandler(CambriaHandler cambriaHandler) {
74 this.cambriaHandler = cambriaHandler;