use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class FactoryDaoTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
factories = new FactoryImpl[ENTRY_COUNT];
users = new UserImpl[ENTRY_COUNT];
for (int i = 0; i < ENTRY_COUNT; i++) {
users[i] = new UserImpl("userId_" + i, "email_" + i, "name" + i);
}
for (int i = 0; i < ENTRY_COUNT; i++) {
factories[i] = createFactory(i, users[i].getId());
}
userTckRepository.createAll(Arrays.asList(users));
factoryTckRepository.createAll(Stream.of(factories).map(FactoryImpl::new).collect(toList()));
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserManagerTest method shouldCreateProfileAndPreferencesOnUserCreation.
@Test
public void shouldCreateProfileAndPreferencesOnUserCreation() throws Exception {
final UserImpl user = new UserImpl(null, "test@email.com", "testName", null, null);
manager.create(user, false);
verify(userDao).create(any(UserImpl.class));
verify(profileDao).create(any(ProfileImpl.class));
verify(preferencesDao).setPreferences(anyString(), anyMapOf(String.class, String.class));
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserManagerTest method shouldGeneratePasswordWhenCreatingUserAndItIsMissing.
@Test
public void shouldGeneratePasswordWhenCreatingUserAndItIsMissing() throws Exception {
final User user = new UserImpl(null, "test@email.com", "testName", null, null);
manager.create(user, false);
final ArgumentCaptor<UserImpl> userCaptor = ArgumentCaptor.forClass(UserImpl.class);
verify(userDao).create(userCaptor.capture());
assertNotNull(userCaptor.getValue().getPassword());
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserManagerTest method shouldGetUserByName.
@Test
public void shouldGetUserByName() throws Exception {
final User user = new UserImpl("identifier", "test@email.com", "testName", "password", Collections.singletonList("alias"));
when(manager.getByName(user.getName())).thenReturn(user);
assertEquals(manager.getByName(user.getName()), user);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserManagerTest method shouldNotGenerateIdentifierWhenCreatingUserWithNotNullId.
@Test
public void shouldNotGenerateIdentifierWhenCreatingUserWithNotNullId() throws Exception {
final User user = new UserImpl("identifier", "test@email.com", "testName", null, null);
manager.create(user, false);
final ArgumentCaptor<UserImpl> userCaptor = ArgumentCaptor.forClass(UserImpl.class);
verify(userDao).create(userCaptor.capture());
final String id = userCaptor.getValue().getId();
assertNotNull(id);
assertEquals(id, "identifier");
}
Aggregations