Search in sources :

Example 11 with FmsUser

use of com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser in project cloudbreak by hortonworks.

the class FmsUserConverterTest method testMachineUserToFmsUser.

@Test
public void testMachineUserToFmsUser() {
    String name = "Foo";
    String id = "Bar";
    String workloadUsername = "foobar";
    UserManagementProto.MachineUser umsMachineUser = UserManagementProto.MachineUser.newBuilder().setMachineUserName(name).setMachineUserId(id).setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.ACTIVE).build();
    FmsUser fmsUser = underTest.toFmsUser(umsMachineUser);
    assertEquals(workloadUsername, fmsUser.getName());
    assertEquals(name, fmsUser.getFirstName());
    assertEquals(id, fmsUser.getLastName());
    assertEquals(FmsUser.State.ENABLED, fmsUser.getState());
}
Also used : FmsUser(com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser) UserManagementProto(com.cloudera.thunderhead.service.usermanagement.UserManagementProto) Test(org.junit.jupiter.api.Test)

Example 12 with FmsUser

use of com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser in project cloudbreak by hortonworks.

the class FmsUserConverterTest method testUserSyncActorDetailsToFmsUserMissingNames.

@Test
public void testUserSyncActorDetailsToFmsUserMissingNames() {
    String workloadUsername = "foobar";
    UserManagementProto.UserSyncActorDetails actorDetails = UserManagementProto.UserSyncActorDetails.newBuilder().setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.ACTIVE).build();
    FmsUser fmsUser = underTest.toFmsUser(actorDetails);
    assertEquals(workloadUsername, fmsUser.getName());
    assertEquals(underTest.NONE_STRING, fmsUser.getFirstName());
    assertEquals(underTest.NONE_STRING, fmsUser.getLastName());
    assertEquals(FmsUser.State.ENABLED, fmsUser.getState());
}
Also used : FmsUser(com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser) UserManagementProto(com.cloudera.thunderhead.service.usermanagement.UserManagementProto) Test(org.junit.jupiter.api.Test)

Example 13 with FmsUser

use of com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser in project cloudbreak by hortonworks.

the class FmsUserConverterTest method testUserToFmsUserUnrecognizedState.

@Test
public void testUserToFmsUserUnrecognizedState() {
    String workloadUsername = "foobar";
    UserManagementProto.User umsUser = UserManagementProto.User.newBuilder().setWorkloadUsername(workloadUsername).setStateValue(UNRECOGNIZED_STATE_VALUE).build();
    FmsUser fmsUser = underTest.toFmsUser(umsUser);
    assertEquals(workloadUsername, fmsUser.getName());
    assertEquals(underTest.NONE_STRING, fmsUser.getFirstName());
    assertEquals(underTest.NONE_STRING, fmsUser.getLastName());
    assertEquals(FmsUser.State.ENABLED, fmsUser.getState());
}
Also used : FmsUser(com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser) UserManagementProto(com.cloudera.thunderhead.service.usermanagement.UserManagementProto) Test(org.junit.jupiter.api.Test)

Example 14 with FmsUser

use of com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser in project cloudbreak by hortonworks.

the class FmsUserConverterTest method testUserToFmsUserWithSpaces.

@Test
public void testUserToFmsUserWithSpaces() {
    String firstName = " Foo ";
    String lastName = " Bar ";
    String workloadUsername = "foobar";
    UserManagementProto.User umsUser = UserManagementProto.User.newBuilder().setFirstName(firstName).setLastName(lastName).setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.ACTIVE).build();
    FmsUser fmsUser = underTest.toFmsUser(umsUser);
    assertEquals("foobar", fmsUser.getName());
    assertEquals("Foo", fmsUser.getFirstName());
    assertEquals("Bar", fmsUser.getLastName());
    assertEquals(FmsUser.State.ENABLED, fmsUser.getState());
}
Also used : FmsUser(com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser) UserManagementProto(com.cloudera.thunderhead.service.usermanagement.UserManagementProto) Test(org.junit.jupiter.api.Test)

Example 15 with FmsUser

use of com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser in project cloudbreak by hortonworks.

the class FmsUserConverterTest method testMachineUserToFmsUserUnrecognizedState.

@Test
public void testMachineUserToFmsUserUnrecognizedState() {
    String workloadUsername = "foobar";
    UserManagementProto.MachineUser umsMachineUser = UserManagementProto.MachineUser.newBuilder().setWorkloadUsername(workloadUsername).setStateValue(UNRECOGNIZED_STATE_VALUE).build();
    FmsUser fmsUser = underTest.toFmsUser(umsMachineUser);
    assertEquals(workloadUsername, fmsUser.getName());
    assertEquals(underTest.NONE_STRING, fmsUser.getFirstName());
    assertEquals(underTest.NONE_STRING, fmsUser.getLastName());
    assertEquals(FmsUser.State.ENABLED, fmsUser.getState());
}
Also used : FmsUser(com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser) UserManagementProto(com.cloudera.thunderhead.service.usermanagement.UserManagementProto) Test(org.junit.jupiter.api.Test)

Aggregations

FmsUser (com.sequenceiq.freeipa.service.freeipa.user.model.FmsUser)42 Test (org.junit.jupiter.api.Test)33 UserManagementProto (com.cloudera.thunderhead.service.usermanagement.UserManagementProto)23 UsersState (com.sequenceiq.freeipa.service.freeipa.user.model.UsersState)8 FmsGroup (com.sequenceiq.freeipa.service.freeipa.user.model.FmsGroup)6 UmsUsersState (com.sequenceiq.freeipa.service.freeipa.user.model.UmsUsersState)5 List (java.util.List)5 Map (java.util.Map)5 UserMetadata (com.sequenceiq.freeipa.service.freeipa.user.model.UserMetadata)4 UsersStateDifference (com.sequenceiq.freeipa.service.freeipa.user.model.UsersStateDifference)3 Collection (java.util.Collection)3 Set (java.util.Set)3 Maps (com.google.common.collect.Maps)2 Sets (com.google.common.collect.Sets)2 JsonRpcClientException (com.googlecode.jsonrpc4j.JsonRpcClientException)2 IPA_PROTECTED_USERS (com.sequenceiq.freeipa.client.FreeIpaChecks.IPA_PROTECTED_USERS)2 IPA_UNMANAGED_GROUPS (com.sequenceiq.freeipa.client.FreeIpaChecks.IPA_UNMANAGED_GROUPS)2 FreeIpaClient (com.sequenceiq.freeipa.client.FreeIpaClient)2 FreeIpaClientException (com.sequenceiq.freeipa.client.FreeIpaClientException)2 FreeIpaErrorCodes (com.sequenceiq.freeipa.client.FreeIpaErrorCodes)2