mock.user
Class MockOSUser

java.lang.Object
  extended by com.opensymphony.user.Entity
      extended by com.opensymphony.user.User
          extended by mock.user.MockOSUser
All Implemented Interfaces:
com.atlassian.crowd.embedded.api.User, Serializable, Comparable<com.atlassian.crowd.embedded.api.User>, Principal

public class MockOSUser
extends User

A Mock for the OSUser User object. com.opensymphony.user.User

Since:
v4.3
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.opensymphony.user.Entity
mutable, name
 
Constructor Summary
MockOSUser(String name)
           
MockOSUser(String name, String fullName, String emailAddress)
           
 
Method Summary
 boolean addToGroup(Group group)
          Add this User as a member to supplied Group.
 boolean authenticate(String password)
          Verify that the supplied password matches the stored password for the user.
 AccessProvider getAccessProvider()
          Retrieve pluggable AccessProvider for this entity.
 CredentialsProvider getCredentialsProvider()
          Retrieve pluggable CredentialsProvider for this entity.
 long getDirectoryId()
           
 String getDisplayName()
           
 String getEmail()
          Convenience method to access property.
 String getEmailAddress()
           
 String getFullName()
          Convenience method to access property.
 List<String> getGroups()
          List all Groups that User is a member of.
 String getName()
          Name (unique identifier) of entity.
 ProfileProvider getProfileProvider()
          Retrieve pluggable ProfileProvider for this entity.
 com.opensymphony.module.propertyset.PropertySet getPropertySet()
          Extra properties associated with entity.
 UserManager getUserManager()
          Retrieve underlying UserManager that this User is handled by.
 boolean inGroup(Group group)
          Determine whether User is member of supplied Group.
 boolean inGroup(String groupName)
          Determine whether User is member of supplied Group.
 boolean isActive()
           
 boolean isMutable()
          Determine if entity is mutable.
 void remove()
          Remove User from CredentialsProvider (providing it is mutable).
 boolean removeFromGroup(Group group)
          Remove this User as a member from supplied Group.
 void setEmail(String email)
          Convenience method to access property.
 void setFullName(String fullName)
          Convenience method to access property.
 void setPassword(String password)
          Change the User's password.
 void store()
          Force update to underlying data-stores.
protected  void update()
          Persists the current user in the embedded Crowd back-end.
 
Methods inherited from class com.opensymphony.user.User
compareTo, equals, hashCode
 
Methods inherited from class com.opensymphony.user.Entity
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Principal
toString
 

Constructor Detail

MockOSUser

public MockOSUser(String name)
Parameters:
name - username.

MockOSUser

public MockOSUser(String name,
                  String fullName,
                  String emailAddress)
Method Detail

setEmail

public void setEmail(String email)
Description copied from class: User
Convenience method to access property. This actually persists the new email address.

Overrides:
setEmail in class User
Parameters:
email - new email address.

getEmail

public String getEmail()
Description copied from class: User
Convenience method to access property.

Overrides:
getEmail in class User
Returns:
email address.

setFullName

public void setFullName(String fullName)
Description copied from class: User
Convenience method to access property. This actually persists the new full name.

Overrides:
setFullName in class User
Parameters:
fullName - new display name.

getFullName

public String getFullName()
Description copied from class: User
Convenience method to access property.

Overrides:
getFullName in class User
Returns:
the full name.

getGroups

public List<String> getGroups()
Description copied from class: User
List all Groups that User is a member of. Modifiying this Collection will not add or remove Groups.

Overrides:
getGroups in class User
Returns:
list of groups the user belongs to.

setPassword

public void setPassword(String password)
                 throws ImmutableException
Description copied from class: User
Change the User's password.

Overrides:
setPassword in class User
Parameters:
password - new password.
Throws:
ImmutableException - should never be thrown as all users from this implementation are "mutable".

addToGroup

