Merge branch 'master' of https://git.alfresco.com/records-management/records-management into feature/RM-6914_AddRemoveToHold_Tests

This commit is contained in:
Rodica Sutu
2019-08-21 14:43:43 +03:00
2 changed files with 38 additions and 0 deletions

View File

@@ -591,6 +591,8 @@ public class HoldServiceImpl extends ServiceBaseImpl
addFrozenAspect(nodeRef, props);
// Link the record to the hold
//set in transaction cache in order not to trigger update policy when adding the association
transactionalResourceHelper.getSet("frozen").add(nodeRef);
nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS);
// audit item being added to the hold

View File

@@ -245,4 +245,40 @@ public class AddActiveContentToHoldTest extends BaseRMTestCase
}
});
}
/**
* Given active content on hold
* When I try to add content to another hold
* And I have file permission on the other hold
* And I have the appropriate capability to add to hold
* Then the active content is contained within both holds
* And the active content remains frozen
*/
public void testAddDocumentToAnotherHold()
{
doBehaviourDrivenTest(new BehaviourDrivenTest()
{
private NodeRef hold;
private NodeRef hold2;
public void given()
{
hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate());
hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate());
holdService.addToHold(hold, dmDocument);
}
public void when()
{
holdService.addToHold(hold2, dmDocument);
}
public void then()
{
assertTrue(freezeService.isFrozen(dmDocument));
assertTrue(holdService.heldBy(dmDocument, true).contains(hold));
assertTrue(holdService.heldBy(dmDocument, true).contains(hold2));
}
});
}
}