use of com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsServiceTest method getErrorPayloadWithMixedResults.
private RPCResponse<CheckResult> getErrorPayloadWithMixedResults(String host) {
CheckResult checkResult = new CheckResult();
checkResult.setHost(host);
CheckEntry healthy = new CheckEntry();
healthy.setStatus("HEALTHY");
healthy.setCheckId("hId");
healthy.setPlugin("good");
CheckEntry unhealthy = new CheckEntry();
unhealthy.setStatus("UNHEALTHY");
unhealthy.setCheckId("unhId");
unhealthy.setPlugin("bad");
checkResult.setChecks(List.of(healthy, unhealthy));
PluginStatusEntry healthyPlugin = new PluginStatusEntry();
healthyPlugin.setPlugin("healthyPlugin");
healthyPlugin.setStatus("HEALTHY");
healthyPlugin.setHost(host);
PluginStatusEntry unhealthyPlugin = new PluginStatusEntry();
unhealthyPlugin.setPlugin("unhealthyPlugin");
unhealthyPlugin.setStatus("UNHEALTHY");
unhealthyPlugin.setHost(host);
checkResult.setPluginStats(List.of(healthyPlugin, unhealthyPlugin));
RPCResponse<CheckResult> badResponse;
badResponse = new RPCResponse<>();
badResponse.setResult(checkResult);
RPCMessage message = new RPCMessage();
message.setCode(503);
message.setMessage(JsonUtil.writeValueAsStringSilentSafe(checkResult));
badResponse.setMessages(List.of(message));
return badResponse;
}
use of com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsService method createRpcMessageFromCheckResult.
private RPCMessage createRpcMessageFromCheckResult(RPCResponse<CheckResult> nodeHealth) {
List<CheckEntry> checkEntries = filterCheckEntries(nodeHealth);
List<PluginStatusEntry> pluginStatusEntries = filterPluginStatusEntries(nodeHealth);
CheckResult filteredCheckResult = new CheckResult();
filteredCheckResult.setChecks(checkEntries);
filteredCheckResult.setPluginStats(pluginStatusEntries);
if (nodeHealth.getResult() != null) {
filteredCheckResult.setStatus(nodeHealth.getResult().getStatus());
filteredCheckResult.setHost(nodeHealth.getResult().getHost());
}
RPCMessage rpcMessage = new RPCMessage();
rpcMessage.setName("node health check");
rpcMessage.setMessage(JsonUtil.writeValueAsStringSilent(filteredCheckResult));
if (nodeHealth.getFirstRpcMessage() != null) {
rpcMessage.setCode(nodeHealth.getFirstRpcMessage().getCode());
}
return rpcMessage;
}
Aggregations