Merged 5.0.N (5.0.4) to 5.1.N (5.1.2)

124871 cturlica: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4)
      124788 adavis: Merged V4.2.6 (4.2.6) to V4.2-BUG-FIX (4.2.7)
         124676 arebegea: MNT-15844 : CheckOutCheckInServiceImplTest.testCheckOutPermissions_ALF7680_ALF535 fails on SQL Server
            - fix the tests by doing the initialization of the test data in a new retrying transaction


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@124935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrei Rebegea
2016-04-06 14:49:49 +00:00
parent 5ecce2629c
commit 7dd9c0636b

View File

@@ -93,7 +93,7 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
private CopyService copyService;
private PersonService personService;
private FileFolderService fileFolderService;
private AuthenticationComponent authenticationComponent;
/**
* Data used by the tests
*/
@@ -144,9 +144,28 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
this.nodeService = serviceRegistry.getNodeService();
// Authenticate as system to create initial test data set
AuthenticationComponent authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser();
RetryingTransactionCallback<Void> processInitWork = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
initTestData();
return null;
}
};
// do the init test data in a new retrying transaction because
// there may be problems with the DB that needs to be retried;
// That is how Alfresco works, it relies on optimistic locking and retries
transactionService.getRetryingTransactionHelper().doInTransaction(processInitWork, false, true);
}
private void initTestData()
{
authenticationComponent.setSystemUserAsCurrentUser();
// Create the store and get the root node reference
this.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
this.rootNodeRef = nodeService.getRootNode(storeRef);