com.atlassian.jira.user
Class MockUserKeyService

java.lang.Object
  extended by com.atlassian.jira.user.MockUserKeyService
All Implemented Interfaces:
UserKeyService

public class MockUserKeyService
extends Object
implements UserKeyService


Constructor Summary
MockUserKeyService()
           
 
Method Summary
 String getKeyForUser(com.atlassian.crowd.embedded.api.User user)
          This convenience method is equivalent to getKeyForUsername(user.getName()), except that it is null-safe.
 String getKeyForUsername(String username)
          Returns the key that is associated with the given username.
 String getUsernameForKey(String key)
          Returns the (lower-cased) username that is associated with the given key.
 void setMapping(String key, String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockUserKeyService

public MockUserKeyService()
Method Detail

getUsernameForKey

public String getUsernameForKey(String key)
Description copied from interface: UserKeyService
Returns the (lower-cased) username that is associated with the given key. Normally this mapping is retained even for deleted users.

Note that this returns the lower-case of the username (because username must act case-insensitive in our key->username map).

Specified by:
getUsernameForKey in interface UserKeyService
Parameters:
key - the key to resolve to a username (may be null)
Returns:
the username that is currently associated with the key, or null if key is null or unmapped. Note that a non-null result does not guarantee that the user still exists.

getKeyForUsername

public String getKeyForUsername(String username)
Description copied from interface: UserKeyService
Returns the key that is associated with the given username. Normally this mapping is retained even for deleted users.

Specified by:
getKeyForUsername in interface UserKeyService
Parameters:
username - the username to resolve to a key (may be null)
Returns:
the key that is currently associated with the username, or null if username is null or unmapped. Note that a non-null result does not guarantee that the user still exists.

getKeyForUser

public String getKeyForUser(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: UserKeyService
This convenience method is equivalent to getKeyForUsername(user.getName()), except that it is null-safe.

Specified by:
getKeyForUser in interface UserKeyService
Parameters:
user - the user to resolve to a key (may be null)
Returns:
as for UserKeyService.getKeyForUsername(String)

setMapping

public void setMapping(String key,
                       String username)


Copyright © 2002-2014 Atlassian. All Rights Reserved.