diff --git a/pom.xml b/pom.xml
index 8d2238148c..674f9e2441 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,7 +38,7 @@
6.2
7.9
6.1
- 8.26
+ 8.27
7.1
1.1
1.0.9
diff --git a/src/main/java/org/alfresco/filesys/repo/ContentDiskDriver.java b/src/main/java/org/alfresco/filesys/repo/ContentDiskDriver.java
index 9a2e1f1021..d2c3804a38 100644
--- a/src/main/java/org/alfresco/filesys/repo/ContentDiskDriver.java
+++ b/src/main/java/org/alfresco/filesys/repo/ContentDiskDriver.java
@@ -667,7 +667,7 @@ public class ContentDiskDriver extends AlfrescoTxDiskDriver implements DiskInter
// Use the system user as the authenticated context for the filesystem initialization
AuthenticationUtil.pushAuthentication();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Start the transaction
diff --git a/src/main/java/org/alfresco/repo/admin/patch/impl/SiteLoadPatch.java b/src/main/java/org/alfresco/repo/admin/patch/impl/SiteLoadPatch.java
index 740e26f397..5bb89afa07 100644
--- a/src/main/java/org/alfresco/repo/admin/patch/impl/SiteLoadPatch.java
+++ b/src/main/java/org/alfresco/repo/admin/patch/impl/SiteLoadPatch.java
@@ -264,7 +264,7 @@ public class SiteLoadPatch extends AbstractPatch
);
// At this point we can go back to being the system
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Setup the Importer Bootstrap Beans
for(ImporterBootstrap bootstrap : new ImporterBootstrap[] { spacesBootstrap, usersBootstrap })
diff --git a/src/main/java/org/alfresco/repo/imap/ImapServiceImpl.java b/src/main/java/org/alfresco/repo/imap/ImapServiceImpl.java
index 74b6d2678a..b64a5d0cb9 100644
--- a/src/main/java/org/alfresco/repo/imap/ImapServiceImpl.java
+++ b/src/main/java/org/alfresco/repo/imap/ImapServiceImpl.java
@@ -97,7 +97,8 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.SearchService;
-import org.alfresco.service.cmr.security.AccessStatus;
+import org.alfresco.service.cmr.security.AccessStatus;
+import org.alfresco.service.cmr.security.NoSuchPersonException;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.site.SiteInfo;
@@ -470,7 +471,7 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
for (String mountPointName : imapConfigMountPoints.keySet())
{
result.addAll(listMailboxes(new AlfrescoImapUser(null, AuthenticationUtil
- .getAdminUserName(), null), mountPointName + "*", false));
+ .getSystemUserName(), null), mountPointName + "*", false));
}
return result;
@@ -1384,18 +1385,28 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
return userHome;
}
- private Set getUnsubscribedFolders(String userName)
- {
- Set result = new HashSet();
- PersonService personService = serviceRegistry.getPersonService();
- NodeRef userRef = personService.getPerson(userName);
- List unsubscribedFodlers = nodeService.getTargetAssocs(userRef, ImapModel.ASSOC_IMAP_UNSUBSCRIBED);
- for (AssociationRef asocRef : unsubscribedFodlers)
- {
- result.add(asocRef.getTargetRef());
- }
-
- return result;
+ private Set getUnsubscribedFolders(String userName)
+ {
+ Set result = new HashSet();
+ PersonService personService = serviceRegistry.getPersonService();
+
+ NodeRef userRef = null;
+
+ if (personService.personExists(userName))
+ {
+ userRef = personService.getPerson(userName);
+ }
+
+ if (userRef != null)
+ {
+ List unsubscribedFodlers = nodeService.getTargetAssocs(userRef, ImapModel.ASSOC_IMAP_UNSUBSCRIBED);
+ for (AssociationRef asocRef : unsubscribedFodlers)
+ {
+ result.add(asocRef.getTargetRef());
+ }
+ }
+
+ return result;
}
@@ -1411,7 +1422,9 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
* @return List of favourite sites.
*/
private List getFavouriteSites(final String userName)
- {
+ {
+ PersonService personService = serviceRegistry.getPersonService();
+
if (logger.isDebugEnabled())
{
logger.debug("[getFavouriteSites] entry for user: " + userName);
@@ -1430,49 +1443,50 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
}
if (favSites == null)
{
- favSites = new LinkedList();
-
- PreferenceService preferenceService = (PreferenceService) serviceRegistry
- .getService(ServiceRegistry.PREFERENCE_SERVICE);
- Map prefs = preferenceService.getPreferences(
- userName, AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES);
-
- for (String key : prefs.keySet())
- {
- Boolean isImapFavourite = (Boolean) prefs.get(key);
- if (isImapFavourite != null && isImapFavourite)
- {
- String siteName = key.substring(AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES.length() + 1); // count the dot
- boolean isMember = false;
- try
- {
- isMember = serviceRegistry.getSiteService().isMember(siteName, userName);
- }
- catch (SiteDoesNotExistException sdne)
- {
- // Ignore, see MNT-13579
- // The site might be archived. In this case it will still be in user's preferences.
- }
-
- if (isMember)
- {
- SiteInfo siteInfo = serviceRegistry.getSiteService().getSite(siteName);
- if (siteInfo != null)
- {
- if(logger.isDebugEnabled())
- {
- logger.debug("[getFavouriteSites] User: " + userName + " Favourite site: " + siteInfo.getShortName());
- }
- favSites.add(siteInfo.getNodeRef());
- }
- }
- }
+ favSites = new LinkedList();
+
+ if (personService.personExists(userName))
+ {
+ PreferenceService preferenceService = (PreferenceService) serviceRegistry.getService(ServiceRegistry.PREFERENCE_SERVICE);
+ Map prefs = preferenceService.getPreferences(userName, AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES);
+
+ for (String key : prefs.keySet())
+ {
+ Boolean isImapFavourite = (Boolean) prefs.get(key);
+ if (isImapFavourite != null && isImapFavourite)
+ {
+ String siteName = key.substring(AlfrescoImapConst.PREF_IMAP_FAVOURITE_SITES.length() + 1); // count the dot
+ boolean isMember = false;
+ try
+ {
+ isMember = serviceRegistry.getSiteService().isMember(siteName, userName);
+ }
+ catch (SiteDoesNotExistException sdne)
+ {
+ // Ignore, see MNT-13579
+ // The site might be archived. In this case it will still be in user's preferences.
+ }
+
+ if (isMember)
+ {
+ SiteInfo siteInfo = serviceRegistry.getSiteService().getSite(siteName);
+ if (siteInfo != null)
+ {
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("[getFavouriteSites] User: " + userName + " Favourite site: " + siteInfo.getShortName());
+ }
+ favSites.add(siteInfo.getNodeRef());
+ }
+ }
+ }
+ }
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("[getFavouriteSites] Bind new Favorite sites' list to transaction " + AlfrescoTransactionSupport.getTransactionId());
+ }
+ AlfrescoTransactionSupport.bindResource(FAVORITE_SITES, favSites);
}
- if (logger.isDebugEnabled())
- {
- logger.debug("[getFavouriteSites] Bind new Favorite sites' list to transaction " + AlfrescoTransactionSupport.getTransactionId());
- }
- AlfrescoTransactionSupport.bindResource(FAVORITE_SITES, favSites);
}
if (logger.isDebugEnabled())
{
diff --git a/src/main/java/org/alfresco/repo/security/authentication/HashPasswordTransactionListener.java b/src/main/java/org/alfresco/repo/security/authentication/HashPasswordTransactionListener.java
index fd0a0fed41..61514415b6 100644
--- a/src/main/java/org/alfresco/repo/security/authentication/HashPasswordTransactionListener.java
+++ b/src/main/java/org/alfresco/repo/security/authentication/HashPasswordTransactionListener.java
@@ -94,7 +94,7 @@ public class HashPasswordTransactionListener implements TransactionListener
public Void execute() throws Throwable
{
AuthenticationUtil.pushAuthentication();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
try
{
if (logger.isDebugEnabled())
diff --git a/src/main/java/org/alfresco/repo/security/person/PersonServiceImpl.java b/src/main/java/org/alfresco/repo/security/person/PersonServiceImpl.java
index 0c4a21bdc4..976ffff668 100644
--- a/src/main/java/org/alfresco/repo/security/person/PersonServiceImpl.java
+++ b/src/main/java/org/alfresco/repo/security/person/PersonServiceImpl.java
@@ -493,8 +493,9 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
{
return null;
}
- if (EqualsHelper.nullSafeEquals(userName, AuthenticationUtil.getSystemUserName()))
+ if (isSystemUserName(userName))
{
+ // The built-in authority SYSTEM is a user, but not a Person (i.e. it does not have a profile).
if (exceptionOrNull)
{
throw new NoSuchPersonException(userName);
@@ -532,12 +533,12 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
*/
public boolean personExists(String caseSensitiveUserName)
{
- if (isBuiltInAuthorities(caseSensitiveUserName))
+ if (isSystemUserName(caseSensitiveUserName))
{
- return true;
+ return false;
}
-
- NodeRef person = getPersonOrNullImpl(caseSensitiveUserName);
+
+ NodeRef person = getPersonOrNullImpl(caseSensitiveUserName);
if (person != null)
{
// re: THOR-293
@@ -545,21 +546,7 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
}
return false;
}
-
- private boolean isBuiltInAuthorities(String caseSensitiveUserName)
- {
- if (EqualsHelper.nullSafeEquals(caseSensitiveUserName, AuthenticationUtil.getSystemUserName()))
- {
- return true;
- }
- else if (EqualsHelper.nullSafeEquals(caseSensitiveUserName, AuthenticationUtil.getGuestUserName()))
- {
- return true;
- }
- return false;
-
- }
-
+
private NodeRef getPersonOrNullImpl(String searchUserName)
{
Set allRefs = getFromCache(searchUserName);
@@ -992,6 +979,11 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
{
throw new IllegalArgumentException("No username specified when creating the person.");
}
+
+ if (EqualsHelper.nullSafeEquals(userName, AuthenticationUtil.getSystemUserName()))
+ {
+ throw new AlfrescoRuntimeException("The built-in authority '" + AuthenticationUtil.getSystemUserName() + "' is a user, but not a Person (i.e. it does not have a profile).");
+ }
AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
if (authorityType != AuthorityType.USER)
@@ -2190,10 +2182,14 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
return true;
}
- public void setEventPublisher(EventPublisher eventPublisher)
- {
- this.eventPublisher = eventPublisher;
- }
-
-
+ public void setEventPublisher(EventPublisher eventPublisher)
+ {
+ this.eventPublisher = eventPublisher;
+ }
+
+ private boolean isSystemUserName(String userName)
+ {
+ return EqualsHelper.nullSafeEquals(userName, AuthenticationUtil.getSystemUserName(), true);
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/alfresco/repo/security/person/PersonServiceLoader.java b/src/main/java/org/alfresco/repo/security/person/PersonServiceLoader.java
index d91753b354..c8e0ff5400 100644
--- a/src/main/java/org/alfresco/repo/security/person/PersonServiceLoader.java
+++ b/src/main/java/org/alfresco/repo/security/person/PersonServiceLoader.java
@@ -117,7 +117,7 @@ public class PersonServiceLoader
// check the lazy creation
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
final ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
final AuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
diff --git a/src/test/java/org/alfresco/AppContext04TestSuite.java b/src/test/java/org/alfresco/AppContext04TestSuite.java
index f1685fa33a..8c077fb738 100644
--- a/src/test/java/org/alfresco/AppContext04TestSuite.java
+++ b/src/test/java/org/alfresco/AppContext04TestSuite.java
@@ -56,7 +56,6 @@ import org.junit.runners.Suite;
// This test opens, closes and again opens the alfresco application context.
org.alfresco.repo.dictionary.CustomModelRepoRestartTest.class,
- org.alfresco.repo.rendition.StandardRenditionLocationResolverTest.class,
org.alfresco.repo.rendition.executer.HTMLRenderingEngineTest.class,
org.alfresco.repo.rendition.executer.XSLTFunctionsTest.class,
org.alfresco.repo.rendition.executer.XSLTRenderingEngineTest.class,
diff --git a/src/test/java/org/alfresco/repo/action/ActionServiceImplTest.java b/src/test/java/org/alfresco/repo/action/ActionServiceImplTest.java
index 0040f5f12f..0d76dde851 100644
--- a/src/test/java/org/alfresco/repo/action/ActionServiceImplTest.java
+++ b/src/test/java/org/alfresco/repo/action/ActionServiceImplTest.java
@@ -811,31 +811,39 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
@Test
public void testActionResult()
{
+ // We need to run this test as Administrator. The ScriptAction has to run as a full user (instead of as System)
+ // so that we can setup the Person object in the ScriptNode
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ try
+ {
+ // Create the script node reference
+ NodeRef script = this.nodeService.createNode(
+ this.folder,
+ ContentModel.ASSOC_CONTAINS,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
+ ContentModel.TYPE_CONTENT).getChildRef();
+ this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
+ ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
+ contentWriter.setMimetype("text/plain");
+ contentWriter.setEncoding("UTF-8");
+ contentWriter.putContent("\"VALUE\";");
- // Create the script node reference
- NodeRef script = this.nodeService.createNode(
- this.folder,
- ContentModel.ASSOC_CONTAINS,
- QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
- ContentModel.TYPE_CONTENT).getChildRef();
- this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
- ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
- contentWriter.setMimetype("text/plain");
- contentWriter.setEncoding("UTF-8");
- contentWriter.putContent("\"VALUE\";");
-
- // Create the action
- Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
- action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
-
- // Execute the action
- this.actionService.executeAction(action1, this.nodeRef);
-
- // Get the result
- String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
- assertNotNull(result);
- assertEquals("VALUE", result);
+ // Create the action
+ Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
+ action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
+
+ // Execute the action
+ this.actionService.executeAction(action1, this.nodeRef);
+
+ // Get the result
+ String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
+ assertNotNull(result);
+ assertEquals("VALUE", result);
+ }
+ finally
+ {
+ AuthenticationUtil.clearCurrentSecurityContext();
+ }
}
/** ===================================================================================
diff --git a/src/test/java/org/alfresco/repo/action/executer/SpecialiseTypeActionExecuterTest.java b/src/test/java/org/alfresco/repo/action/executer/SpecialiseTypeActionExecuterTest.java
index 2181604958..97db746f7f 100644
--- a/src/test/java/org/alfresco/repo/action/executer/SpecialiseTypeActionExecuterTest.java
+++ b/src/test/java/org/alfresco/repo/action/executer/SpecialiseTypeActionExecuterTest.java
@@ -104,9 +104,9 @@ public class SpecialiseTypeActionExecuterTest extends BaseAlfrescoSpringTest
checkActionAgainAndExpectTypeToChange(action, nodeRef1);
}
- // check with "Admin user"
+ // check with "System user"
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Check the type of the node
ActionImpl action = checkActionToChangeNodeType(nodeRef2);
diff --git a/src/test/java/org/alfresco/repo/activities/feed/cleanup/AbstractFeedCleanerTest.java b/src/test/java/org/alfresco/repo/activities/feed/cleanup/AbstractFeedCleanerTest.java
index 983dbec1b3..2a32d98cfa 100644
--- a/src/test/java/org/alfresco/repo/activities/feed/cleanup/AbstractFeedCleanerTest.java
+++ b/src/test/java/org/alfresco/repo/activities/feed/cleanup/AbstractFeedCleanerTest.java
@@ -622,7 +622,7 @@ public abstract class AbstractFeedCleanerTest
if (type == 2)
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
int deleteCount = transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback()
{
diff --git a/src/test/java/org/alfresco/repo/audit/AuditMethodInterceptorTest.java b/src/test/java/org/alfresco/repo/audit/AuditMethodInterceptorTest.java
index 125c58b79e..a7aa664b14 100644
--- a/src/test/java/org/alfresco/repo/audit/AuditMethodInterceptorTest.java
+++ b/src/test/java/org/alfresco/repo/audit/AuditMethodInterceptorTest.java
@@ -99,7 +99,7 @@ public class AuditMethodInterceptorTest extends TestCase
nodeService = serviceRegistry.getNodeService();
searchService = serviceRegistry.getSearchService();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
nodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
// Register the models
diff --git a/src/test/java/org/alfresco/repo/audit/AuditableAspectTest.java b/src/test/java/org/alfresco/repo/audit/AuditableAspectTest.java
index e5277975b0..a73bd51776 100644
--- a/src/test/java/org/alfresco/repo/audit/AuditableAspectTest.java
+++ b/src/test/java/org/alfresco/repo/audit/AuditableAspectTest.java
@@ -281,7 +281,7 @@ public class AuditableAspectTest extends TestCase
String modifiedBy = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIER);
assertEquals(
"The modifier should have changed to reflect the current user",
- AuthenticationUtil.getFullyAuthenticatedUser(), modifiedBy);
+ AuthenticationUtil.getRunAsUser(), modifiedBy);
RetryingTransactionCallback setAuditableCallback1 = new RetryingTransactionCallback()
{
diff --git a/src/test/java/org/alfresco/repo/content/GuessMimetypeTest.java b/src/test/java/org/alfresco/repo/content/GuessMimetypeTest.java
index b2e18b6cd5..1d78b8fd91 100644
--- a/src/test/java/org/alfresco/repo/content/GuessMimetypeTest.java
+++ b/src/test/java/org/alfresco/repo/content/GuessMimetypeTest.java
@@ -77,7 +77,7 @@ public class GuessMimetypeTest extends TestCase
public Object execute() throws Throwable
{
// As system user
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
storeRef = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
@@ -97,7 +97,7 @@ public class GuessMimetypeTest extends TestCase
@Override
public Object execute() throws Throwable
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
Map properties = new HashMap(13);
properties.put(ContentModel.PROP_NAME, (Serializable) "test.txt");
@@ -121,7 +121,7 @@ public class GuessMimetypeTest extends TestCase
@Override
public Object execute() throws Throwable
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
Map properties = new HashMap(13);
properties.put(ContentModel.PROP_NAME, (Serializable) "test.txt");
diff --git a/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java
index c37c3ee68a..3c2d1b5440 100644
--- a/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java
+++ b/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java
@@ -219,7 +219,7 @@ public class ArchiveContentTransformerTest extends AbstractContentTransformerTes
return;
}
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
ContentTransformer transformer = serviceRegistry.getContentService().getTransformer(sourceMimetype, targetMimetype);
assertNotNull(transformer);
diff --git a/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java
index e9a4070294..d0161da515 100644
--- a/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java
+++ b/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java
@@ -135,7 +135,7 @@ public class EMLTransformerTest extends AbstractContentTransformerTest
return;
}
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
ContentTransformer transformer = serviceRegistry.getContentService().getTransformer(sourceMimetype, targetMimetype);
assertNotNull(transformer);
diff --git a/src/test/java/org/alfresco/repo/dictionary/DictionaryModelTypeTest.java b/src/test/java/org/alfresco/repo/dictionary/DictionaryModelTypeTest.java
index 502349b86c..6f3cfe0b3e 100644
--- a/src/test/java/org/alfresco/repo/dictionary/DictionaryModelTypeTest.java
+++ b/src/test/java/org/alfresco/repo/dictionary/DictionaryModelTypeTest.java
@@ -457,8 +457,8 @@ public class DictionaryModelTypeTest extends BaseSpringTest
@Test
public void testCreateAndUpdateDictionaryModelNodeContent() throws Exception
{
- // just to make sure we don't regress ACE-5852, some tests should run as Admin
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ // just to make sure we don't regress ACE-5852, some tests should run as System
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
try
{
// Check that the model has not yet been loaded into the dictionary
@@ -609,8 +609,8 @@ public class DictionaryModelTypeTest extends BaseSpringTest
@Test
public void testUpdateDictionaryModelPropertyDelete() throws Exception
{
- // just to make sure we don't regress ACE-5852, some tests should run as Admin
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ // just to make sure we don't regress ACE-5852, some tests should run as System
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
try
{
// Check that the model has not yet been loaded into the dictionary
@@ -1105,7 +1105,7 @@ public class DictionaryModelTypeTest extends BaseSpringTest
public void testImportingSameNamespaceFails() throws Exception
{
// just to make sure we don't regress ACE-5852, some tests should run as System
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Create model
final NodeRef modelNode = createActiveModel("dictionary/testModel.xml");
diff --git a/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java b/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java
index 283e05f01a..114f401eca 100644
--- a/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java
+++ b/src/test/java/org/alfresco/repo/domain/permissions/FixedAclUpdaterTest.java
@@ -86,7 +86,7 @@ public class FixedAclUpdaterTest extends TestCase
permissionService = (PermissionService) ctx.getBean("permissionService");
nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
NodeRef home = repository.getCompanyHome();
// create a folder hierarchy for which will change permission inheritance
@@ -319,7 +319,7 @@ public class FixedAclUpdaterTest extends TestCase
final FixedAclUpdater fixedAclUpdater = (FixedAclUpdater) ctx.getBean("fixedAclUpdater");
final PermissionsDaoComponent permissionsDaoComponent = (PermissionsDaoComponent) ctx.getBean("admPermissionsDaoComponent");
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
NodeRef home = repository.getCompanyHome();
final NodeRef root = createFile(fileFolderService, home, "ROOT", ContentModel.TYPE_FOLDER);
diff --git a/src/test/java/org/alfresco/repo/i18n/MessageServiceImplTest.java b/src/test/java/org/alfresco/repo/i18n/MessageServiceImplTest.java
index 28e36e72d4..67e28c4227 100644
--- a/src/test/java/org/alfresco/repo/i18n/MessageServiceImplTest.java
+++ b/src/test/java/org/alfresco/repo/i18n/MessageServiceImplTest.java
@@ -154,7 +154,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
private void setupRepo() throws Exception
{
AuthenticationUtil.clearCurrentSecurityContext();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Create a test workspace
this.testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
diff --git a/src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java b/src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java
index 02576e3b06..341e78837d 100644
--- a/src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java
+++ b/src/test/java/org/alfresco/repo/imap/ImapServiceImplTest.java
@@ -136,7 +136,8 @@ public class ImapServiceImplTest extends TestCase
private ContentService contentService;
private NodeRef testImapFolderNodeRef;
- private Flags flags;
+ private Flags flags;
+ private ImapServiceImpl imapServiceImpl;
String anotherUserName;
@@ -170,29 +171,29 @@ public class ImapServiceImplTest extends TestCase
authenticationService.authenticate(USER_NAME, USER_PASSWORD.toCharArray());
// downgrade integrity
- IntegrityChecker.setWarnInTransaction();
-
- anotherUserName = "user" + System.currentTimeMillis();
-
- PropertyMap testUser = new PropertyMap();
- testUser.put(ContentModel.PROP_USERNAME, anotherUserName);
- testUser.put(ContentModel.PROP_FIRSTNAME, anotherUserName);
- testUser.put(ContentModel.PROP_LASTNAME, anotherUserName);
- testUser.put(ContentModel.PROP_EMAIL, anotherUserName + "@alfresco.com");
- testUser.put(ContentModel.PROP_JOBTITLE, "jobTitle");
-
- personService.createPerson(testUser);
-
- // create the ACEGI Authentication instance for the new user
- authenticationService.createAuthentication(anotherUserName, anotherUserName.toCharArray());
-
+ IntegrityChecker.setWarnInTransaction();
+
+ anotherUserName = "user" + System.currentTimeMillis();
+
+ PropertyMap testUser = new PropertyMap();
+ testUser.put(ContentModel.PROP_USERNAME, anotherUserName);
+ testUser.put(ContentModel.PROP_FIRSTNAME, anotherUserName);
+ testUser.put(ContentModel.PROP_LASTNAME, anotherUserName);
+ testUser.put(ContentModel.PROP_EMAIL, anotherUserName + "@alfresco.com");
+ testUser.put(ContentModel.PROP_JOBTITLE, "jobTitle");
+
+ personService.createPerson(testUser);
+
+ // create the ACEGI Authentication instance for the new user
+ authenticationService.createAuthentication(anotherUserName, anotherUserName.toCharArray());
+
user = new AlfrescoImapUser(anotherUserName + "@alfresco.com", anotherUserName, anotherUserName);
NodeRef companyHomeNodeRef = findCompanyHomeNodeRef();
ChildApplicationContextFactory imap = (ChildApplicationContextFactory) ctx.getBean("imap");
ApplicationContext imapCtx = imap.getApplicationContext();
- ImapServiceImpl imapServiceImpl = (ImapServiceImpl)imapCtx.getBean("imapService");
+ imapServiceImpl = (ImapServiceImpl)imapCtx.getBean("imapService");
// Creating IMAP test folder for IMAP root
LinkedList folders = new LinkedList();
@@ -307,7 +308,7 @@ public class ImapServiceImplTest extends TestCase
}
public void testListMailbox() throws Exception
- {
+ {
imapService.getOrCreateMailbox(user, MAILBOX_NAME_A, false, true);
imapService.getOrCreateMailbox(user, MAILBOX_NAME_B, false, true);
List mf = imapService.listMailboxes(user, MAILBOX_PATTERN, false);
@@ -1004,8 +1005,14 @@ public class ImapServiceImplTest extends TestCase
assertEquals("The parent should change to destination.", destinationNode.getNodeRef(), copiedParentNodeRef);
assertEquals("There should be only one node in the destination folder", 1, nodeService.getChildAssocs(destinationNode.getNodeRef()).size());
assertTrue("New node should have original node aspects", nodeService.hasAspect(copiedNode.getNodeRef(), ContentModel.ASPECT_TAGGABLE));
- }
-
+ }
+
+ public void testListMailboxOnStartup()
+ {
+ authenticationService.clearCurrentSecurityContext();
+ // Starting IMAP
+ imapServiceImpl.startupInTxn(true);
+ }
/**
* @param mailbox - {@link AlfrescoImapFolder} instance which should be checked
diff --git a/src/test/java/org/alfresco/repo/importer/ImporterComponentTest.java b/src/test/java/org/alfresco/repo/importer/ImporterComponentTest.java
index b424dbc4cb..e4f15ac3ba 100644
--- a/src/test/java/org/alfresco/repo/importer/ImporterComponentTest.java
+++ b/src/test/java/org/alfresco/repo/importer/ImporterComponentTest.java
@@ -84,7 +84,7 @@ public class ImporterComponentTest extends BaseSpringTest
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
- this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
+ this.authenticationComponent.setSystemUserAsCurrentUser();
this.versionService = (VersionService)this.applicationContext.getBean("VersionService");
@@ -162,9 +162,9 @@ public class ImporterComponentTest extends BaseSpringTest
// Check that the cm:auditable properties are correct
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-04-30T23:00:00.000Z")), createdDate);
assertEquals("cm:creator not preserved during import", "Import Creator", creator);
- assertEquals("cm:modifier not preserved during import", AuthenticationUtil.getFullyAuthenticatedUser(), modifier);
+ assertEquals("cm:modifier not preserved during import", AuthenticationUtil.getSystemUserName(), modifier);
}
-
+
@Test
public void testImportWithVersioning() throws Exception
{
diff --git a/src/test/java/org/alfresco/repo/jscript/ScriptNodeTest.java b/src/test/java/org/alfresco/repo/jscript/ScriptNodeTest.java
index 3dbb173663..81a9b673a4 100644
--- a/src/test/java/org/alfresco/repo/jscript/ScriptNodeTest.java
+++ b/src/test/java/org/alfresco/repo/jscript/ScriptNodeTest.java
@@ -200,7 +200,7 @@ public class ScriptNodeTest
@Before public void createTestContent()
{
excludedOnUpdateProps = VERSIONABLE_ASPECT.getExcludedOnUpdateProps();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Create the store and get the root node
storeRef = NODE_SERVICE.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
rootNodeRef = NODE_SERVICE.getRootNode(storeRef);
diff --git a/src/test/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java b/src/test/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java
index c721158b70..9c3cdae730 100644
--- a/src/test/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java
+++ b/src/test/java/org/alfresco/repo/model/filefolder/FileFolderPerformanceTester.java
@@ -624,7 +624,7 @@ public class FileFolderPerformanceTester extends TestCase
NodeRef folderNodeRef = null;
try
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
if (selectedFolderNodeRef == null)
{
// find the guest folder
diff --git a/src/test/java/org/alfresco/repo/node/db/DbNodeServiceImplPropagationTest.java b/src/test/java/org/alfresco/repo/node/db/DbNodeServiceImplPropagationTest.java
index d4a6dc870e..7835a5ba36 100644
--- a/src/test/java/org/alfresco/repo/node/db/DbNodeServiceImplPropagationTest.java
+++ b/src/test/java/org/alfresco/repo/node/db/DbNodeServiceImplPropagationTest.java
@@ -86,7 +86,7 @@ public class DbNodeServiceImplPropagationTest extends BaseSpringTest
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
- authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
+ authenticationComponent.setSystemUserAsCurrentUser();
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
diff --git a/src/test/java/org/alfresco/repo/notification/NotificationServiceImplSystemTest.java b/src/test/java/org/alfresco/repo/notification/NotificationServiceImplSystemTest.java
index 446486ccb5..ec46b173ca 100644
--- a/src/test/java/org/alfresco/repo/notification/NotificationServiceImplSystemTest.java
+++ b/src/test/java/org/alfresco/repo/notification/NotificationServiceImplSystemTest.java
@@ -126,7 +126,7 @@ public class NotificationServiceImplSystemTest extends BaseAlfrescoTestCase
public Void execute() throws Throwable
{
// As system user
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Create people and users
fromPerson = createPerson(FROM_USER, PASSWORD, FROM_FIRST_NAME, FROM_LAST_NAME, FROM_EMAIL);
@@ -157,7 +157,7 @@ public class NotificationServiceImplSystemTest extends BaseAlfrescoTestCase
public Void execute() throws Throwable
{
// As system user
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
// Delete the template
nodeService.deleteNode(template);
diff --git a/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java b/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java
index b11561c863..b4993312cb 100644
--- a/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java
+++ b/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java
@@ -32,6 +32,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.model.Repository;
import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.rendition.RenditionDefinition;
@@ -121,6 +122,10 @@ public class XSLTRenderingEngineTest extends BaseAlfrescoSpringTest
@Test
public void testSimplestTemplateWithTargetPath() throws Exception
{
+ // We need to run this test as Administrator. The ScriptAction has to run as a full user (instead of as System)
+ // so that we can setup the Person object in the ScriptNode
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+
try
{
FileInfo file = createXmlFile(companyHome);
@@ -147,6 +152,11 @@ public class XSLTRenderingEngineTest extends BaseAlfrescoSpringTest
log.error("Error!", ex);
fail();
}
+ finally
+ {
+ AuthenticationUtil.clearCurrentSecurityContext();
+ }
+
}
diff --git a/src/test/java/org/alfresco/repo/security/authentication/AuthenticationTest.java b/src/test/java/org/alfresco/repo/security/authentication/AuthenticationTest.java
index 4c85fc118e..d082dbf09b 100644
--- a/src/test/java/org/alfresco/repo/security/authentication/AuthenticationTest.java
+++ b/src/test/java/org/alfresco/repo/security/authentication/AuthenticationTest.java
@@ -194,7 +194,7 @@ public class AuthenticationTest extends TestCase
@Override
public Void execute() throws Throwable
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
try
{
deleteAndy();
@@ -224,7 +224,7 @@ public class AuthenticationTest extends TestCase
personAndyNodeRef = nodeService.createNode(typesNodeRef, children, ContentModel.TYPE_PERSON, container, props).getChildRef();
assertNotNull(personAndyNodeRef);
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
authenticationComponent.clearCurrentSecurityContext();
}
diff --git a/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java b/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java
index 86803a3435..a9f033750e 100644
--- a/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java
+++ b/src/test/java/org/alfresco/repo/security/authentication/ResetPasswordServiceImplTest.java
@@ -78,7 +78,7 @@ public class ResetPasswordServiceImplTest
public static final ApplicationContextInit APP_CONTEXT_INIT = new ApplicationContextInit();
@Rule
- public final RunAsFullyAuthenticatedRule runAsRule = new RunAsFullyAuthenticatedRule(AuthenticationUtil.getAdminUserName());
+ public final RunAsFullyAuthenticatedRule runAsRule = new RunAsFullyAuthenticatedRule(AuthenticationUtil.getSystemUserName());
private static final String DEFAULT_SENDER = "noreply@test-alfresco.test";
@@ -161,7 +161,7 @@ public class ResetPasswordServiceImplTest
// Make sure to run as system
AuthenticationUtil.clearCurrentSecurityContext();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setRunAsUserSystem();
// Request password reset
resetPasswordService.requestReset(testPerson.userName, "share");
diff --git a/src/test/java/org/alfresco/repo/security/authentication/UpgradePasswordHashTest.java b/src/test/java/org/alfresco/repo/security/authentication/UpgradePasswordHashTest.java
index ae2b86583e..78b23529c5 100644
--- a/src/test/java/org/alfresco/repo/security/authentication/UpgradePasswordHashTest.java
+++ b/src/test/java/org/alfresco/repo/security/authentication/UpgradePasswordHashTest.java
@@ -107,7 +107,7 @@ public class UpgradePasswordHashTest extends TestCase
upgradePasswordHashWorker = (UpgradePasswordHashWorker)ctx.getBean("upgradePasswordHashWorker");
nodeService = serviceRegistry.getNodeService();
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
}
protected void createTestUsers(String encoding) throws Exception
diff --git a/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java b/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java
index 44816d6200..8040815c2d 100644
--- a/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java
+++ b/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java
@@ -91,7 +91,7 @@ public class SubscriptionServiceImplTest extends TestCase
searchService = (SearchService) ctx.getBean("SearchService");
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
txn = transactionService.getNonPropagatingUserTransaction(false);
txn.begin();
diff --git a/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java b/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java
index fa30ec25b4..1c7cc0dfbb 100644
--- a/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java
+++ b/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java
@@ -887,7 +887,7 @@ public class MultiTDemoTest extends TestCase
}
finally
{
- AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
+ AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
deleteTenant(tenantDomain1);
deleteTenant(tenantDomain2);
diff --git a/src/test/java/org/alfresco/repo/transaction/ConnectionPoolOverloadTest.java b/src/test/java/org/alfresco/repo/transaction/ConnectionPoolOverloadTest.java
index c1ff3f3a69..b27eca8b6e 100644
--- a/src/test/java/org/alfresco/repo/transaction/ConnectionPoolOverloadTest.java
+++ b/src/test/java/org/alfresco/repo/transaction/ConnectionPoolOverloadTest.java
@@ -41,6 +41,7 @@ import org.apache.commons.lang.mutable.MutableInt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
diff --git a/src/test/java/org/alfresco/repo/workflow/StartWorkflowActionExecuterTest.java b/src/test/java/org/alfresco/repo/workflow/StartWorkflowActionExecuterTest.java
index 424ae452da..095ff907b6 100644
--- a/src/test/java/org/alfresco/repo/workflow/StartWorkflowActionExecuterTest.java
+++ b/src/test/java/org/alfresco/repo/workflow/StartWorkflowActionExecuterTest.java
@@ -69,7 +69,7 @@ public class StartWorkflowActionExecuterTest extends BaseSpringTest
this.personService = (PersonService)this.applicationContext.getBean("personService");
AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
- authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
+ authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
// Create the store and get the root node
rootNodeRef = nodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
diff --git a/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTimerExecutionTest.java b/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTimerExecutionTest.java
index fd0f1f7f2c..5f4701079b 100644
--- a/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTimerExecutionTest.java
+++ b/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiTimerExecutionTest.java
@@ -264,6 +264,8 @@ public class ActivitiTimerExecutionTest extends BaseSpringTest
PersonService personService = registry.getPersonService();
this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
+
+ authenticationComponent.setSystemUserAsCurrentUser();
}
private void waitForTimersToBeExecuted(String workflowInstanceId) throws Exception
diff --git a/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java b/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java
index 0922b10bb0..de77392398 100644
--- a/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java
+++ b/src/test/java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java
@@ -178,7 +178,7 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
@Test
public void testReviewAndPooledNotModifiedDate()
{
- this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
+ authenticationComponent.setSystemUserAsCurrentUser();
Map props = new HashMap();
props.put(ContentModel.PROP_NAME, "MNT-11522-testfile.txt");
diff --git a/src/test/java/org/alfresco/util/BaseAlfrescoSpringTest.java b/src/test/java/org/alfresco/util/BaseAlfrescoSpringTest.java
index 49511aaf6d..bce77f36ed 100644
--- a/src/test/java/org/alfresco/util/BaseAlfrescoSpringTest.java
+++ b/src/test/java/org/alfresco/util/BaseAlfrescoSpringTest.java
@@ -31,7 +31,6 @@ import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
-import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentService;
@@ -94,7 +93,7 @@ public abstract class BaseAlfrescoSpringTest extends BaseSpringTest
// Authenticate as the system user
authenticationComponent = (AuthenticationComponent) this.applicationContext
.getBean("authenticationComponent");
- this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
+ authenticationComponent.setSystemUserAsCurrentUser();
// Create the store and get the root node
this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());