Search in sources :

Example 1 with SudoCommand

use of com.sequenceiq.freeipa.client.model.SudoCommand in project cloudbreak by hortonworks.

the class SudoRuleServiceTest method aSudoCommand.

private SudoCommand aSudoCommand(String command) {
    SudoCommand sudoCommand = new SudoCommand();
    sudoCommand.setSudocmd(command);
    return sudoCommand;
}
Also used : SudoCommand(com.sequenceiq.freeipa.client.model.SudoCommand)

Example 2 with SudoCommand

use of com.sequenceiq.freeipa.client.model.SudoCommand in project cloudbreak by hortonworks.

the class SudoCommandAddOperationTest method testInvoke.

@Test
public void testInvoke() throws FreeIpaClientException {
    RPCResponse<Object> rpcResponse = new RPCResponse<>();
    rpcResponse.setResult(new SudoCommand());
    when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
    SudoCommandAddOperation.create(NAME).invoke(freeIpaClient);
    verify(freeIpaClient).invoke(eq("sudocmd_add"), argThat(argument -> argument.contains(NAME) && argument.size() == 1), argThat(argument -> argument.isEmpty()), eq(SudoCommand.class));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Mock(org.mockito.Mock) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) FreeIpaClientException(com.sequenceiq.freeipa.client.FreeIpaClientException) Mockito.when(org.mockito.Mockito.when) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) FreeIpaClient(com.sequenceiq.freeipa.client.FreeIpaClient) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) SudoCommand(com.sequenceiq.freeipa.client.model.SudoCommand) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) SudoCommand(com.sequenceiq.freeipa.client.model.SudoCommand) Test(org.junit.jupiter.api.Test)

Aggregations

SudoCommand (com.sequenceiq.freeipa.client.model.SudoCommand)2 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)1 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)1 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)1 Test (org.junit.jupiter.api.Test)1 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)1 ArgumentMatchers.argThat (org.mockito.ArgumentMatchers.argThat)1 ArgumentMatchers.eq (org.mockito.ArgumentMatchers.eq)1 Mock (org.mockito.Mock)1 Mockito.verify (org.mockito.Mockito.verify)1 Mockito.when (org.mockito.Mockito.when)1 MockitoExtension (org.mockito.junit.jupiter.MockitoExtension)1