Search in sources :

Example 1 with RPCMessage

use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.

the class NetworkCheckerConclusionStepTest method checkShouldBeSuccessfulIfNetworkReportIsNullForOlderImageVersions.

@Test
public void checkShouldBeSuccessfulIfNetworkReportIsNullForOlderImageVersions() {
    RPCResponse<NodeStatusReport> response = new RPCResponse<>();
    RPCMessage message = new RPCMessage();
    message.setMessage("rpc response");
    response.setMessages(List.of(message));
    when(nodeStatusService.getNetworkReport(eq(1L))).thenReturn(response);
    Conclusion stepResult = underTest.check(1L);
    assertFalse(stepResult.isFailureFound());
    assertNull(stepResult.getConclusion());
    assertNull(stepResult.getDetails());
    assertEquals(NetworkCheckerConclusionStep.class, stepResult.getConclusionStepClass());
    verify(nodeStatusService, times(1)).getNetworkReport(eq(1L));
}
Also used : NodeStatusReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatusReport) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage) Test(org.junit.jupiter.api.Test)

Example 2 with RPCMessage

use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.

the class ServerConnCheckFreeipaRpcResponse method unreachable.

public static ServerConnCheckFreeipaRpcResponse unreachable() {
    RPCMessage rpcMessage = new RPCMessage();
    rpcMessage.setMessage("Unreachable mock");
    return new ServerConnCheckFreeipaRpcResponse(false, List.of(rpcMessage));
}
Also used : RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Example 3 with RPCMessage

use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.

the class FreeIpaHealthCheckClient method toRpcResponse.

private <T> RPCResponse<T> toRpcResponse(String name, Response response, Class<T> resultType) {
    T resultResponse = response.readEntity(resultType);
    RPCResponse<T> rpcResponse = new RPCResponse<>();
    RPCMessage rpcMessage = new RPCMessage();
    rpcMessage.setName(name);
    rpcMessage.setCode(response.getStatus());
    rpcMessage.setMessage(response.readEntity(String.class));
    rpcResponse.setSummary(name);
    rpcResponse.setMessages(List.of(rpcMessage));
    rpcResponse.setResult(resultResponse);
    rpcResponse.setCount(1);
    rpcResponse.setTruncated(Boolean.FALSE);
    return rpcResponse;
}
Also used : RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Example 4 with RPCMessage

use of com.sequenceiq.cloudbreak.client.RPCMessage 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 5 with RPCMessage

use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.

the class FreeIpaInstanceHealthDetailsServiceTest method newLegacyRPCMessage.

private RPCMessage newLegacyRPCMessage(String message) {
    RPCMessage msg = new RPCMessage();
    msg.setMessage(message);
    msg.setName("ExternalCommandOutput");
    return msg;
}
Also used : RPCMessage(com.sequenceiq.cloudbreak.client.RPCMessage)

Aggregations

RPCMessage (com.sequenceiq.cloudbreak.client.RPCMessage)18 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)8 CheckResult (com.sequenceiq.freeipa.client.healthcheckmodel.CheckResult)4 Test (org.junit.jupiter.api.Test)4 NodeStatusReport (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatusReport)2 SaltHealthReport (com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport)2 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)2 NodeHealthDetails (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.NodeHealthDetails)2 CheckEntry (com.sequenceiq.freeipa.client.healthcheckmodel.CheckEntry)2 PluginStatusEntry (com.sequenceiq.freeipa.client.healthcheckmodel.PluginStatusEntry)2 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 NodesUnreachableException (com.sequenceiq.cloudbreak.util.NodesUnreachableException)1 Matcher (java.util.regex.Matcher)1