use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class FactoryServiceTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
factoryBuilderSpy = spy(new FactoryBuilder(new SourceStorageParametersValidator()));
factoryParametersResolvers = new HashSet<>();
doNothing().when(factoryBuilderSpy).checkValid(any(FactoryDto.class));
doNothing().when(factoryBuilderSpy).checkValid(any(FactoryDto.class), anyBoolean());
when(factoryParametersResolverHolder.getFactoryParametersResolvers()).thenReturn(factoryParametersResolvers);
user = new UserImpl(USER_ID, USER_EMAIL, ADMIN_USER_NAME);
when(userManager.getById(anyString())).thenReturn(user);
when(preferenceManager.find(USER_ID)).thenReturn(ImmutableMap.of("preference", "value"));
service = new FactoryService(factoryManager, userManager, preferenceManager, createValidator, acceptValidator, editValidator, factoryBuilderSpy, workspaceManager, factoryParametersResolverHolder);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class FactoryBaseValidatorTest method setUp.
@BeforeMethod
public void setUp() throws ParseException, NotFoundException, ServerException {
factory = newDto(FactoryDto.class).withV("4.0").withCreator(newDto(AuthorDto.class).withUserId("userid"));
final UserImpl user = new UserImpl("userid", "email", "name");
when(userDao.getById("userid")).thenReturn(user);
validator = new TesterFactoryBaseValidator();
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class PreferenceDaoTest method setUp.
@BeforeMethod
private void setUp() throws Exception {
userPreferences = new ArrayList<>(ENTRY_COUNT);
UserImpl[] users = new UserImpl[ENTRY_COUNT];
for (int index = 0; index < ENTRY_COUNT; index++) {
String userId = "userId_" + index;
users[index] = new UserImpl(userId, "email_" + userId, "name_" + userId, "password", emptyList());
final Map<String, String> prefs = new HashMap<>();
prefs.put("preference1", "value");
prefs.put("preference2", "value");
prefs.put("preference3", "value");
userPreferences.add(Pair.of(userId, prefs));
}
userTckRepository.createAll(Arrays.asList(users));
preferenceTckRepository.createAll(userPreferences);
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldUpdateUser.
@Test(dependsOnMethods = "shouldGetUserById")
public void shouldUpdateUser() throws Exception {
final UserImpl user = users[0];
userDao.update(new UserImpl(user.getId(), "new-email", "new-name", null, asList("google:new-alias", "github:new-alias")));
final UserImpl updated = userDao.getById(user.getId());
assertEquals(updated.getId(), user.getId());
assertEquals(updated.getEmail(), "new-email");
assertEquals(updated.getName(), "new-name");
assertEquals(new HashSet<>(updated.getAliases()), new HashSet<>(asList("google:new-alias", "github:new-alias")));
}
use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.
the class UserDaoTest method shouldThrowConflictExceptionWhenUpdatingUserWithReservedName.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenUpdatingUserWithReservedName() throws Exception {
final UserImpl user = users[0];
user.setName(users[1].getName());
userDao.update(user);
}
Aggregations