com.atlassian.sal.testresources.usersettings
Class MockUserSettingsService
java.lang.Object
com.atlassian.sal.testresources.usersettings.MockUserSettingsService
- All Implemented Interfaces:
- UserSettingsService
public class MockUserSettingsService
- extends Object
- implements UserSettingsService
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MockUserSettingsService
public MockUserSettingsService()
getUserSettings
public UserSettings getUserSettings(String userName)
- Description copied from interface:
UserSettingsService
- Gets the UserSettings for the user with name userName.
- Specified by:
getUserSettings in interface UserSettingsService
- Parameters:
userName - name of the user whose user settings are to be retrieved
- Returns:
- a UserSettings for the user with name userName,
getUserSettings
public UserSettings getUserSettings(UserKey user)
- Description copied from interface:
UserSettingsService
- Gets the UserSettings for the given user.
- Specified by:
getUserSettings in interface UserSettingsService
- Parameters:
user - key of a user whose user settings are to be retrieved
- Returns:
- a UserSettings for the user with name userName,
updateUserSettings
public void updateUserSettings(String userName,
com.google.common.base.Function<UserSettingsBuilder,UserSettings> updateFunction)
- Description copied from interface:
UserSettingsService
- Updates the UserSettings stored for this user with name UserName. Implementations of this interface will ensure
that updateFunctions provided to this method are called in a threadsafe manner.
Consumers can throw RuntimeExceptions within updateFunction to control flow when the input to updateFunction
is unexpected. As such, implementers must either rethrow caught RuntimeExceptions, or not catch them in the first place.
The intended behaviour of this function is that the return value of updateFunction be stored against the specified user.
However, product implementations do not do this, and update the user settings in the underlying database in response to calls
to the UserSettingsBuilder provided to updateFunction, and ignore the return value from updateFunction.
- Specified by:
updateUserSettings in interface UserSettingsService
- Parameters:
userName - name of the user whose UserSettings are to be updated. If userName does not match a known user,
updateFunction will not be called.updateFunction - function to update a user's UserSettings. The parameter to updateFunction is a
UserSettingsBuilder whose contents match the UserSettings for the provided user.
updateUserSettings
public void updateUserSettings(UserKey user,
com.google.common.base.Function<UserSettingsBuilder,UserSettings> updateFunction)
- Description copied from interface:
UserSettingsService
- Updates the UserSettings stored for this user. Implementations of this interface will ensure that updateFunctions
provided to this method are called in a threadsafe manner.
Consumers can throw RuntimeExceptions within updateFunction to control flow when the input to updateFunction
is unexpected. As such, implementers must either rethrow caught RuntimeExceptions, or not catch them in the first place.
The intended behaviour of this function is that the return value of updateFunction be stored against the specified user.
However, product implementations do not do this, and update the user settings in the underlying database in response to calls
to the UserSettingsBuilder provided to updateFunction, and ignore the return value from updateFunction.
This function will be deprecated in a future version of SAL with replacements with a more appropriate signature, or the
intended behaviour, or both.
- Specified by:
updateUserSettings in interface UserSettingsService
- Parameters:
user - key of a user whose UserSettings are to be updated. If user is null or does not exist updateFunction will not be called.updateFunction - function to update a user's UserSettings. The parameter to updateFunction is a
UserSettingsBuilder whose contents match the UserSettings for the provided user.
Copyright © 2015 Atlassian. All rights reserved.