Search in sources :

Example 41 with UserImpl

use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.

the class UserDaoTest method shouldThrowConflictExceptionWhenCreatingUserWithExistingAliases.

@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionWhenCreatingUserWithExistingAliases() throws Exception {
    final UserImpl newUser = new UserImpl("user123", "user123@eclipse.org", "user_name", "password", users[0].getAliases());
    userDao.create(newUser);
}
Also used : UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) Test(org.testng.annotations.Test)

Example 42 with UserImpl

use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.

the class UserDaoTest method shouldGetUserByName.

@Test
public void shouldGetUserByName() throws Exception {
    final UserImpl user = users[0];
    assertEqualsNoPassword(userDao.getByName(user.getName()), user);
}
Also used : UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) Test(org.testng.annotations.Test)

Example 43 with UserImpl

use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.

the class UserDaoTest method shouldCreateUser.

@Test(dependsOnMethods = "shouldGetUserById")
public void shouldCreateUser() throws Exception {
    final UserImpl newUser = new UserImpl("user123", "user123@eclipse.org", "user_name", "password", asList("google:user123", "github:user123"));
    userDao.create(newUser);
    assertEqualsNoPassword(userDao.getById(newUser.getId()), newUser);
}
Also used : UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) Test(org.testng.annotations.Test)

Example 44 with UserImpl

use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.

the class UserDaoTest method setUp.

@BeforeMethod
public void setUp() throws TckRepositoryException {
    users = new UserImpl[COUNT_OF_USERS];
    for (int i = 0; i < users.length; i++) {
        final String id = NameGenerator.generate("user", Constants.ID_LENGTH);
        final String name = "user_name-" + i;
        final String email = name + "@eclipse.org";
        final String password = NameGenerator.generate("", Constants.PASSWORD_LENGTH);
        final List<String> aliases = new ArrayList<>(asList("google:" + name, "github:" + name));
        users[i] = new UserImpl(id, email, name, password, aliases);
    }
    tckRepository.createAll(Arrays.asList(users));
}
Also used : ArrayList(java.util.ArrayList) UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 45 with UserImpl

use of org.eclipse.che.api.user.server.model.impl.UserImpl in project che by eclipse.

the class UserDaoTest method shouldGetUserByNameAndPassword.

@Test
public void shouldGetUserByNameAndPassword() throws Exception {
    final UserImpl user = users[0];
    assertEqualsNoPassword(userDao.getByAliasAndPassword(user.getName(), user.getPassword()), user);
}
Also used : UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) Test(org.testng.annotations.Test)

Aggregations

UserImpl (org.eclipse.che.api.user.server.model.impl.UserImpl)65 Test (org.testng.annotations.Test)45 User (org.eclipse.che.api.core.model.user.User)13 Response (com.jayway.restassured.response.Response)10 BeforeMethod (org.testng.annotations.BeforeMethod)9 ServerException (org.eclipse.che.api.core.ServerException)8 Transactional (com.google.inject.persist.Transactional)6 ConflictException (org.eclipse.che.api.core.ConflictException)5 BeforeUserRemovedEvent (org.eclipse.che.api.user.server.event.BeforeUserRemovedEvent)5 EntityManager (javax.persistence.EntityManager)4 NotFoundException (org.eclipse.che.api.core.NotFoundException)4 Page (org.eclipse.che.api.core.Page)4 PostUserPersistedEvent (org.eclipse.che.api.user.server.event.PostUserPersistedEvent)4 ProfileImpl (org.eclipse.che.api.user.server.model.impl.ProfileImpl)4 UserDao (org.eclipse.che.api.user.server.spi.UserDao)4 ArrayList (java.util.ArrayList)3 Inject (javax.inject.Inject)3 UserRemovedEvent (org.eclipse.che.api.user.server.event.UserRemovedEvent)3 UserDto (org.eclipse.che.api.user.shared.dto.UserDto)3 TckRepository (org.eclipse.che.commons.test.tck.repository.TckRepository)3