From b6b7bef8bdcad15af01ac88a038dd763ce59f68f Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 11 Apr 2017 13:30:42 +0200 Subject: [MSO-8] Update the maven dependency Update the maven depenency for sdc-distribution-client to cooperate with the sdc changes. Change-Id: I2da936e5c40cb68c7181bb78307192dd5655b5dc Signed-off-by: xg353y --- status-control/pom.xml | 16 +++++-------- .../java/org/openecomp/mso/HealthCheckUtils.java | 25 +++++++++++++++------ .../org/openecomp/mso/HealthCheckUtilsTest.java | 26 ++++++++++------------ 3 files changed, 36 insertions(+), 31 deletions(-) (limited to 'status-control') diff --git a/status-control/pom.xml b/status-control/pom.xml index 458a399f3a..3ed1d5178a 100644 --- a/status-control/pom.xml +++ b/status-control/pom.xml @@ -15,6 +15,12 @@ Contains classes to update and query the MSO status per site + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + org.openecomp.mso common @@ -63,15 +69,5 @@ test - - org.apache.httpcomponents - httpcore - - - - org.apache.httpcomponents - httpclient - - \ No newline at end of file diff --git a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java index 03e807ae5a..e0e712cd48 100644 --- a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java +++ b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -59,11 +59,13 @@ public class HealthCheckUtils { .entity (NOT_FOUND) .build (); - public enum NodeType {APIH, RA}; + public enum NodeType {APIH, RA, BPMN}; public boolean catalogDBCheck (MsoLogger subMsoLogger, long startTime) { - try (CatalogDatabase catalogDB = new CatalogDatabase ()) { + try { + CatalogDatabase catalogDB = new CatalogDatabase (); catalogDB.healthCheck (); + catalogDB.close(); } catch (Exception e) { subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check catalog database", e); subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception during healthcheck"); @@ -129,12 +131,14 @@ public class HealthCheckUtils { if (null != requestId) { finalUrl = finalUrl + "?requestId=" + requestId; } - try (CloseableHttpClient client = getHttpClient()) { + try { HttpResponse response; + CloseableHttpClient client = getHttpClient (); HttpGet get = new HttpGet(finalUrl); msoLogger.debug("Get url is: " + finalUrl); response = client.execute(get); msoLogger.debug("Get response is: " + response); + client.close (); //shut down the connection if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { msoLogger.debug("verifyLocalHealth - Successfully communicate with APIH/BPMN/RA"); return true; @@ -206,6 +210,13 @@ public class HealthCheckUtils { return false; } apis = apiList.split(","); + } else if (NodeType.BPMN.equals (type)){ + String apiList = topologyProp.getProperty("camunda-healthcheck-urn", null); + if (null == apiList) { + msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Not able to get jra-healthcheck-urn parameter", "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to get jra-healthcheck-urn parameter"); + return false; + } + apis = apiList.split(","); } else { msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Unknown NodeType:" + type, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Unknown NodeType:" + type); return false; @@ -236,7 +247,7 @@ public class HealthCheckUtils { String apihLB = topologyProp.getProperty("apih-load-balancer", null); String apihApi = topologyProp.getProperty("apih-nodehealthcheck-urn", null); String bpmnLB= topologyProp.getProperty("camunda-load-balancer", null); - String bpmnApi = topologyProp.getProperty("camunda-healthcheck-urn", null); + String bpmnApi = topologyProp.getProperty("camunda-nodehealthcheck-urn", null); String jraLB = topologyProp.getProperty("jra-load-balancer", null); String jraApi = topologyProp.getProperty("jra-nodehealthcheck-urn", null); @@ -285,4 +296,4 @@ public class HealthCheckUtils { return "http://" + ip + ":" + port + url; } } -} +} \ No newline at end of file diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java index 712cdb2ce6..6077e202b2 100644 --- a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java +++ b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java @@ -229,14 +229,12 @@ public class HealthCheckUtilsTest { assertTrue (utils.verifyGlobalHealthCheck (true, null)); - // mising server-port parameter + // mising server-camunda parameter MsoJavaProperties newProperties1 = new MsoJavaProperties(); Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties1); newProperties1.setProperty("apih-load-balancer", ip1); newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1); - newProperties1.setProperty("camunda-load-balancer",ip1); - newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); newProperties1.setProperty("jra-load-balancer",ip1); newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1); @@ -247,11 +245,11 @@ public class HealthCheckUtilsTest { Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties2); newProperties2.setProperty("server-port", port); - newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1); - newProperties1.setProperty("camunda-load-balancer",ip1); - newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); - newProperties1.setProperty("jra-load-balancer",ip1); - newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1); + newProperties2.setProperty("apih-nodehealthcheck-urn",apihUrl1); + newProperties2.setProperty("camunda-load-balancer",ip1); + newProperties2.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); + newProperties2.setProperty("jra-load-balancer",ip1); + newProperties2.setProperty("jra-nodehealthcheck-urn",raUrl1); assertFalse (utils.verifyGlobalHealthCheck (true, null)); @@ -260,11 +258,11 @@ public class HealthCheckUtilsTest { Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties3); newProperties3.setProperty("server-port", port); - newProperties1.setProperty("apih-load-balancer", ip1); - newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1); - newProperties1.setProperty("camunda-load-balancer",ip1); - newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); - newProperties1.setProperty("jra-load-balancer",ip1); + newProperties3.setProperty("apih-load-balancer", ip1); + newProperties3.setProperty("apih-nodehealthcheck-urn",apihUrl1); + newProperties3.setProperty("camunda-load-balancer",ip1); + newProperties3.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); + newProperties3.setProperty("jra-load-balancer",ip1); newProperties3.setProperty("jra-server-list",ip1); assertFalse (utils.verifyGlobalHealthCheck (true, null)); @@ -297,4 +295,4 @@ public class HealthCheckUtilsTest { } return null; } -} +} \ No newline at end of file -- cgit 1.2.3-korg