use of org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork in project records-management by Alfresco.
the class RM978Test method testCopyDocumentInFolderInRmSite.
public void testCopyDocumentInFolderInRmSite() {
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) {
private NodeRef folder1;
private NodeRef document1;
private String document1Name = GUID.generate();
private NodeRef rmCategory;
private NodeRef rmFolder;
public void given() {
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
runAs(new RunAsWork<Void>() {
public Void doWork() throws Exception {
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
return null;
}
}, getAdminUserName());
}
public void when() throws FileExistsException, FileNotFoundException {
runAs(new RunAsWork<Void>() {
public Void doWork() throws Exception {
filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING);
return null;
}
}, getAdminUserName());
fileFolderService.copy(document1, rmFolder, null);
}
});
}
use of org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork in project records-management by Alfresco.
the class RM978Test method testMoveFolderInFolderInRmSite.
public void testMoveFolderInFolderInRmSite() {
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) {
private NodeRef folder1;
private NodeRef rmCategory;
private NodeRef rmFolder;
public void given() {
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
runAs(new RunAsWork<Void>() {
public Void doWork() throws Exception {
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
return null;
}
}, getAdminUserName());
}
public void when() throws FileExistsException, FileNotFoundException {
fileFolderService.move(folder1, rmFolder, GUID.generate());
}
});
}
use of org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork in project records-management by Alfresco.
the class RM978Test method testMoveDocumentInFolderInRmSite.
public void testMoveDocumentInFolderInRmSite() {
doBehaviourDrivenTest(new BehaviourDrivenTest(user) {
private NodeRef folder1;
private NodeRef document1;
private String document1Name = GUID.generate();
private NodeRef rmCategory;
private NodeRef rmFolder;
public void given() {
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
runAs(new RunAsWork<Void>() {
public Void doWork() throws Exception {
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
return null;
}
}, getAdminUserName());
}
public void when() throws FileExistsException, FileNotFoundException {
runAs(new RunAsWork<Void>() {
public Void doWork() throws Exception {
filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING);
return null;
}
}, getAdminUserName());
fileFolderService.move(document1, rmFolder, null);
}
public void then() {
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
assertEquals(0, folder1ChildAssocs.size());
List<ChildAssociationRef> rmFolderChildAssocs = nodeService.getChildAssocs(rmFolder);
assertEquals(1, rmFolderChildAssocs.size());
NodeRef movedDocument = rmFolderChildAssocs.iterator().next().getChildRef();
String recordIdentifier = (String) nodeService.getProperty(movedDocument, RecordsManagementModel.PROP_IDENTIFIER);
assertNotNull(recordIdentifier);
String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME);
assertEquals(document1Name + " (" + recordIdentifier + ")", movedDocumentName);
}
});
}
use of org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork in project records-management by Alfresco.
the class RM978Test method testCopyFolderInFolderInRmSite.
public void testCopyFolderInFolderInRmSite() {
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) {
private NodeRef folder1;
private NodeRef rmCategory;
private NodeRef rmFolder;
public void given() {
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
runAs(new RunAsWork<Void>() {
public Void doWork() throws Exception {
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
return null;
}
}, getAdminUserName());
}
public void when() throws FileExistsException, FileNotFoundException {
fileFolderService.copy(folder1, rmFolder, GUID.generate());
}
});
}
Aggregations