Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

78500: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      76815: Merged V4.2.3 (4.2.3) to V4.2-BUG-FIX (4.2.4)
         76612: Merged DEV to V4.2.3 (4.2.3)
            73832: MNT-11695 : Site cannot be deleted if copy/move outbound rule exists
            Added a test to simulate the issue.
            73871: MNT-11695 : Site cannot be deleted if copy/move outbound rule exists
            Added a check for the destination not to be in a pending delete list for copy action executer.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@82572 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Erik Winlof
2014-09-03 12:20:30 +00:00
parent ddef482f7e
commit e35970c3f1
2 changed files with 73 additions and 8 deletions

View File

@@ -1236,4 +1236,58 @@ public class RuleServiceImplTest extends BaseRuleTest
((RuntimeRuleService) ruleService).executePendingRules();
assertTrue("Pending rule was not executed", this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE));
}
/**
* Test for MNT-11695
*/
public void testOutBoundRuleTriggerForPendingDelete() throws Exception
{
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
// Create 1 folder with 2 folders inside
NodeRef parentFolderNodeRef = this.nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("parentnode" + GUID.generate()),
ContentModel.TYPE_FOLDER).getChildRef();
NodeRef folder1NodeRef = this.nodeService.createNode(parentFolderNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("parentnode" + GUID.generate()),
ContentModel.TYPE_FOLDER).getChildRef();
NodeRef folder2NodeRef = this.nodeService.createNode(parentFolderNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("parentnode" + GUID.generate()),
ContentModel.TYPE_FOLDER).getChildRef();
// Create rule for folder1
Rule testRule = new Rule();
testRule.setRuleTypes(Collections.singletonList(RuleType.OUTBOUND));
testRule.setTitle("RuleServiceTest" + GUID.generate());
testRule.setDescription(DESCRIPTION);
testRule.applyToChildren(true);
Action action = this.actionService.createAction(CopyActionExecuter.NAME);
action.setParameterValue(CopyActionExecuter.PARAM_DESTINATION_FOLDER, folder2NodeRef);
testRule.setAction(action);
this.ruleService.saveRule(folder1NodeRef, testRule);
assertNotNull("Rule was not saved", testRule.getNodeRef());
QName actionedQName = QName.createQName("actioneduponnode" + GUID.generate());
// New node
NodeRef actionedUponNodeRef = this.nodeService.createNode(folder1NodeRef, ContentModel.ASSOC_CHILDREN, actionedQName, ContentModel.TYPE_CONTENT).getChildRef();
ContentWriter writer = this.contentService.getWriter(actionedUponNodeRef, ContentModel.PROP_CONTENT, true);
writer.setMimetype("text/plain");
writer.putContent("TestContent");
txn.commit();
// Remove the parent folder
txn = transactionService.getUserTransaction();
txn.begin();
try
{
nodeService.deleteNode(parentFolderNodeRef);
}
catch (Exception e)
{
fail("The nodes should be deleted without errors, but exception was thrown: " + e);
}
txn.commit();
txn = transactionService.getUserTransaction();
txn.begin();
assertFalse("The folder should be deleted.", nodeService.exists(parentFolderNodeRef));
txn.commit();
}
}