use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SudoRuleAddAllowCommandOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new SudoRule());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
SudoRuleAddAllowCommandOperation.create(NAME, COMMAND).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("sudorule_add_allow_command"), argThat(argument -> argument.contains(NAME) && argument.size() == 1), argThat(argument -> COMMAND.equals(argument.get("sudocmd")) && argument.size() == 1), eq(SudoRule.class));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SudoRuleAddDenyCommandOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new SudoRule());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
SudoRuleAddDenyCommandOperation.create(NAME, COMMAND).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("sudorule_add_deny_command"), argThat(argument -> argument.contains(NAME) && argument.size() == 1), argThat(argument -> COMMAND.equals(argument.get("sudocmd")) && argument.size() == 1), eq(SudoRule.class));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SudoRuleAddGroupOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new SudoRule());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
SudoRuleAddGroupOperation.create(NAME, GROUP).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("sudorule_add_user"), argThat(argument -> argument.contains(NAME) && argument.size() == 1), argThat(argument -> GROUP.equals(argument.get("group")) && argument.size() == 1), eq(SudoRule.class));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SudoRuleShowOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new SudoRule());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
SudoRuleShowOperation.create(NAME).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("sudorule_show"), argThat(argument -> argument.contains(NAME) && argument.size() == 1), argThat(argument -> argument.isEmpty()), eq(SudoRule.class));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class UserAddOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new User());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
UserAddOperation.create(USER_NAME, USER_NAME, USER_NAME, false).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("user_add"), anyList(), any(), any());
}
Aggregations