diff options
author | Haddox, Anthony <ah0647@att.com> | 2019-05-07 11:52:12 -0700 |
---|---|---|
committer | Haddox, Anthony <ah0647@att.com> | 2019-05-07 11:52:12 -0700 |
commit | 06c30ec3fa1dbdf26b7e1abce89c68e3efc632c7 (patch) | |
tree | eaed7892bcb35af7d16de712d1bb96d37273290b /grToolkit | |
parent | a8287a9b4c1b679e04307669fffee6eb1d5f4ab5 (diff) |
Replace output with static constant
Replacing "output" with static constant OUTPUT.
This also resolves an issue with cross site health
check not being able to parse the health check.
Change-Id: Ie4d3b30b241620d00365d58db7797a5052f60827
Signed-off-by: Haddox, Anthony <ah0647@att.com>
Issue-ID: CCSDK-1312
Diffstat (limited to 'grToolkit')
-rwxr-xr-x | grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java index 39bc1618..f10055a1 100755 --- a/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java +++ b/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java @@ -48,7 +48,6 @@ import javax.annotation.Nonnull; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import org.onap.ccsdk.sli.core.dblib.DBLibConnection; import org.onap.ccsdk.sli.core.dblib.DbLibService; import org.onap.ccsdk.sli.plugins.grtoolkit.data.ClusterActor; import org.onap.ccsdk.sli.plugins.grtoolkit.data.MemberBuilder; @@ -103,6 +102,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT private static final String HEALTHY = "HEALTHY"; private static final String FAULTY = "FAULTY"; private static final String VALUE = "value"; + private static final String OUTPUT = "output"; private String akkaConfig; private String jolokiaClusterPath; private String shardManagerPath; @@ -540,12 +540,13 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT if(!performedCrossSiteHealthCheck) { try { String content = getRequestContent(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:site-identifier", HttpMethod.POST); - crossSiteIdentifier = new JSONObject(content).getJSONObject("output").getString("id"); + crossSiteIdentifier = new JSONObject(content).getJSONObject(OUTPUT).getString("id"); crossSiteDbHealthy = crossSiteHealthRequest(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:database-health"); crossSiteAdminHealthy = crossSiteHealthRequest(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:admin-health"); performedCrossSiteHealthCheck = true; } catch(Exception e) { - log.info("Cannot get site identifier from {}", clusterActor.getNode()); + log.info("Cannot get cross site health from {}", clusterActor.getNode()); + log.info("siteIdentifier: {} | dbHealth: {} | adminHealth: {}", crossSiteIdentifier, crossSiteDbHealthy, crossSiteAdminHealthy); log.error("Site Health Error", e); } } @@ -570,12 +571,13 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT if(!performedCrossSiteHealthCheck) { try { String content = getRequestContent(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:site-identifier", HttpMethod.POST); - crossSiteIdentifier = new JSONObject(content).getJSONObject("output").getString("id"); + crossSiteIdentifier = new JSONObject(content).getJSONObject(OUTPUT).getString("id"); crossSiteDbHealthy = crossSiteHealthRequest(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:database-health"); crossSiteAdminHealthy = crossSiteHealthRequest(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:admin-health"); performedCrossSiteHealthCheck = true; } catch(Exception e) { - log.info("Cannot get site identifier from {}", clusterActor.getNode()); + log.info("Cannot get cross site health from {}", clusterActor.getNode()); + log.info("siteIdentifier: {} | dbHealth: {} | adminHealth: {}", crossSiteIdentifier, crossSiteDbHealthy, crossSiteAdminHealthy); log.error("Site Health Error", e); } } @@ -815,7 +817,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT String content = getRequestContent(path, HttpMethod.POST); try { JSONObject responseJson = new JSONObject(content); - JSONObject responseValue = responseJson.getJSONObject(VALUE); + JSONObject responseValue = responseJson.getJSONObject(OUTPUT); return HEALTHY.equals(responseValue.getString("health")); } catch(JSONException e) { log.error("Error parsing JSON", e); |