mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1147: A user can create a 'vanilla' or DOD compliant records management site
* RM-1178: Add DOD site and file plan types to DOD specific content model * RM-1179: Extend create site dialog to set allow creation of DOD compliant RM site * RM-1180: Create a patch to update all existing file plans to be, by default, DOD compliant git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@60943 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.dod;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
|
||||
/**
|
||||
* Integration test for RM1147 - A user can create a 'vanilla' or DOD compliant records management site.
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
public class RM1147DODRMSiteTest extends BaseRMTestCase implements DOD5015Model
|
||||
{
|
||||
/**
|
||||
* Don't create a RM test site in setup
|
||||
*/
|
||||
@Override
|
||||
protected boolean isRMSiteTest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the creation of a DOD file plan via the file plan service
|
||||
*/
|
||||
public void testCreateDODFilePlan()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
return filePlanService.createFilePlan(folder, "myDODfileplan", TYPE_DOD_5015_FILE_PLAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef filePlan) throws Exception
|
||||
{
|
||||
assertNotNull(filePlan);
|
||||
assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan));
|
||||
assertTrue(filePlanService.isFilePlanComponent(filePlan));
|
||||
assertTrue(filePlanService.isFilePlan(filePlan));
|
||||
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
|
||||
assertNotNull(filePlanService.getUnfiledContainer(filePlan));
|
||||
assertNotNull(filePlanService.getHoldContainer(filePlan));
|
||||
assertNotNull(filePlanService.getTransferContainer(filePlan));
|
||||
assertTrue(filePlanService.getFilePlans().contains(filePlan));
|
||||
assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the creation of a DOD site via the site service
|
||||
*/
|
||||
public void testCreateDODRMSite()
|
||||
{
|
||||
doTestInTransaction(new Test<SiteInfo>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public SiteInfo run() throws Exception
|
||||
{
|
||||
return siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(SiteInfo siteInfo) throws Exception
|
||||
{
|
||||
assertNotNull(siteInfo);
|
||||
assertEquals(TYPE_DOD_5015_SITE, nodeService.getType(siteInfo.getNodeRef()));
|
||||
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentLibrary");
|
||||
assertNotNull(filePlan);
|
||||
assertEquals(TYPE_DOD_5015_FILE_PLAN, nodeService.getType(filePlan));
|
||||
assertTrue(filePlanService.isFilePlanComponent(filePlan));
|
||||
assertTrue(filePlanService.isFilePlan(filePlan));
|
||||
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
|
||||
assertNotNull(filePlanService.getUnfiledContainer(filePlan));
|
||||
assertNotNull(filePlanService.getHoldContainer(filePlan));
|
||||
assertNotNull(filePlanService.getTransferContainer(filePlan));
|
||||
assertTrue(filePlanService.getFilePlans().contains(filePlan));
|
||||
assertFalse(filePlanRoleService.getRoles(filePlan).isEmpty());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to ensure that a record created in the a DOD site does have the DOD meta-data attached
|
||||
*/
|
||||
public void testDODRecord()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
siteService.createSite("dodrmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_DOD_5015_SITE);
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
|
||||
assertNotNull(filePlan);
|
||||
|
||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
|
||||
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef record) throws Exception
|
||||
{
|
||||
assertNotNull(record);
|
||||
assertTrue(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to ensure a record created in a vanilla site does not have the DOD meta-data attached
|
||||
*/
|
||||
public void testVanillaRecord()
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
String siteId = GUID.generate();
|
||||
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
siteService.createSite("rmsite", siteId, "title", "description", SiteVisibility.PUBLIC, TYPE_RM_SITE);
|
||||
NodeRef filePlan = siteService.getContainer(siteId, "documentlibrary");
|
||||
assertNotNull(filePlan);
|
||||
|
||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, "testOne");
|
||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, "testOne");
|
||||
NodeRef record = utils.createRecord(recordFolder, "testOne.txt", "Test One");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef record) throws Exception
|
||||
{
|
||||
assertNotNull(record);
|
||||
assertFalse(nodeService.hasAspect(record, ASPECT_DOD_5015_RECORD));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -253,6 +253,15 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected String dmCollaborator;
|
||||
protected NodeRef dmCollaboratorNodeRef;
|
||||
|
||||
/**
|
||||
* Indicates whether this is a RM site test or not. If true then the test RM site is created along with a basic
|
||||
* file plan structure, otherwise not.
|
||||
*/
|
||||
protected boolean isRMSiteTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this is a multi-hierarchy test or not. If it is then the multi-hierarchy record
|
||||
* taxonomy test data is loaded.
|
||||
@@ -421,7 +430,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
filter.disableBehaviour();
|
||||
try
|
||||
{
|
||||
if (nodeService.exists(filePlan) == true)
|
||||
if (filePlan != null && nodeService.exists(filePlan) == true)
|
||||
{
|
||||
Set<NodeRef> holds = freezeService.getHolds(filePlan);
|
||||
for (NodeRef hold : holds)
|
||||
@@ -430,13 +439,13 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeService.exists(folder) == true)
|
||||
if (folder != null && nodeService.exists(folder) == true)
|
||||
{
|
||||
// Delete the folder
|
||||
nodeService.deleteNode(folder);
|
||||
}
|
||||
|
||||
if (siteService.getSite(siteId) != null)
|
||||
if (siteId != null && siteService.getSite(siteId) != null)
|
||||
{
|
||||
// Delete the site
|
||||
siteService.deleteSite(siteId);
|
||||
@@ -474,7 +483,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
{
|
||||
setupTestDataImpl();
|
||||
|
||||
if (isRecordTest() == true)
|
||||
if (isRecordTest() == true && isRMSiteTest() == true)
|
||||
{
|
||||
setupTestRecords();
|
||||
}
|
||||
@@ -485,16 +494,19 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
@Override
|
||||
public void test(Void result) throws Exception
|
||||
{
|
||||
if (isRecordTest() == true)
|
||||
{
|
||||
// declare a record
|
||||
utils.declareRecord(recordDeclaredOne);
|
||||
utils.declareRecord(recordDeclaredTwo);
|
||||
}
|
||||
|
||||
// unfiled container
|
||||
unfiledContainer = filePlanService.getUnfiledContainer(filePlan);
|
||||
assertNotNull(unfiledContainer);
|
||||
if (isRMSiteTest() == true)
|
||||
{
|
||||
if (isRecordTest() == true)
|
||||
{
|
||||
// declare a record
|
||||
utils.declareRecord(recordDeclaredOne);
|
||||
utils.declareRecord(recordDeclaredTwo);
|
||||
}
|
||||
|
||||
// unfiled container
|
||||
unfiledContainer = filePlanService.getUnfiledContainer(filePlan);
|
||||
assertNotNull(unfiledContainer);
|
||||
}
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
@@ -529,28 +541,31 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true);
|
||||
permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true);
|
||||
|
||||
siteId = GUID.generate();
|
||||
siteInfo = siteService.createSite(
|
||||
"rm-site-dashboard",
|
||||
siteId,
|
||||
"title",
|
||||
"descrition",
|
||||
SiteVisibility.PUBLIC,
|
||||
RecordsManagementModel.TYPE_RM_SITE);
|
||||
|
||||
filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||
assertNotNull("Site document library container was not created successfully.", filePlan);
|
||||
|
||||
// Create RM container
|
||||
rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer");
|
||||
assertNotNull("Could not create rm container", rmContainer);
|
||||
|
||||
// Create disposition schedule
|
||||
dispositionSchedule = utils.createBasicDispositionSchedule(rmContainer);
|
||||
|
||||
// Create RM folder
|
||||
rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder");
|
||||
assertNotNull("Could not create rm folder", rmFolder);
|
||||
if (isRMSiteTest() == true)
|
||||
{
|
||||
siteId = GUID.generate();
|
||||
siteInfo = siteService.createSite(
|
||||
"rm-site-dashboard",
|
||||
siteId,
|
||||
"title",
|
||||
"descrition",
|
||||
SiteVisibility.PUBLIC,
|
||||
RecordsManagementModel.TYPE_RM_SITE);
|
||||
|
||||
filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||
assertNotNull("Site document library container was not created successfully.", filePlan);
|
||||
|
||||
// Create RM container
|
||||
rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer");
|
||||
assertNotNull("Could not create rm container", rmContainer);
|
||||
|
||||
// Create disposition schedule
|
||||
dispositionSchedule = utils.createBasicDispositionSchedule(rmContainer);
|
||||
|
||||
// Create RM folder
|
||||
rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder");
|
||||
assertNotNull("Could not create rm folder", rmFolder);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setupTestRecords()
|
||||
|
Reference in New Issue
Block a user