mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1194: As a records manager I want to create a 'standard' RM site that only displays records meta-data types relevant to standard RM practices, so that I don't get confused by unwanted DoD records meta-data types.
* record metadata aspects are now configured via spring and includes which file plan type they are relevant for * added 'unit test' structure .. for 'real' unit tests, ie anything that doesn't load the application context * included Mockito, new source location and unit test suite into POM * added unit and functional tests for feature (server) * refactored accordingly (webscripts, UI, etc) * visual test of UI .. automation tests to follow git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63013 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -38,7 +38,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
||||
ServicesTestSuite.class,
|
||||
WebScriptTestSuite.class,
|
||||
IssueTestSuite.class,
|
||||
ParameterProcessorTestSuite.class
|
||||
ParameterProcessorTestSuite.class,
|
||||
DoD5015TestSuite.class
|
||||
})
|
||||
public class AllTestSuite
|
||||
{
|
||||
|
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2014 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;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.dod.RM1147DODRMSiteTest;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.dod.RM1194ExcludeDoDRecordTypesTest;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Suite;
|
||||
import org.junit.runners.Suite.SuiteClasses;
|
||||
|
||||
/**
|
||||
* DoD 5015 integration test suite
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses(
|
||||
{
|
||||
RM1147DODRMSiteTest.class,
|
||||
RM1194ExcludeDoDRecordTypesTest.class
|
||||
})
|
||||
public class DoD5015TestSuite
|
||||
{
|
||||
}
|
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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 java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
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 RM1194ExcludeDoDRecordTypesTest extends BaseRMTestCase implements DOD5015Model
|
||||
{
|
||||
/**
|
||||
* Don't create a RM test site in setup
|
||||
*/
|
||||
@Override
|
||||
protected boolean isRMSiteTest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the correct record metadata aspects are available for a DoD record.
|
||||
*/
|
||||
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);
|
||||
Set<QName> aspects = recordService.getRecordMetadataAspects(record);
|
||||
assertNotNull(aspects);
|
||||
assertEquals(5, aspects.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the correct record metadata aspects are available for a vanilla record.
|
||||
*/
|
||||
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);
|
||||
Set<QName> aspects = recordService.getRecordMetadataAspects(record);
|
||||
assertNotNull(aspects);
|
||||
assertEquals(1, aspects.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -32,6 +32,7 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,7 +69,8 @@ public class RM1039Test extends BaseRMTestCase
|
||||
{
|
||||
assertNotNull(result);
|
||||
assertNull(dispositionService.getDispositionSchedule(result));
|
||||
assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE));
|
||||
assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -87,6 +89,7 @@ public class RM1039Test extends BaseRMTestCase
|
||||
assertNotNull(result);
|
||||
assertNull(dispositionService.getDispositionSchedule(result));
|
||||
assertFalse(nodeService.hasAspect(result, ASPECT_DISPOSITION_LIFECYCLE));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(result, FILING));
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -26,7 +26,6 @@ import java.util.Set;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||
@@ -94,9 +93,9 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
Set<QName> aspects = recordService.getRecordMetaDataAspects();
|
||||
Set<QName> aspects = recordService.getRecordMetadataAspects(filePlan);
|
||||
assertNotNull(aspects);
|
||||
assertEquals(6, aspects.size());
|
||||
assertEquals(1, aspects.size());
|
||||
assertTrue(aspects.containsAll(getAspectList()));
|
||||
|
||||
return null;
|
||||
@@ -110,14 +109,9 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
private List<QName> getAspectList()
|
||||
{
|
||||
QName[] aspects = new QName[]
|
||||
{
|
||||
DOD5015Model.ASPECT_DIGITAL_PHOTOGRAPH_RECORD,
|
||||
DOD5015Model.ASPECT_PDF_RECORD,
|
||||
DOD5015Model.ASPECT_WEB_RECORD,
|
||||
DOD5015Model.ASPECT_SCANNED_RECORD,
|
||||
ASPECT_RECORD_META_DATA,
|
||||
DOD5015Model.ASPECT_DOD_5015_RECORD
|
||||
};
|
||||
{
|
||||
ASPECT_RECORD_META_DATA
|
||||
};
|
||||
|
||||
return Arrays.asList(aspects);
|
||||
}
|
||||
|
Reference in New Issue
Block a user