use of com.sequenceiq.cloudbreak.client.RPCResponse 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));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SaltCheckerConclusionStepTest method checkShouldFallbackForOldImageVersionsAndReturnConclusionIfUnreachableNodeFound.
@Test
public void checkShouldFallbackForOldImageVersionsAndReturnConclusionIfUnreachableNodeFound() throws NodesUnreachableException {
RPCResponse<SaltHealthReport> response = new RPCResponse<>();
RPCMessage message = new RPCMessage();
message.setMessage("rpc response");
response.setMessages(List.of(message));
when(nodeStatusService.saltPing(eq(1L))).thenReturn(response);
when(stackService.getByIdWithListsInTransaction(eq(1L))).thenReturn(new Stack());
when(stackUtil.collectNodes(any())).thenReturn(Set.of(createNode("host1"), createNode("host2")));
when(stackUtil.collectAndCheckReachableNodes(any(), anyCollection())).thenThrow(new NodesUnreachableException("error", Set.of("host1")));
Conclusion stepResult = underTest.check(1L);
assertTrue(stepResult.isFailureFound());
assertEquals("Unreachable nodes: [host1]. We detected that cluster members can’t communicate with each other. " + "Please validate if all cluster members are available and healthy through your cloud provider.", stepResult.getConclusion());
assertEquals("Unreachable salt minions: [host1]", stepResult.getDetails());
assertEquals(SaltCheckerConclusionStep.class, stepResult.getConclusionStepClass());
verify(nodeStatusService, times(1)).saltPing(eq(1L));
verify(stackService, times(1)).getByIdWithListsInTransaction(eq(1L));
verify(stackUtil, times(1)).collectNodes(any());
verify(stackUtil, times(1)).collectAndCheckReachableNodes(any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SaltCheckerConclusionStepTest method checkShouldFallbackForOldImageVersionsAndBeSuccessfulIfNoUnreachableNodeFound.
@Test
public void checkShouldFallbackForOldImageVersionsAndBeSuccessfulIfNoUnreachableNodeFound() throws NodesUnreachableException {
RPCResponse<SaltHealthReport> response = new RPCResponse<>();
RPCMessage message = new RPCMessage();
message.setMessage("rpc response");
response.setMessages(List.of(message));
when(nodeStatusService.saltPing(eq(1L))).thenReturn(response);
when(stackService.getByIdWithListsInTransaction(eq(1L))).thenReturn(new Stack());
Set<Node> nodes = Set.of(createNode("host1"), createNode("host2"));
when(stackUtil.collectNodes(any())).thenReturn(nodes);
when(stackUtil.collectAndCheckReachableNodes(any(), anyCollection())).thenReturn(nodes);
Conclusion stepResult = underTest.check(1L);
assertFalse(stepResult.isFailureFound());
assertNull(stepResult.getConclusion());
assertNull(stepResult.getDetails());
assertEquals(SaltCheckerConclusionStep.class, stepResult.getConclusionStepClass());
verify(nodeStatusService, times(1)).saltPing(eq(1L));
verify(stackService, times(1)).getByIdWithListsInTransaction(eq(1L));
verify(stackUtil, times(1)).collectNodes(any());
verify(stackUtil, times(1)).collectAndCheckReachableNodes(any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class BatchOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
Map warnings = Maps.newHashMap();
List<Object> operations = Lists.newArrayList();
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new Object());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
operations.add(UserAddOperation.create("user", "first", "last", false).getOperationParamsForBatchCall());
BatchOperation.create(operations, warnings::put, Set.of()).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("batch"), anyList(), any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupAddMemberOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
Map warnings = Maps.newHashMap();
RPCResponse<Object> rpcResponse = new RPCResponse<>();
Group group = new Group();
group.setMemberUser(USERS);
rpcResponse.setResult(group);
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
GroupAddMemberOperation.create(GROUP_NAME, USERS, warnings::put).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("group_add_member"), anyList(), any(), any());
assertEquals(0, warnings.size());
}
Aggregations