From 78b31a0e89ce61e6c65ba670b0cd734ace277a01 Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Wed, 22 Apr 2015 08:42:38 +0000 Subject: [PATCH] RM-2072 (Concurrency exceptions and deadlocks on Records Management "File to" rule) * Fixed the failing test git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.2.1.x@102279 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../test/legacy/action/FileToActionTest.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java index bd43983a70..cadc97243c 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/FileToActionTest.java @@ -203,26 +203,39 @@ public class FileToActionTest extends BaseRMTestCase private void createRecord(final String path, final String name, final String resolvedPath) { + final String[] pathValues = StringUtils.tokenizeToStringArray(resolvedPath, "/"); + + // set parameters + Map params = new HashMap(1); + params.put(FileToAction.PARAM_PATH, path); + params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); + doTestInTransaction(new Test() { public Void run() throws Exception { - String[] pathValues = StringUtils.tokenizeToStringArray(resolvedPath, "/"); - // show the folder doesn't exist to begin with FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); - //assertNull(createdRecordFolder); + assertNull(createdRecordFolder); // set parameters Map params = new HashMap(1); params.put(FileToAction.PARAM_PATH, path); params.put(FileToAction.PARAM_CREATE_RECORD_PATH, true); - // execute file-to action - rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + return null; + } + }, ADMIN_USER); + // execute file-to action + rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params); + + doTestInTransaction(new Test() + { + public Void run() throws Exception + { // show the folder has now been created - createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); + FileInfo createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList(Arrays.asList(pathValues)), false); assertNotNull(createdRecordFolder); assertEquals(name, createdRecordFolder.getName()); NodeRef createdRecordFolderNodeRef = createdRecordFolder.getNodeRef();