mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-5309 - Added integration test for the case: when a record is declared, the shared link is removed
This commit is contained in:
@@ -27,12 +27,14 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.record;
|
package org.alfresco.module.org_alfresco_module_rm.test.integration.record;
|
||||||
|
|
||||||
|
import org.alfresco.model.QuickShareModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.service.cmr.model.FileExistsException;
|
import org.alfresco.service.cmr.model.FileExistsException;
|
||||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||||
|
import org.alfresco.service.cmr.quickshare.QuickShareService;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,12 +44,25 @@ import org.alfresco.service.cmr.security.AccessStatus;
|
|||||||
*/
|
*/
|
||||||
public class CreateInplaceRecordTest extends BaseRMTestCase
|
public class CreateInplaceRecordTest extends BaseRMTestCase
|
||||||
{
|
{
|
||||||
|
private QuickShareService quickShareService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isCollaborationSiteTest()
|
protected boolean isCollaborationSiteTest()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initServices()
|
||||||
|
{
|
||||||
|
super.initServices();
|
||||||
|
|
||||||
|
quickShareService = (QuickShareService) applicationContext.getBean("quickShareService");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a document in a collaboration site
|
* Given a document in a collaboration site
|
||||||
* When the document is declared by a site collaborator
|
* When the document is declared by a site collaborator
|
||||||
@@ -185,4 +200,49 @@ public class CreateInplaceRecordTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a shared document in a collaboration site
|
||||||
|
* When the document is declared as record by a site collaborator
|
||||||
|
* Then the document becomes a record and is not shared anymore
|
||||||
|
*/
|
||||||
|
public void testCreateInplaceRecordFromCollabSiteRemovesSharedLink()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||||
|
{
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
// Check that the document is not a record
|
||||||
|
assertFalse("The document should not be a record", recordService.isRecord(dmDocument));
|
||||||
|
|
||||||
|
quickShareService.shareContent(dmDocument);
|
||||||
|
// Check the document is shared
|
||||||
|
assertTrue("The document is shared", nodeService.hasAspect(dmDocument, QuickShareModel.ASPECT_QSHARE));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when()
|
||||||
|
{
|
||||||
|
// Declare the document as a record
|
||||||
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
// Declare record
|
||||||
|
recordService.createRecord(filePlan, dmDocument);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, dmCollaborator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
// Check that the document is a record now
|
||||||
|
assertTrue("The document should now be a record", recordService.isRecord(dmDocument));
|
||||||
|
|
||||||
|
// Check that the record is not shared anymore
|
||||||
|
assertFalse("The document should not be shared anymore", nodeService.hasAspect(dmDocument, QuickShareModel.ASPECT_QSHARE));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user