aboutsummaryrefslogtreecommitdiffstats
path: root/status-control
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2017-04-11 13:30:42 +0200
committerxg353y <xg353y@intl.att.com>2017-04-11 15:34:19 +0200
commitb6b7bef8bdcad15af01ac88a038dd763ce59f68f (patch)
tree399d39da23aaa37701e487df064e3e0c27709ef3 /status-control
parent19340cad94eeaa1b580f7c0c99531de499e8ca14 (diff)
[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 <xg353y@intl.att.com>
Diffstat (limited to 'status-control')
-rw-r--r--status-control/pom.xml16
-rw-r--r--status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java25
-rw-r--r--status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java26
3 files changed, 36 insertions, 31 deletions
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 @@
<description>Contains classes to update and query the MSO status per site</description>
<dependencies>
+ <dependency>
+ <groupId>org.evosuite</groupId>
+ <artifactId>evosuite-standalone-runtime</artifactId>
+ <version>${evosuiteVersion}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.openecomp.mso</groupId>
<artifactId>common</artifactId>
@@ -63,15 +69,5 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
-
</dependencies>
</project> \ 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