diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index e79acc7b42..6226aded14 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -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.CapabilityService; 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.DispositionService; 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.DICTIONARY_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 */ @@ -164,7 +166,7 @@ public class RecordServiceImpl extends BaseBehaviourBean RM_CUSTOM_URI, ReportModel.RMR_URI, RecordableVersionModel.RMV_URI, - DOD5015Model.DOD_URI + DOD5015Model.DOD_URI )); /** non-record model URI's */ diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationTestSuite.java index 0e0166d123..591163c79e 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationTestSuite.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationTestSuite.java @@ -32,7 +32,8 @@ import org.junit.runners.Suite.SuiteClasses; @SuiteClasses( { ClassificationReasonsTest.class, - ClassificationLevelsTest.class + ClassificationLevelsTest.class, + ClassifyTest.class }) public class ClassificationTestSuite { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassifyTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassifyTest.java new file mode 100644 index 0000000000..d5e6edf505 --- /dev/null +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassifyTest.java @@ -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 . + */ +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)nodeService.getProperty(record, ClassifiedContentModel.PROP_CLASSIFICATION_REASONS)); + } + }); + } +}