Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)

124935 arebegea: 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.2.N/root@125036 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Cristian Turlica
2016-04-08 14:39:34 +00:00
parent 2fec403f87
commit fa37265633

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);