From 60db7465eae66cf8b12a411f33e791aca9c91769 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Wed, 1 Apr 2015 07:35:11 +0000 Subject: [PATCH] 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 --- .../test/util/MockAuthenticationUtilHelper.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java index 37a7045103..3615a6f7c9 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/MockAuthenticationUtilHelper.java @@ -39,14 +39,14 @@ public class MockAuthenticationUtilHelper { /** * Set up a Mockito mock AuthenticationUtil 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). 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(); } }