Пример #1
0
  @Test
  public void getByEmailTest() {
    User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);

    user = userService.getByEmail(user.getEmail());
    assertNotNull(user);
  }
Пример #2
0
  @Test
  public void getApplicationVersionsByUserTest() {
    User user = getUser(UserRole.ROLE_ORG_ADMIN, UserRole.ROLE_GROUP_USER);
    user = userService.getByEmail(user.getEmail());

    List<ApplicationVersion> applicationVersions = userService.getApplicationVersions(user);
    assertTrue(applicationVersions.size() == 2);
  }
Пример #3
0
  @Test
  public void getOrganizationsTest() {
    User user = getUser(UserRole.ROLE_ORG_ADMIN, UserRole.ROLE_GROUP_USER);
    user = userService.getByEmail(user.getEmail());

    List<Organization> organizations = userService.getOrganizations(user);
    assertTrue(organizations.size() == 1);
  }
Пример #4
0
  @Test
  public void getGroupsForOrgAdminTest() {
    User user = getUser(UserRole.ROLE_ORG_ADMIN, UserRole.ROLE_GROUP_USER);
    user = userService.getByEmail(user.getEmail());

    List<Group> groups = userService.getGroups(user);
    assertTrue(groups.size() == 1);
  }
Пример #5
0
 @Test
 public void getApplicationsByUserApplicationTypeAppStates() {
   User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);
   user = userService.getByEmail(user.getEmail());
   List<Application> applications =
       userService.getApplicationsForUser(user, ApplicationType.ANDROID, AppState.GROUP_PUBLISH);
   assertTrue(applications.size() == 1);
 }
Пример #6
0
  @Test
  public void updateTest() {
    User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);
    user.setLastName("Tester");

    user = userService.getByEmail(user.getEmail());
    userService.update(user);
    assertEquals(user.getLastName(), "Tester");
  }
Пример #7
0
 @Test
 public void activationTest() {
   User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);
   user = userService.getByEmail(user.getEmail());
   assertFalse(user.isActivated());
   boolean activated = userService.activate(user.getId(), user.getActivationCode());
   assertTrue(activated);
   assertTrue(user.isActivated());
 }
Пример #8
0
 @Test
 public void getApplicationsByUserApplicationTypeCategoryAppStatesTest() {
   User user = getUser(UserRole.ROLE_ORG_USER, UserRole.ROLE_GROUP_USER);
   user = userService.getByEmail(user.getEmail());
   Organization organization = organizationService.getAll().get(0);
   Category category = organization.getCategories().get(0);
   List<Application> applications =
       userService.getApplicationsForUser(
           user, ApplicationType.ANDROID, category.getId(), AppState.GROUP_PUBLISH);
   assertTrue(applications.size() == 1);
 }
Пример #9
0
  @Test
  public void getApplicationVersionByUserApplicationAppState() {
    User user = getUser(UserRole.ROLE_ORG_ADMIN, UserRole.ROLE_GROUP_USER);
    user = userService.getByEmail(user.getEmail());

    List<ApplicationVersion> applicationVersions = userService.getApplicationVersions(user);
    for (ApplicationVersion applicationVersion : applicationVersions) {
      applicationVersions =
          userService.getApplicationVersions(
              user,
              applicationVersion.getApplication().getId(),
              SortOrder.ASCENDING,
              AppState.ORGANIZATION_PUBLISH,
              AppState.GROUP_PUBLISH);
      assertTrue(applicationVersions.size() == 1);
    }
  }