Search in sources :

Example 1 with RPCResponse

use of com.sequenceiq.cloudbreak.client.RPCResponse 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 RPCResponse

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

the class NetworkCheckerConclusionStepTest method createNetworkReportResponse.

private RPCResponse<NodeStatusReport> createNetworkReportResponse(NetworkDetails networkDetails) {
    StatusDetails statusDetails = StatusDetails.newBuilder().setHost("host1").build();
    NodeStatus nodeStatus = NodeStatus.newBuilder().setStatusDetails(statusDetails).setNetworkDetails(networkDetails).build();
    NodeStatusReport nodeStatusReport = NodeStatusReport.newBuilder().addNodes(nodeStatus).build();
    RPCResponse<NodeStatusReport> response = new RPCResponse<>();
    response.setResult(nodeStatusReport);
    return response;
}
Also used : StatusDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.StatusDetails) NodeStatusReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatusReport) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) NodeStatus(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatus)

Example 3 with RPCResponse

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

the class NodeServicesCheckerConclusionStepTest method createNodeStatusResponse.

private RPCResponse<NodeStatusReport> createNodeStatusResponse(HealthStatus saltBootstrapServiceStatus) {
    StatusDetails statusDetails = StatusDetails.newBuilder().setHost("host1").build();
    ServiceStatus serviceStatus = ServiceStatus.newBuilder().setName("salt-bootstrap").setStatus(saltBootstrapServiceStatus).build();
    ServicesDetails servicesDetails = ServicesDetails.newBuilder().addInfraServices(serviceStatus).build();
    NodeStatus nodeStatus = NodeStatus.newBuilder().setStatusDetails(statusDetails).setServicesDetails(servicesDetails).build();
    NodeStatusReport nodeStatusReport = NodeStatusReport.newBuilder().addNodes(nodeStatus).build();
    RPCResponse<NodeStatusReport> response = new RPCResponse<>();
    response.setResult(nodeStatusReport);
    return response;
}
Also used : ServiceStatus(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.ServiceStatus) StatusDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.StatusDetails) NodeStatusReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatusReport) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) NodeStatus(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.NodeStatus) ServicesDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.ServicesDetails)

Example 4 with RPCResponse

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

the class SaltCheckerConclusionStepTest method createSaltPingResponse.

private RPCResponse<SaltHealthReport> createSaltPingResponse(HealthStatus masterServiceStatus, HealthStatus minionHealthStatus) {
    StatusDetails pingResponses = StatusDetails.newBuilder().setHost("host1").setStatus(minionHealthStatus).setStatusReason("bigproblem").build();
    SaltMinionsHealth saltMinionsHealth = SaltMinionsHealth.newBuilder().addPingResponses(pingResponses).build();
    ServiceStatus serviceStatus = ServiceStatus.newBuilder().setName("salt-bootstrap").setStatus(masterServiceStatus).build();
    SaltMasterHealth saltMasterHealth = SaltMasterHealth.newBuilder().addServices(serviceStatus).build();
    SaltHealthReport saltHealthReport = SaltHealthReport.newBuilder().setMaster(saltMasterHealth).setMinions(saltMinionsHealth).build();
    RPCResponse<SaltHealthReport> response = new RPCResponse<>();
    response.setResult(saltHealthReport);
    return response;
}
Also used : SaltMinionsHealth(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltMinionsHealth) SaltHealthReport(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltHealthReport) ServiceStatus(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.ServiceStatus) StatusDetails(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.StatusDetails) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) SaltMasterHealth(com.cloudera.thunderhead.telemetry.nodestatus.NodeStatusProto.SaltMasterHealth)

Example 5 with RPCResponse

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

the class GroupRemoveMemberOperationTest method testInvoke.

@Test
public void testInvoke() throws FreeIpaClientException {
    Map warnings = Maps.newHashMap();
    RPCResponse<Object> rpcResponse = new RPCResponse<>();
    Group group = new Group();
    group.setMemberUser(List.of());
    rpcResponse.setResult(group);
    when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
    GroupRemoveMemberOperation.create(GROUP_NAME, USERS, warnings::put).invoke(freeIpaClient);
    verify(freeIpaClient).invoke(eq("group_remove_member"), anyList(), any(), any());
    assertEquals(0, warnings.size());
}
Also used : Group(com.sequenceiq.freeipa.client.model.Group) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Aggregations

RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)43 Test (org.junit.jupiter.api.Test)31 Map (java.util.Map)17 Group (com.sequenceiq.freeipa.client.model.Group)12 User (com.sequenceiq.freeipa.client.model.User)10 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)9 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)9 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)9 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)9 ArgumentMatchers.eq (org.mockito.ArgumentMatchers.eq)9 Mock (org.mockito.Mock)9 Mockito.verify (org.mockito.Mockito.verify)9 Mockito.when (org.mockito.Mockito.when)9 MockitoExtension (org.mockito.junit.jupiter.MockitoExtension)9 RPCMessage (com.sequenceiq.cloudbreak.client.RPCMessage)8 List (java.util.List)8 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)7 ArgumentMatchers.argThat (org.mockito.ArgumentMatchers.argThat)7 SudoRule (com.sequenceiq.freeipa.client.model.SudoRule)6 FmsUser (com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser)6