From 7d30c1e9b0f0874ef30dca028d4a756770b46d97 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Mon, 22 Aug 2016 08:43:30 +0100 Subject: [PATCH] RM-3074: Test group reuse --- .../record/InplaceRecordPermissionTest.java | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java index 0d3c3ffa93..c5156e3224 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/InplaceRecordPermissionTest.java @@ -255,7 +255,14 @@ public class InplaceRecordPermissionTest extends BaseRMTestCase } /** - * + * Given that a document is created by contributor + * When it is declared as an inplace record + * Then it becomes a record + * And it isn't filed + * And a site collaborator has filling permissions and filling capability on the record + * And a site contributor has filling capability and permissions + * And a site consumer has read permissions and view record capability on the record + * And a user that is not a member of the site has no access to the inplace record */ public void testCreateInplaceRecordFromCollabSiteWhenContribIsCreatorOfDocument() { @@ -762,4 +769,54 @@ public class InplaceRecordPermissionTest extends BaseRMTestCase AccessStatus.DENIED)); // edit record metadata capability ; } + + /** + * Test group reuse + */ + public void testGroupReuse() + { + test() + .when() + .as(dmCollaborator) + .perform(() -> + { + for (int i = 0; i < 50; i++) + { + NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + recordService.createRecord(filePlan, newDocument); + } + }) + .as(dmContributor) + .perform(() -> + { + for (int i = 0; i < 50; i++) + { + NodeRef newDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); + recordService.createRecord(filePlan, newDocument); + } + }) + .then() + .asAdmin() + .expect(101) + .from(() -> nodeService.getChildAssocs(dmFolder).size()) + .because("One hundred inplace records have been created.") + .expect(3) + .from(() -> authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true).size()) + .because("The read and write groups are reused."); + ; + } + + /** + * Test tear down + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // clear up groups + authorityService.getContainedAuthorities(null, "GROUP_INPLACE_RECORD_MANAGEMENT", true) + .stream() + .forEach((group) -> authorityService.deleteAuthority(group)); + } }