Package org.sonatype.security.usermanagement

Examples of org.sonatype.security.usermanagement.UserManager


  @Test
  public void testNotConfigured()
      throws Exception
  {
    UserManager userManager = this.lookup(UserManager.class, "LDAP");
    try {
      userManager.getUser("cstamas");

      Assert.fail("Expected UserNotFoundTransientException");
    }
    catch (UserNotFoundException e) {
    // OSS LDAP did throw transient when not configured, but Pro does not, it thrown only on error
View Full Code Here


  @Test
  public void testGetUserFromLocator()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();
    User user = userLocator.getUser("cstamas");
    assertNotNull(user);
    Assert.assertEquals("cstamas", user.getUserId());
    Assert.assertEquals("cstamas@sonatype.com", user.getEmailAddress());
    Assert.assertEquals("Tamas Cservenak", user.getName());
  }
View Full Code Here

  @Test
  public void testGetUserIds()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();
    Set<String> userIds = userLocator.listUserIds();
    assertTrue(userIds.contains("cstamas"));
    assertTrue(userIds.contains("brianf"));
    assertTrue(userIds.contains("jvanzyl"));
    assertTrue(userIds.contains("jdcasey"));
    Assert.assertEquals("Ids: " + userIds, 4, userIds.size());
View Full Code Here

  @Test
  public void testSearch()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();
    Set<User> users = userLocator.searchUsers(new UserSearchCriteria("j"));

    assertNotNull(this.getById(users, "jvanzyl"));
    assertNotNull(this.getById(users, "jdcasey"));
    Assert.assertEquals("Users: " + users, 2, users.size());
  }
View Full Code Here

  @Test
  public void testEffectiveSearch()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();

    Set<String> allRoleIds = new HashSet<String>();
    for (Role role : this.getSecuritySystem().listRoles()) {
      allRoleIds.add(role.getRoleId());
    }

    UserSearchCriteria criteria = new UserSearchCriteria("j", allRoleIds, null);

    Set<User> users = userLocator.searchUsers(criteria);

    assertNotNull(this.getById(users, "jvanzyl"));
    Assert.assertEquals("Users: " + users, 1, users.size());
  }
View Full Code Here

  @Test
  public void testGetUsers()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();
    Set<User> users = userLocator.listUsers();

    User cstamas = this.getById(users, "cstamas");
    Assert.assertEquals("cstamas", cstamas.getUserId());
    Assert.assertEquals("cstamas@sonatype.com", cstamas.getEmailAddress());
    Assert.assertEquals("Tamas Cservenak", cstamas.getName());
View Full Code Here

  }

  public void testListUserIds()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();

    Set<String> userIds = userLocator.listUserIds();
    Assert.assertTrue(userIds.contains("test-user"));
    Assert.assertTrue(userIds.contains("anonymous"));
    Assert.assertTrue(userIds.contains("admin"));

    Assert.assertEquals(4, userIds.size());
View Full Code Here

  }

  public void testListUsers()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();

    Set<User> users = userLocator.listUsers();
    Map<String, User> userMap = this.toUserMap(users);

    Assert.assertTrue(userMap.containsKey("test-user"));
    Assert.assertTrue(userMap.containsKey("anonymous"));
    Assert.assertTrue(userMap.containsKey("admin"));
View Full Code Here

  }

  public void testGetUser()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();
    User testUser = userLocator.getUser("test-user");

    Assert.assertEquals("Test User", testUser.getName());
    Assert.assertEquals("test-user", testUser.getUserId());
    Assert.assertEquals("changeme1@yourcompany.com", testUser.getEmailAddress());
View Full Code Here

  }

  public void testGetUserWithEmptyRole()
      throws Exception
  {
    UserManager userLocator = this.getUserManager();
    User testUser = userLocator.getUser("test-user-with-empty-role");

    Assert.assertEquals("Test User With Empty Role", testUser.getName());
    Assert.assertEquals("test-user-with-empty-role", testUser.getUserId());
    Assert.assertEquals("empty-role@yourcompany.com", testUser.getEmailAddress());
View Full Code Here

TOP

Related Classes of org.sonatype.security.usermanagement.UserManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.