Search in sources :

Example 1 with Group

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

the class GroupAddMemberResponse method handleInternal.

@Override
protected Group handleInternal(List<CloudVmMetaDataStatus> metadatas, String body) {
    Group group = new Group();
    group.setCn("admins");
    group.setMemberUser(List.of("admin"));
    return group;
}
Also used : Group(com.sequenceiq.freeipa.client.model.Group)

Example 2 with Group

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

the class GroupFindResponse method handleInternal.

@Override
protected Set<Group> handleInternal(List<CloudVmMetaDataStatus> metadatas, String body) {
    Group group = new Group();
    group.setCn("admins");
    group.setMemberUser(List.of("admin"));
    return Set.of(group);
}
Also used : Group(com.sequenceiq.freeipa.client.model.Group)

Example 3 with Group

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

the class GroupRemoveMemberOperationTest method testInvoke.

@Test
public void testInvoke() throws FreeIpaClientException {
    Map warnings = Maps.newHashMap();
    RPCResponse<Object> rpcResponse = new RPCResponse<>();
    Group group = new Group();
    group.setMemberUser(List.of());
    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(0, warnings.size());
}
Also used : Group(com.sequenceiq.freeipa.client.model.Group) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 4 with Group

use of com.sequenceiq.freeipa.client.model.Group 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());
}
Also used : Group(com.sequenceiq.freeipa.client.model.Group) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 5 with Group

use of com.sequenceiq.freeipa.client.model.Group 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"));
}
Also used : Group(com.sequenceiq.freeipa.client.model.Group) RPCResponse(com.sequenceiq.cloudbreak.client.RPCResponse) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Aggregations

Group (com.sequenceiq.freeipa.client.model.Group)21 Test (org.junit.jupiter.api.Test)14 RPCResponse (com.sequenceiq.cloudbreak.client.RPCResponse)12 Map (java.util.Map)12 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)5 FmsGroup (com.sequenceiq.freeipa.service.freeipa.user.model.FmsGroup)4 List (java.util.List)4 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)3 ArrayListMultimap (com.google.common.collect.ArrayListMultimap)2 HashMultimap (com.google.common.collect.HashMultimap)2 Multimap (com.google.common.collect.Multimap)2 JsonRpcClientException (com.googlecode.jsonrpc4j.JsonRpcClientException)2 FreeIpaErrorCodes (com.sequenceiq.freeipa.client.FreeIpaErrorCodes)2 SudoRule (com.sequenceiq.freeipa.client.model.SudoRule)2 User (com.sequenceiq.freeipa.client.model.User)2 BatchPartitionSizeProperties (com.sequenceiq.freeipa.configuration.BatchPartitionSizeProperties)2 FmsUser (com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser)2 ThreadInterruptChecker (com.sequenceiq.freeipa.util.ThreadInterruptChecker)2 Collection (java.util.Collection)2 Set (java.util.Set)2