Search in sources :

Example 1 with CheckEntry

use of com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry 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;
}
Also used : CheckEntry(com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry) PluginStatusEntry(com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry) CheckResult(com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Example 2 with CheckEntry

use of com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry 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;
}
Also used : CheckEntry(com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry) PluginStatusEntry(com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry) CheckResult(com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Aggregations

RPCMessage (com.sequenceiq.cloudbreak.client.RPCMessage)2 CheckEntry (com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry)2 CheckResult (com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult)2 PluginStatusEntry (com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry)2