From 4972870392c9750cdf8847f6ee618b5479fd71de Mon Sep 17 00:00:00 2001 From: David Caruana Date: Mon, 13 Feb 2006 13:51:04 +0000 Subject: [PATCH] Fix CheckoutCheckIn tests - failed due to un-authenticated creation of test data. This used to work as rule triggers are no longer executed as the system user. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2357 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/repo/coci/CheckOutCheckInServiceImplTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java index d4d0500411..2c932b6b79 100644 --- a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java +++ b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java @@ -22,6 +22,7 @@ import java.util.Map; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.repo.transaction.TransactionUtil; import org.alfresco.repo.version.VersionModel; import org.alfresco.service.cmr.coci.CheckOutCheckInService; @@ -107,7 +108,10 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest this.lockService = (LockService)this.applicationContext.getBean("lockService"); this.transactionService = (TransactionService)this.applicationContext.getBean("transactionComponent"); this.permissionService = (PermissionService)this.applicationContext.getBean("permissionService"); - authenticationService.clearCurrentSecurityContext(); + + // Authenticate as system to create initial test data set + AuthenticationComponent authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent"); + authenticationComponent.setSystemUserAsCurrentUser(); // Create the store and get the root node reference this.storeRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); @@ -142,7 +146,6 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest permissionService.setPermission(this.rootNodeRef, this.userName.toLowerCase(), PermissionService.ALL_PERMISSIONS, true); permissionService.setPermission(this.nodeRef, this.userName.toLowerCase(), PermissionService.ALL_PERMISSIONS, true); - } /**