Search in sources :

Example 41 with JsonRpcClientException

use of com.googlecode.jsonrpc4j.JsonRpcClientException in project cloudbreak by hortonworks.

the class KerberosMgmtRoleComponentV1Test method testDeleteRoleIfNoLongerUsedWhenRoleDoesNotExist.

@Test
public void testDeleteRoleIfNoLongerUsedWhenRoleDoesNotExist() throws Exception {
    Mockito.when(mockIpaClient.showRole(anyString())).thenThrow(new FreeIpaClientException(ERROR_MESSAGE, new JsonRpcClientException(NOT_FOUND, ERROR_MESSAGE, null)));
    underTest.deleteRoleIfItIsNoLongerUsed(ROLE, mockIpaClient);
    Mockito.verify(mockIpaClient, Mockito.never()).deleteRole(ROLE);
}
Also used : JsonRpcClientException(com.googlecode.jsonrpc4j.JsonRpcClientException) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) Test(org.junit.jupiter.api.Test)

Example 42 with JsonRpcClientException

use of com.googlecode.jsonrpc4j.JsonRpcClientException in project cloudbreak by hortonworks.

the class UserModOperationTest method testInvokeIfEmptyModListErrorOccurs.

@Test
public void testInvokeIfEmptyModListErrorOccurs() throws FreeIpaClientException {
    when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenThrow(new FreeIpaClientException("error", new JsonRpcClientException(4202, "", null)));
    UserModOperation.create("key", new Object(), USER_NAME).invoke(freeIpaClient);
    verify(freeIpaClient).invoke(eq("user_mod"), anyList(), any(), any());
}
Also used : JsonRpcClientException(com.googlecode.jsonrpc4j.JsonRpcClientException) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) Test(org.junit.jupiter.api.Test)

Example 43 with JsonRpcClientException

use of com.googlecode.jsonrpc4j.JsonRpcClientException in project iris-client by iris-connect.

the class EPSStatusClient method checkApp.

public AppInfo checkApp(String epsEndpoint) {
    var methodName = epsEndpoint + "._ping";
    try {
        var ping = epsRpcClient.invoke(methodName, null, Ping.class);
        var name = ping.serverInfo != null ? ping.serverInfo.name : messages.getMessage("StatusService.unknown_app_name");
        return new AppInfo(name, ping.version);
    } catch (ConnectException | SocketTimeoutException e) {
        // Connection timeout
        throw new EpsConnectionException(e.getMessage());
    } catch (JsonRpcClientException e) {
        throw new AppStatusException(e.getMessage());
    } catch (Throwable t) {
        throw new AppStatusInternalException(t.getMessage(), t);
    }
}
Also used : EpsConnectionException(iris.client_bff.status.EpsConnectionException) SocketTimeoutException(java.net.SocketTimeoutException) JsonRpcClientException(com.googlecode.jsonrpc4j.JsonRpcClientException) AppStatusException(iris.client_bff.status.AppStatusException) AppStatusInternalException(iris.client_bff.status.AppStatusInternalException) AppInfo(iris.client_bff.status.AppInfo) ConnectException(java.net.ConnectException)

Aggregations

JsonRpcClientException (com.googlecode.jsonrpc4j.JsonRpcClientException)43 Test (org.junit.jupiter.api.Test)40 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)38 Map (java.util.Map)13 RoleRequest (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.RoleRequest)10 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)8 Stack (com.sequenceiq.freeipa.entity.Stack)7 Host (com.sequenceiq.freeipa.client.model.Host)6 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 HashSet (java.util.HashSet)5 Optional (java.util.Optional)5 Role (com.sequenceiq.freeipa.client.model.Role)4 Service (com.sequenceiq.freeipa.client.model.Service)4 AddDnsARecordRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsARecordRequest)3 ServiceKeytabRequest (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest)3 ServiceKeytabResponse (com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabResponse)3 Privilege (com.sequenceiq.freeipa.client.model.Privilege)3 Set (java.util.Set)3 AddDnsCnameRecordRequest (com.sequenceiq.freeipa.api.v1.dns.model.AddDnsCnameRecordRequest)2