public boolean addToGroup(Group group)
Description copied from class: User
Add this User as a member to supplied Group. Returns whether any modifications were made.

Overrides:
addToGroup in class User
Parameters:
group - group to add membership.
Returns:
true if membership added successfully.

authenticate

public boolean authenticate(String password)
Description copied from class: User
Verify that the supplied password matches the stored password for the user.

Overrides:
authenticate in class User
Parameters:
password - current password.
Returns:
true if the authentication was successful.

inGroup

public boolean inGroup(Group group)
Description copied from class: User
Determine whether User is member of supplied Group.

Overrides:
inGroup in class User
Parameters:
group - group to check membership.
Returns:
true if the user is a member of the group.

inGroup

public boolean inGroup(String groupName)
Description copied from class: User
Determine whether User is member of supplied Group.

Overrides:
inGroup in class User
Parameters:
groupName - name of group to check membership.
Returns:
true if the user is a member of the group.

remove

public void remove()
            throws ImmutableException
Description copied from class: User
Remove User from CredentialsProvider (providing it is mutable). Note that this also removes all custom attributes (profile) of the user too by virtue of cascade on the Crowd Service.

Overrides:
remove in class User
Throws:
ImmutableException

removeFromGroup

public boolean removeFromGroup(Group group)
Description copied from class: User
Remove this User as a member from supplied Group. Returns whether any modifications were made.

Overrides:
removeFromGroup in class User
Parameters:
group - group to remove membership.
Returns:
true if user successfully removed from group.

store

public void store()
           throws ImmutableException
Description copied from class: User
Force update to underlying data-stores. This allows providers that do not update persistent data on the fly to store changes. If any of the providers are immutable and fields that cannot be updated have changed, ImmutableException shall be thrown.

Overrides:
store in class User
Throws:
ImmutableException

update

protected void update()
Description copied from class: User
Persists the current user in the embedded Crowd back-end.

Overrides:
update in class User

isActive

public boolean isActive()
Specified by:
isActive in interface com.atlassian.crowd.embedded.api.User
Overrides:
isActive in class User

getEmailAddress

public String getEmailAddress()
Specified by:
getEmailAddress in interface com.atlassian.crowd.embedded.api.User
Overrides:
getEmailAddress in class User

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface com.atlassian.crowd.embedded.api.User
Overrides:
getDisplayName in class User

getDirectoryId

public long getDirectoryId()
Specified by:
getDirectoryId in interface com.atlassian.crowd.embedded.api.User
Overrides:
getDirectoryId in class User

getCredentialsProvider

public CredentialsProvider getCredentialsProvider()
Description copied from class: Entity
Retrieve pluggable CredentialsProvider for this entity.

Overrides:
getCredentialsProvider in class Entity

getName

public String getName()
Description copied from class: Entity
Name (unique identifier) of entity. This cannot be changed once the entity has been created.

Specified by:
getName in interface Principal
Overrides:
getName in class Entity

getProfileProvider

public ProfileProvider getProfileProvider()
Description copied from class: Entity
Retrieve pluggable ProfileProvider for this entity.

Overrides:
getProfileProvider in class Entity

getPropertySet

public com.opensymphony.module.propertyset.PropertySet getPropertySet()
Description copied from class: Entity
Extra properties associated with entity. This is managed by ProfileProvider.

Overrides:
getPropertySet in class Entity

getAccessProvider

public AccessProvider getAccessProvider()
Description copied from class: Entity
Retrieve pluggable AccessProvider for this entity.

Overrides:
getAccessProvider in class Entity

isMutable

public boolean isMutable()
Description copied from class: Entity
Determine if entity is mutable. If entity is read-only, false is returned.

Overrides:
isMutable in class Entity

getUserManager

public UserManager getUserManager()
Description copied from class: Entity
Retrieve underlying UserManager that this User is handled by.

Overrides:
getUserManager in class Entity


Copyright © 2002-2011 Atlassian. All Rights Reserved.