Search in sources :

Example 26 with FmsUser

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

the class FmsUserConverterTest method testMachineUserToFmsUserMissingNames.

@Test
public void testMachineUserToFmsUserMissingNames() {
    String workloadUsername = "foobar";
    UserManagementProto.MachineUser umsMachineUser = UserManagementProto.MachineUser.newBuilder().setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.ACTIVE).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)

Example 27 with FmsUser

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

the class FmsUserConverterTest method testUserSyncActorDetailsToFmsUserWithSpaces.

@Test
public void testUserSyncActorDetailsToFmsUserWithSpaces() {
    String firstName = " Foo ";
    String lastName = " Bar ";
    String workloadUsername = "foobar";
    UserManagementProto.UserSyncActorDetails actorDetails = UserManagementProto.UserSyncActorDetails.newBuilder().setFirstName(firstName).setLastName(lastName).setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.ACTIVE).build();
    FmsUser fmsUser = underTest.toFmsUser(actorDetails);
    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 28 with FmsUser

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

the class FmsUserConverterTest method testUserSyncActorDetailsToFmsUser.

@Test
public void testUserSyncActorDetailsToFmsUser() {
    String firstName = "Foo";
    String lastName = "Bar";
    String workloadUsername = "foobar";
    UserManagementProto.UserSyncActorDetails actorDetails = UserManagementProto.UserSyncActorDetails.newBuilder().setFirstName(firstName).setLastName(lastName).setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.ACTIVE).build();
    FmsUser fmsUser = underTest.toFmsUser(actorDetails);
    assertEquals(workloadUsername, fmsUser.getName());
    assertEquals(firstName, fmsUser.getFirstName());
    assertEquals(lastName, 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 29 with FmsUser

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

the class FmsUserConverterTest method testUserToFmsUserDeletingState.

@Test
public void testUserToFmsUserDeletingState() {
    String workloadUsername = "foobar";
    UserManagementProto.User umsUser = UserManagementProto.User.newBuilder().setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.DELETING).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 30 with FmsUser

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

the class FmsUserConverterTest method testMachineUserToFmsUserDeactivatedState.

@Test
public void testMachineUserToFmsUserDeactivatedState() {
    String workloadUsername = "foobar";
    UserManagementProto.MachineUser umsMachineUser = UserManagementProto.MachineUser.newBuilder().setWorkloadUsername(workloadUsername).setState(UserManagementProto.ActorState.Value.DEACTIVATED).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.DISABLED, 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