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
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
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;
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;
private static final String HEALTHY = "HEALTHY";
private static final String FAULTY = "FAULTY";
private static final String VALUE = "value";
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;
private String akkaConfig;
private String jolokiaClusterPath;
private String shardManagerPath;
if(!performedCrossSiteHealthCheck) {
try {
String content = getRequestContent(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:site-identifier", HttpMethod.POST);
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) {
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);
}
}
log.error("Site Health Error", e);
}
}
if(!performedCrossSiteHealthCheck) {
try {
String content = getRequestContent(httpProtocol + clusterActor.getNode() + ":" + port + "/restconf/operations/gr-toolkit:site-identifier", HttpMethod.POST);
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) {
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);
}
}
log.error("Site Health Error", e);
}
}
String content = getRequestContent(path, HttpMethod.POST);
try {
JSONObject responseJson = new JSONObject(content);
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);
return HEALTHY.equals(responseValue.getString("health"));
} catch(JSONException e) {
log.error("Error parsing JSON", e);