use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsServiceTest method getGoodPayload.
private RPCResponse<CheckResult> getGoodPayload(String host) {
CheckResult checkResult = new CheckResult();
checkResult.setHost(host);
RPCResponse<CheckResult> goodResponse;
goodResponse = new RPCResponse<>();
goodResponse.setResult(checkResult);
RPCMessage message = new RPCMessage();
message.setCode(200);
message.setMessage("success");
goodResponse.setMessages(List.of(message));
return goodResponse;
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsService method parseMessages.
private NodeHealthDetails parseMessages(RPCResponse<CheckResult> rpcResponse, InstanceMetaData instanceMetaData) {
NodeHealthDetails nodeResponse = new NodeHealthDetails();
nodeResponse.setName(instanceMetaData.getDiscoveryFQDN());
nodeResponse.setInstanceId(instanceMetaData.getInstanceId());
if (isHealthCheckPassing(rpcResponse)) {
nodeResponse.setStatus(HEALTHY_INSTANCE_STATUS);
} else {
nodeResponse.setStatus(InstanceStatus.UNHEALTHY);
nodeResponse.setIssues(rpcResponse.getMessages().stream().map(RPCMessage::getMessage).collect(Collectors.toList()));
}
return nodeResponse;
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class FreeIpaInstanceHealthDetailsService method toBooleanRpcResponse.
private RPCResponse<Boolean> toBooleanRpcResponse(RPCResponse<CheckResult> nodeHealth) {
RPCMessage rpcMessage = createRpcMessageFromCheckResult(nodeHealth);
RPCResponse<Boolean> response = new RPCResponse<>();
response.setSummary(nodeHealth.getSummary());
response.setResult(isHealthCheckPassing(nodeHealth));
response.setCount(nodeHealth.getCount());
response.setTruncated(nodeHealth.getTruncated());
response.setMessages(List.of(rpcMessage));
response.setCompleted(nodeHealth.getCompleted());
response.setFailed(nodeHealth.getFailed());
response.setValue(nodeHealth.getValue());
return response;
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class CdpNodeStatusMonitorClient method toRpcResponse.
private <T> RPCResponse<T> toRpcResponse(String name, Response response, Function<String, T> builderFunc, boolean skipObjectMapping) {
RPCResponse<T> rpcResponse = new RPCResponse<>();
String message = response.readEntity(String.class);
if (!skipObjectMapping) {
rpcResponse.setResult(builderFunc.apply(message));
}
RPCMessage rpcMessage = new RPCMessage();
rpcMessage.setName(name);
rpcMessage.setCode(response.getStatus());
rpcMessage.setMessage(message);
rpcResponse.setSummary(name);
rpcResponse.setMessages(List.of(rpcMessage));
rpcResponse.setCount(1);
rpcResponse.setTruncated(Boolean.FALSE);
return rpcResponse;
}
use of com.sequenceiq.cloudbreak.client.RPCMessage in project cloudbreak by hortonworks.
the class NodeServicesCheckerConclusionStepTest method checkShouldBeSuccessfulIfNodeStatusReportIsNullForOlderImageVersions.
@Test
public void checkShouldBeSuccessfulIfNodeStatusReportIsNullForOlderImageVersions() {
RPCResponse<NodeStatusReport> response = new RPCResponse<>();
RPCMessage message = new RPCMessage();
message.setMessage("rpc response");
response.setMessages(List.of(message));
when(nodeStatusService.getServicesReport(eq(1L))).thenReturn(response);
Conclusion stepResult = underTest.check(1L);
assertFalse(stepResult.isFailureFound());
assertNull(stepResult.getConclusion());
assertNull(stepResult.getDetails());
assertEquals(NodeServicesCheckerConclusionStep.class, stepResult.getConclusionStepClass());
verify(nodeStatusService, times(1)).getServicesReport(eq(1L));
}
Aggregations