RM-2027 Admin user is always "admin", system user is always "system".

+review RM-9

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@101018 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tom Page
2015-04-01 07:35:11 +00:00
parent 420cecd0c7
commit 60db7465ea

View File

@@ -39,14 +39,14 @@ public class MockAuthenticationUtilHelper
{
/**
* Set up a Mockito mock <code>AuthenticationUtil</code> so that it executes all methods assuming the user has
* permissions. If the mock is asked for details about the user then it assumes the user is "admin".
* permissions. If the mock is asked for details about the user then it assumes the currently authenticated user is
* "admin".
*
* @param mockAuthenticationUtil The mock to initialise.
*/
@SuppressWarnings("unchecked")
public static void setup(AuthenticationUtil mockAuthenticationUtil)
{
setup(mockAuthenticationUtil, "admin", "admin", "admin");
setup(mockAuthenticationUtil, "admin");
}
/**
@@ -54,13 +54,10 @@ public class MockAuthenticationUtilHelper
* permissions.
*
* @param mockAuthenticationUtil The mock to initialise.
* @param adminUserName The name of the default admin user.
* @param fullyAuthenticatedUser The name of the user that last authenticated.
* @param systemUserName The name of the system user.
*/
@SuppressWarnings("unchecked")
public static void setup(AuthenticationUtil mockAuthenticationUtil, String adminUserName,
String fullyAuthenticatedUser, String systemUserName)
public static void setup(AuthenticationUtil mockAuthenticationUtil, String fullyAuthenticatedUser)
{
reset(mockAuthenticationUtil);
@@ -90,9 +87,8 @@ public class MockAuthenticationUtilHelper
}).when(mockAuthenticationUtil).<Object> runAs(any(RunAsWork.class), anyString());
// assume admin
doReturn(adminUserName).when(mockAuthenticationUtil).getAdminUserName();
doReturn("admin").when(mockAuthenticationUtil).getAdminUserName();
doReturn(fullyAuthenticatedUser).when(mockAuthenticationUtil).getFullyAuthenticatedUser();
doReturn(systemUserName).when(mockAuthenticationUtil).getSystemUserName();
doReturn("system").when(mockAuthenticationUtil).getSystemUserName();
}
}