use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupRemoveOperationTest method testInvoke.
@Test
public void testInvoke() throws FreeIpaClientException {
Map warnings = Maps.newHashMap();
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new Group());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
GroupRemoveOperation.create(GROUP_NAME, warnings::put).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("group_del"), anyList(), any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SudoRuleAddOperationTest method testInvokeWithAllHostCategory.
@Test
public void testInvokeWithAllHostCategory() throws FreeIpaClientException {
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new SudoRule());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
SudoRuleAddOperation.create(NAME, true, null).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("sudorule_add"), argThat(argument -> argument.contains(NAME) && argument.size() == 1), argThat(argument -> "all".equals(argument.get("hostcategory")) && argument.size() == 1), eq(SudoRule.class));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class SudoRuleAddOperationTest 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);
SudoRuleAddOperation.create(NAME, false, null).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("sudorule_add"), 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 UserModOperationTest 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);
UserModOperation.create("key", new Object(), USER_NAME).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("user_mod"), anyList(), any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupAddOperationTest method testInvokeNonPosix.
@Test
public void testInvokeNonPosix() throws FreeIpaClientException {
Map warnings = Maps.newHashMap();
RPCResponse<Object> rpcResponse = new RPCResponse<>();
rpcResponse.setResult(new Group());
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
GroupAddOperation.create(GROUP_NAME, NONPOSIX, warnings::put).invoke(freeIpaClient);
ArgumentCaptor<Map<String, Object>> paramCaptor = ArgumentCaptor.forClass(Map.class);
verify(freeIpaClient).invoke(eq("group_add"), anyList(), paramCaptor.capture(), any());
Map<String, Object> params = paramCaptor.getValue();
assertTrue(params.containsKey("nonposix"));
assertTrue((Boolean) params.get("nonposix"));
}
Aggregations