use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupAddMemberOperationTest method testInvokeWhenResultHasMissingUser.
@Test
public void testInvokeWhenResultHasMissingUser() throws FreeIpaClientException {
Map warnings = Maps.newHashMap();
RPCResponse<Object> rpcResponse = new RPCResponse<>();
Group group = new Group();
group.setMemberUser(List.of("user1"));
rpcResponse.setResult(group);
when(freeIpaClient.invoke(any(), anyList(), any(), any())).thenReturn(rpcResponse);
GroupAddMemberOperation.create(GROUP_NAME, USERS, warnings::put).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("group_add_member"), anyList(), any(), any());
assertEquals(1, warnings.size());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupAddOperationTest 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);
GroupAddOperation.create(GROUP_NAME, POSIX, warnings::put).invoke(freeIpaClient);
verify(freeIpaClient).invoke(eq("group_add"), anyList(), any(), any());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupAddOperationTest method testInvokePosix.
@Test
public void testInvokePosix() 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, POSIX, 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"));
}
use of com.sequenceiq.cloudbreak.client.RPCResponse in project cloudbreak by hortonworks.
the class GroupRemoveMemberOperationTest method testInvokeWhenResultStillHasUser.
@Test
public void testInvokeWhenResultStillHasUser() throws FreeIpaClientException {
Map warnings = Maps.newHashMap();
RPCResponse<Object> rpcResponse = new RPCResponse<>();
Group group = new Group();
group.setMemberUser(List.of("user1"));
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(1, warnings.size());
}
use of com.sequenceiq.cloudbreak.client.RPCResponse 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));
}
Aggregations