RM-2186: Complete records can not be classified

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@103923 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2015-05-11 01:25:11 +00:00
parent 1c62f51937
commit 960a3da39e
3 changed files with 85 additions and 3 deletions

View File

@@ -43,6 +43,7 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFi
import org.alfresco.module.org_alfresco_module_rm.capability.Capability; import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
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.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
@@ -154,7 +155,8 @@ public class RecordServiceImpl extends BaseBehaviourBean
NamespaceService.DATALIST_MODEL_1_0_URI, NamespaceService.DATALIST_MODEL_1_0_URI,
NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_1_0_URI,
NamespaceService.BPM_MODEL_1_0_URI, NamespaceService.BPM_MODEL_1_0_URI,
NamespaceService.RENDITION_MODEL_1_0_URI NamespaceService.RENDITION_MODEL_1_0_URI,
ClassifiedContentModel.CLF_URI
}; };
/** record model URI's */ /** record model URI's */
@@ -164,7 +166,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
RM_CUSTOM_URI, RM_CUSTOM_URI,
ReportModel.RMR_URI, ReportModel.RMR_URI,
RecordableVersionModel.RMV_URI, RecordableVersionModel.RMV_URI,
DOD5015Model.DOD_URI DOD5015Model.DOD_URI
)); ));
/** non-record model URI's */ /** non-record model URI's */

View File

@@ -32,7 +32,8 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses( @SuiteClasses(
{ {
ClassificationReasonsTest.class, ClassificationReasonsTest.class,
ClassificationLevelsTest.class ClassificationLevelsTest.class,
ClassifyTest.class
}) })
public class ClassificationTestSuite public class ClassificationTestSuite
{ {

View File

@@ -0,0 +1,79 @@
/*
* Copyright (C) 2005-2015 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.integration.classification;
import java.util.Collections;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Classification level integration test
*
* @author Roy Wetherall
* @since 3.0
*/
public class ClassifyTest extends BaseRMTestCase
{
/** test data */
private static final String CLASSIFICATION_LEVEL = "level1";
private static final String CLASSIFICATION_REASON = "Test Reason 1";
private static final String CLASSIFICATION_AUTHORITY = "classification authority";
private static final String RECORD_NAME = "recordname.txt";
/**
* Given that a record is complete
* And unclassified
* Then I can successfully set the initial classification
*/
public void testClassifyCompleteRecord() throws Exception
{
doBehaviourDrivenTest(new BehaviourDrivenTest()
{
private NodeRef record;
public void given() throws Exception
{
record = utils.createRecord(rmFolder, RECORD_NAME);
utils.completeRecord(record);
}
public void when() throws Exception
{
classificationService.classifyContent(
CLASSIFICATION_LEVEL,
CLASSIFICATION_AUTHORITY,
Collections.singleton(CLASSIFICATION_REASON),
record);
}
@SuppressWarnings("unchecked")
public void then() throws Exception
{
assertTrue(nodeService.hasAspect(record, ClassifiedContentModel.ASPECT_CLASSIFIED));
assertEquals(CLASSIFICATION_LEVEL, (String)nodeService.getProperty(record, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION));
assertEquals(CLASSIFICATION_LEVEL, (String)nodeService.getProperty(record, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION));
assertEquals(CLASSIFICATION_AUTHORITY, (String)nodeService.getProperty(record, ClassifiedContentModel.PROP_CLASSIFICATION_AUTHORITY));
assertEquals(Collections.singletonList(CLASSIFICATION_REASON), (List<String>)nodeService.getProperty(record, ClassifiedContentModel.PROP_CLASSIFICATION_REASONS));
}
});
}
}