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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations