diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties index 0d160cc4ce..974ad73783 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties @@ -61,8 +61,6 @@ rm.record.contributors.group.name=RECORD_CONTRIBUTORS # # Classified records # -# The location of the classification levels configuration file (relative to the classpath). -rm.classification.levelsFile=/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json # The location of the classification reasons configuration file (relative to the classpath). rm.classification.reasonsFile=/alfresco/module/org_alfresco_module_rm/classification/rm-classification-reasons.json # The location of the exemption categories configuration file (relative to the classpath). diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json b/rm-server/config/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json deleted file mode 100644 index a605b07857..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "name" : "TS", - "displayLabel" : "rm.classification.topSecret" - }, - { - "name" : "S", - "displayLabel" : "rm.classification.secret" - }, - { - "name" : "C", - "displayLabel" : "rm.classification.confidential" - } -] diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml index a26fae24c0..5750b8b125 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml @@ -39,12 +39,12 @@ - + - - + @@ -53,7 +53,6 @@ - @@ -123,6 +122,7 @@ + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml index 4b1c3b8bdd..f23a41dbdf 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml @@ -270,12 +270,12 @@ - - - + + + diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/dao/CaveatDAOFromJSONBootstrap.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/dao/CaveatDAOFromJSONBootstrap.java index 71a266bd97..9fcb73331b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/dao/CaveatDAOFromJSONBootstrap.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/dao/CaveatDAOFromJSONBootstrap.java @@ -108,7 +108,14 @@ public class CaveatDAOFromJSONBootstrap extends AbstractLifecycleBean @SuppressWarnings("unchecked") public ImmutableMap doWork() throws Exception { - return (ImmutableMap) attributeService.getAttribute(key); + // TODO: Although an ImmutableMap is stored, after restarting the server, a HashMap is returned. + // Investigate why this is, and whether we can avoid creating a new copy of the map here. + Map persistedMap = (Map) attributeService.getAttribute(key); + if (persistedMap == null) + { + return null; + } + return ImmutableMap.copyOf(persistedMap); } }); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrap.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrap.java index a1ebaa96ec..f4add41e3d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrap.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrap.java @@ -23,6 +23,10 @@ import java.util.ArrayList; import java.util.List; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList.Builder; +import org.alfresco.module.org_alfresco_module_rm.caveat.dao.CaveatDAOInterface; +import org.alfresco.module.org_alfresco_module_rm.caveat.scheme.CaveatGroup; +import org.alfresco.module.org_alfresco_module_rm.caveat.scheme.CaveatMark; import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.MissingConfiguration; import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel; import org.alfresco.module.org_alfresco_module_rm.classification.validation.ClassificationLevelFieldsValidator; @@ -61,6 +65,8 @@ public class ClassificationServiceBootstrap extends AbstractLifecycleBean implem private ClearanceLevelManager clearanceLevelManager = new ClearanceLevelManager(); /** The exemption categories currently configured in this server. */ private ExemptionCategoryManager exemptionCategoryManager = new ExemptionCategoryManager(); + /** The caveat DAO, which is used to access the classification levels. */ + private CaveatDAOInterface caveatDAO; private ClassificationServiceDAO classificationServiceDAO; private ClassificationLevelFieldsValidator classificationLevelFieldsValidator = new ClassificationLevelFieldsValidator(); private ClassificationSchemeEntityValidator classificationLevelValidator = new ClassificationSchemeEntityValidator<>(classificationLevelFieldsValidator); @@ -82,6 +88,8 @@ public class ClassificationServiceBootstrap extends AbstractLifecycleBean implem this.classificationServiceDAO = classificationServiceDAO; } + /** Set the caveat DAO, which is used to access the classification levels. */ + public void setCaveatDAO(CaveatDAOInterface caveatDAO) { this.caveatDAO = caveatDAO; } /** Set the object from which configuration options will be read. */ public void setClassificationServiceDAO(ClassificationServiceDAO classificationServiceDAO) { this.classificationServiceDAO = classificationServiceDAO; } public void setAttributeService(AttributeService attributeService) { this.attributeService = attributeService; } @@ -110,8 +118,7 @@ public class ClassificationServiceBootstrap extends AbstractLifecycleBean implem { public Void execute() { - List levels = getConfiguredSchemeEntities( - ClassificationLevel.class, LEVELS_KEY, classificationLevelValidator); + List levels = getConfiguredClassificationLevels(LEVELS_KEY, classificationLevelValidator); classificationLevelManager.setClassificationLevels(levels); List reasons = getConfiguredSchemeEntities( @@ -160,6 +167,46 @@ public class ClassificationServiceBootstrap extends AbstractLifecycleBean implem else { return "non-empty"; } } + /** + * Create the classification levels from the classification caveat group data. + * + * @param key The key used to persist the classification levels in the attribute service. + * @param validator The validator used to check the classification levels. + * @return A list of the configured classification levels. + */ + protected List getConfiguredClassificationLevels(Serializable[] key, ClassificationSchemeEntityValidator validator) + { + List persistedValues = getPersistedValues(key); + CaveatGroup classificationCaveatGroup = caveatDAO.getGroupById(CLASSIFICATION_LEVEL_CAVEAT); + Builder builder = ImmutableList.builder(); + for (CaveatMark caveatMark : classificationCaveatGroup.getCaveatMarks()) + { + builder.add(new ClassificationLevel(caveatMark)); + } + List classpathValues = builder.build(); + + // Note! We cannot log the entities or even the size of these lists for security reasons. + LOGGER.debug("Persisted ClassificationLevel: {}", loggableStatusOf(persistedValues)); + LOGGER.debug("Classpath ClassificationLevel: {}", loggableStatusOf(classpathValues)); + + validator.validate(classpathValues, ClassificationLevel.class.getSimpleName()); + + if (isEmpty(classpathValues)) + { + throw new MissingConfiguration("ClassificationLevel configuration is missing."); + } + if (classpathValues.equals(persistedValues)) + { + return persistedValues; + } + if (!isEmpty(persistedValues)) + { + LOGGER.warn("ClassificationLevel configuration changed. This may result in unpredictable results if the classification scheme is already in use."); + } + attributeService.setAttribute((Serializable) classpathValues, key); + return classpathValues; + } + protected List getConfiguredSchemeEntities(Class clazz, Serializable[] key, ClassificationSchemeEntityValidator validator) { final List persistedValues = getPersistedValues(key); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAO.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAO.java index f8378c18f5..a2f04b8081 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAO.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAO.java @@ -34,8 +34,8 @@ import org.json.JSONObject; import org.json.JSONTokener; /** - * This class is responsible for providing the configured classification levels - * and classification reasons, dealing with JSON schema as part of that. + * This class is responsible for providing the configured classification scheme entities, dealing with JSON schema as + * part of that. * * @author Neil Mc Erlean * @since 2.4.a @@ -47,11 +47,6 @@ class ClassificationServiceDAO private ClassificationSchemeEntityFactory classificationSchemeEntityFactory = new ClassificationSchemeEntityFactory(); - /** Set the location of the level configuration file relative to the classpath. */ - public void setLevelConfigLocation(String levelConfigLocation) - { - configLocations.put(ClassificationLevel.class.getSimpleName(), levelConfigLocation); - } /** Set the location of the reasons configuration file relative to the classpath. */ public void setReasonConfigLocation(String reasonConfigLocation) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/model/ClassifiedContentModel.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/model/ClassifiedContentModel.java index a6d89f6124..cf02d739a0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/model/ClassifiedContentModel.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/classification/model/ClassifiedContentModel.java @@ -36,6 +36,8 @@ public interface ClassifiedContentModel String CLF_URI = "http://www.alfresco.org/model/classifiedcontent/1.0"; String CLF_PREFIX = "clf"; + String CLASSIFICATION_LEVEL_CAVEAT = "classification"; + Serializable[] LEVELS_KEY = new String[] { "org.alfresco", "module.org_alfresco_module_rm", "classification.levels" }; Serializable[] REASONS_KEY = new String[] { "org.alfresco", "module.org_alfresco_module_rm", "classification.reasons" }; Serializable[] EXEMPTION_CATEGORIES_KEY = new String[] { "org.alfresco", "module.org_alfresco_module_rm", "classification.exemptionCategories" }; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationConstraintTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationConstraintTest.java index cc8aa829b6..8e01ee3306 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationConstraintTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationConstraintTest.java @@ -179,29 +179,29 @@ public class ClassificationConstraintTest implements RMPermissionModel * Mid-level user further downgrading a downgraded record. *

* RM-2502

-     * Given I have "level2" clearance
-     * And a record has an initial classification of "level1"
-     * And the record has a current classification of "level2"
-     * When I try to downgrade the record to "level3"
+     * Given I have secret clearance
+     * And a record has an initial classification of top secret
+     * And the record has a current classification of secret
+     * When I try to downgrade the record to confidential
      * Then I am successful.
      * 
*/ @Test public void testInitialClassificationConstraint() { - // Given I set up some test data (admin at level 1, midLevelUser at level 2 and a new record). + // Given I set up some test data (admin at TS, midLevelUser at S and a new record). final String midLevelUser = GUID.generate(); final NodeRef record = AuthenticationUtil.runAsSystem(new RunAsWork() { public NodeRef doWork() { - // Ensure admin is level 1 cleared. - securityClearanceService.setUserSecurityClearance(AuthenticationUtil.getAdminUserName(), "level1"); - // Create user with level 2 clearance. + // Ensure admin is TS cleared. + securityClearanceService.setUserSecurityClearance(AuthenticationUtil.getAdminUserName(), "TS"); + // Create user with S clearance. createPerson(midLevelUser, true); filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, midLevelUser); filePlanPermissionService.setPermission(rmContainer, midLevelUser, FILING); - securityClearanceService.setUserSecurityClearance(midLevelUser, "level2"); + securityClearanceService.setUserSecurityClearance(midLevelUser, "S"); // Create a record to be classified during the test. return utils.createRecord(rmFolder, RECORD_NAME); } @@ -212,42 +212,42 @@ public class ClassificationConstraintTest implements RMPermissionModel { public Void doWork() { - // Create a level 1 record and downgrade it to level 2. - classifyAs(record, "level1"); - classifyAs(record, "level2"); + // Create a TS record and downgrade it to S. + classifyAs(record, "TS"); + classifyAs(record, "S"); assertTrue("Record should have been classified.", nodeService.hasAspect(record, ClassifiedContentModel.ASPECT_CLASSIFIED)); - assertEquals("Record have initial classification of 'level1'.", "level1", + assertEquals("Record have initial classification of 'TS'.", "TS", nodeService.getProperty(record, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION)); - assertEquals("Record should be 'level2' classified.", "level2", + assertEquals("Record should be 'S' classified.", "S", nodeService.getProperty(record, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION)); return null; } }, AuthenticationUtil.getAdminUserName()); - // When the mid-level user downgrades the record to level 3. + // When the mid-level user downgrades the record to C. AuthenticationUtil.runAs(new RunAsWork() { public Void doWork() { // Check that the mid-clearance user can further downgrade the classification (even though the initial // classification was above their clearance). - classifyAs(record, "level3"); + classifyAs(record, "C"); return null; } }, midLevelUser); - // Then the record is classified at level 3 (with initial classification level 1). + // Then the record is classified at C (with initial classification TS). AuthenticationUtil.runAs(new RunAsWork() { public Void doWork() { assertTrue("Record should still be classified.", nodeService.hasAspect(record, ClassifiedContentModel.ASPECT_CLASSIFIED)); - assertEquals("Record have initial classification of 'level1'.", "level1", + assertEquals("Record have initial classification of 'TS'.", "TS", nodeService.getProperty(record, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION)); - assertEquals("Record should be 'level3' classified.", "level3", + assertEquals("Record should be 'C' classified.", "C", nodeService.getProperty(record, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION)); return null; } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationLevelsTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationLevelsTest.java index d92537a51a..e5367159a7 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationLevelsTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationLevelsTest.java @@ -18,7 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.test.integration.classification; -import java.io.InputStream; +import java.util.Arrays; import java.util.List; import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel; @@ -33,28 +33,10 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; */ public class ClassificationLevelsTest extends BaseRMTestCase { - private static final String CLASSIFICATION_LEVELS_FILE_PATH = "/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json"; - private static final String LEVEL1_ID = "level1"; - private static final String LEVEL1_DISPLAY_LABEL = "Level 1"; - private static final String LEVEL2_ID = "level2"; - private static final String LEVEL2_DISPLAY_LABEL_KEY = "rm.classification.level2"; - private static final String LEVEL3_ID = "level3"; - private static final String LEVEL3_DISPLAY_LABEL_KEY = "rm.classification.level3"; - private static final String LEVEL4_ID = "level4"; - private static final String LEVEL4_DISPLAY_LABEL = "Level 4"; - public void testClassificationLevels() throws Exception { doBehaviourDrivenTest(new BehaviourDrivenTest() { - public void given() throws Exception - { - try (final InputStream in = getClass().getResourceAsStream(CLASSIFICATION_LEVELS_FILE_PATH)) - { - assertNotNull(in); - } - } - public void when() throws Exception { // Server is up and running @@ -63,25 +45,12 @@ public class ClassificationLevelsTest extends BaseRMTestCase public void then() throws Exception { List levels = classificationSchemeService.getClassificationLevels(); - assertNotNull(levels); - assertEquals("Expected 5 levels to be configured (4 defined in the test plus Unclassified)", 5, levels.size()); - - ClassificationLevel level1 = levels.get(0); - ClassificationLevel level2 = levels.get(1); - ClassificationLevel level3 = levels.get(2); - ClassificationLevel level4 = levels.get(3); - - assertEquals(level4.getDisplayLabel(), LEVEL4_DISPLAY_LABEL); - assertEquals(level3.getDisplayLabel(), LEVEL3_DISPLAY_LABEL_KEY); - assertEquals(level2.getDisplayLabel(), LEVEL2_DISPLAY_LABEL_KEY); - assertEquals(level1.getDisplayLabel(), LEVEL1_DISPLAY_LABEL); - - assertEquals(level1.getId(), LEVEL1_ID); - assertEquals(level2.getId(), LEVEL2_ID); - assertEquals(level3.getId(), LEVEL3_ID); - assertEquals(level4.getId(), LEVEL4_ID); - - assertEquals(ClassificationLevelManager.UNCLASSIFIED, levels.get(4)); + List expectedLevels = Arrays.asList( + new ClassificationLevel("TS", "rm.caveat.classification.mark.ts.label"), + new ClassificationLevel("S", "rm.caveat.classification.mark.s.label"), + new ClassificationLevel("C", "rm.caveat.classification.mark.c.label"), + ClassificationLevelManager.UNCLASSIFIED); + assertEquals(levels, expectedLevels); } }); } 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 index 007a148a6e..b808fb7b47 100644 --- 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 @@ -40,8 +40,8 @@ import org.alfresco.util.GUID; public class ClassifyTest extends BaseRMTestCase { /** test data */ - private static final String CLASSIFICATION_LEVEL = "level1"; - private static final String LOWER_CLASSIFICATION_LEVEL = "level2"; + private static final String CLASSIFICATION_LEVEL = "TS"; + private static final String LOWER_CLASSIFICATION_LEVEL = "S"; private static final String CLASSIFICATION_REASON = "Test Reason 1"; private static final String CLASSIFICATION_AGENCY = "classification agency"; private static final String CLASSIFIED_BY = "classified by text"; @@ -122,8 +122,8 @@ public class ClassifyTest extends BaseRMTestCase } /** - * Given I have "level1" clearance - * When I try to classify content with the level "level1" + * Given I have top secret clearance + * When I try to classify content as top secret * Then the content is classified. */ public void testClassifyContent() @@ -165,15 +165,15 @@ public class ClassifyTest extends BaseRMTestCase { assertTrue("Record should have been classified.", nodeService.hasAspect(record, ClassifiedContentModel.ASPECT_CLASSIFIED)); - assertEquals("Record should be 'level1' classified.", CLASSIFICATION_LEVEL, + assertEquals("Record should be classified as top secret.", CLASSIFICATION_LEVEL, nodeService.getProperty(record, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION)); } }); } /** - * Given I have "level2" clearance - * When I call the classify content API directly using the level "level1" + * Given I have secret clearance + * When I call the classify content API directly using the level "top secret" * Then I receive an error that the level could not be found. */ public void testClearanceNecessaryToClassifyContent() diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/SecurityClearanceTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/SecurityClearanceTest.java index 2b15367f30..7b7d84cf8a 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/SecurityClearanceTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/SecurityClearanceTest.java @@ -18,8 +18,8 @@ */ package org.alfresco.module.org_alfresco_module_rm.test.integration.classification; -import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel; import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound; +import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel; import org.alfresco.module.org_alfresco_module_rm.classification.ClearanceLevel; import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; @@ -50,21 +50,21 @@ public class SecurityClearanceTest extends BaseRMTestCase public void when() throws Exception { - securityClearance = securityClearanceService.setUserSecurityClearance(userName, "level1"); + securityClearance = securityClearanceService.setUserSecurityClearance(userName, "TS"); } public void then() throws Exception { ClearanceLevel clearanceLevel = securityClearance.getClearanceLevel(); ClassificationLevel highestClassificationLevel = clearanceLevel.getHighestClassificationLevel(); - assertEquals("level1", highestClassificationLevel.getId()); + assertEquals("TS", highestClassificationLevel.getId()); } }); } /** - * Given I am a user with level2 access - * And I try to give another user level1 access + * Given I am a user with S access + * And I try to give another user TS access * Then an exception is thrown. */ public void testCantGiveClearance() throws Exception @@ -73,7 +73,7 @@ public class SecurityClearanceTest extends BaseRMTestCase { public void given() throws Exception { - securityClearanceService.setUserSecurityClearance(userName, "level2"); + securityClearanceService.setUserSecurityClearance(userName, "S"); } public void when() throws Exception @@ -83,7 +83,7 @@ public class SecurityClearanceTest extends BaseRMTestCase @Override public Void run() { - securityClearanceService.setUserSecurityClearance(rmUserName, "level1"); + securityClearanceService.setUserSecurityClearance(rmUserName, "TS"); return null; } }, userName); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/BrowseClassificationEnforcementTestBase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/BrowseClassificationEnforcementTestBase.java index 842c2e1889..f4e4767737 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/BrowseClassificationEnforcementTestBase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/BrowseClassificationEnforcementTestBase.java @@ -38,12 +38,12 @@ import org.alfresco.service.cmr.repository.NodeRef; public abstract class BrowseClassificationEnforcementTestBase extends BaseRMTestCase { protected String testUser; - protected static final String LEVEL1 = "level1"; - protected static final String LEVEL2 = "level2"; + protected static final String TOP_SECRET_ID = "TS"; + protected static final String SECRET_ID = "S"; protected static final String REASON = "Test Reason 1"; - /** Classified properties for classification level 1. */ + /** Classified properties for top secret. */ protected ClassificationAspectProperties propertiesDTO1; - /** Classified properties for classification level 2. */ + /** Classified properties for secret. */ protected ClassificationAspectProperties propertiesDTO2; @Override @@ -51,12 +51,12 @@ public abstract class BrowseClassificationEnforcementTestBase extends BaseRMTest { super.setUp(); propertiesDTO1 = new ClassificationAspectProperties(); - propertiesDTO1.setClassificationLevelId(LEVEL1); + propertiesDTO1.setClassificationLevelId(TOP_SECRET_ID); propertiesDTO1.setClassifiedBy(generate()); propertiesDTO1.setClassificationAgency(generate()); propertiesDTO1.setClassificationReasonIds(Collections.singleton(REASON)); propertiesDTO2 = new ClassificationAspectProperties(); - propertiesDTO2.setClassificationLevelId(LEVEL2); + propertiesDTO2.setClassificationLevelId(SECRET_ID); propertiesDTO2.setClassifiedBy(generate()); propertiesDTO2.setClassificationAgency(generate()); propertiesDTO2.setClassificationReasonIds(Collections.singleton(REASON)); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/ClassificationEnforcementPreMethodInvocationTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/ClassificationEnforcementPreMethodInvocationTest.java index 8059f3f028..bc81edc8a6 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/ClassificationEnforcementPreMethodInvocationTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/ClassificationEnforcementPreMethodInvocationTest.java @@ -40,7 +40,7 @@ import org.alfresco.service.namespace.QName; */ public class ClassificationEnforcementPreMethodInvocationTest extends BaseRMTestCase { - private static final String LEVEL1 = "level1"; + private static final String TOP_SECRET_ID = "TS"; private static final String REASON = "Test Reason 1"; private ClassificationAspectProperties propertiesDTO; @@ -50,7 +50,7 @@ public class ClassificationEnforcementPreMethodInvocationTest extends BaseRMTest { super.setUp(); propertiesDTO = new ClassificationAspectProperties(); - propertiesDTO.setClassificationLevelId(LEVEL1); + propertiesDTO.setClassificationLevelId(TOP_SECRET_ID); propertiesDTO.setClassifiedBy(generate()); propertiesDTO.setClassificationAgency(generate()); propertiesDTO.setClassificationReasonIds(Collections.singleton(REASON)); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentBrowseClassificationEnforcementTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentBrowseClassificationEnforcementTest.java index 910e865b5c..7cc1e95e6d 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentBrowseClassificationEnforcementTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentBrowseClassificationEnforcementTest.java @@ -164,7 +164,7 @@ public class DocumentBrowseClassificationEnforcementTest extends BrowseClassific testUser = generate(); createPerson(testUser); siteService.setMembership(collabSiteId, testUser, SITE_MANAGER); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL2); + securityClearanceService.setUserSecurityClearance(testUser, SECRET_ID); folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); doc1 = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); @@ -259,7 +259,7 @@ public class DocumentBrowseClassificationEnforcementTest extends BrowseClassific testUser = generate(); createPerson(testUser); siteService.setMembership(collabSiteId, testUser, SITE_MANAGER); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL1); + securityClearanceService.setUserSecurityClearance(testUser, TOP_SECRET_ID); folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); doc1 = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentSearchClassificationEnforcementTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentSearchClassificationEnforcementTest.java index 65035be3d6..982d0075b2 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentSearchClassificationEnforcementTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/DocumentSearchClassificationEnforcementTest.java @@ -166,7 +166,7 @@ public class DocumentSearchClassificationEnforcementTest extends SearchClassific testUser = generate(); createPerson(testUser); siteService.setMembership(collabSiteId, testUser, SITE_MANAGER); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL2); + securityClearanceService.setUserSecurityClearance(testUser, SECRET_ID); folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); doc1 = fileFolderService.create(folder, searchQuery + generate(), TYPE_CONTENT).getNodeRef(); @@ -258,7 +258,7 @@ public class DocumentSearchClassificationEnforcementTest extends SearchClassific testUser = generate(); createPerson(testUser); siteService.setMembership(collabSiteId, testUser, SITE_MANAGER); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL1); + securityClearanceService.setUserSecurityClearance(testUser, TOP_SECRET_ID); folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); doc1 = fileFolderService.create(folder, searchQuery + generate(), TYPE_CONTENT).getNodeRef(); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordBrowseClassificationEnforcementTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordBrowseClassificationEnforcementTest.java index 596a8a5426..e8704cf100 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordBrowseClassificationEnforcementTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordBrowseClassificationEnforcementTest.java @@ -160,7 +160,7 @@ public class RecordBrowseClassificationEnforcementTest extends BrowseClassificat testUser = generate(); createPerson(testUser); filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_ADMIN, testUser); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL2); + securityClearanceService.setUserSecurityClearance(testUser, SECRET_ID); category = filePlanService.createRecordCategory(filePlan, generate()); folder = recordFolderService.createRecordFolder(category, generate()); @@ -258,7 +258,7 @@ public class RecordBrowseClassificationEnforcementTest extends BrowseClassificat testUser = generate(); createPerson(testUser); filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_ADMIN, testUser); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL1); + securityClearanceService.setUserSecurityClearance(testUser, TOP_SECRET_ID); category = filePlanService.createRecordCategory(filePlan, generate()); folder = recordFolderService.createRecordFolder(category, generate()); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordSearchClassificationEnforcementTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordSearchClassificationEnforcementTest.java index f11c13b424..4663c91856 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordSearchClassificationEnforcementTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RecordSearchClassificationEnforcementTest.java @@ -256,7 +256,7 @@ public class RecordSearchClassificationEnforcementTest extends SearchClassificat testUser = generate(); createPerson(testUser); filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_ADMIN, testUser); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL1); + securityClearanceService.setUserSecurityClearance(testUser, TOP_SECRET_ID); category = filePlanService.createRecordCategory(filePlan, generate()); folder = recordFolderService.createRecordFolder(category, generate()); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RelationshipClassificationEnforcementTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RelationshipClassificationEnforcementTest.java index e59639d922..0f87c07316 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RelationshipClassificationEnforcementTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/RelationshipClassificationEnforcementTest.java @@ -40,8 +40,8 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class RelationshipClassificationEnforcementTest extends BaseRMTestCase { - private static final String LEVEL1 = "level1"; - private static final String LEVEL3 = "level3"; + private static final String TOP_SECRET_ID = "TS"; + private static final String CONFIDENTIAL_ID = "C"; private static final String REASON = "Test Reason 1"; private ClassificationAspectProperties propertiesDTO; @@ -50,7 +50,7 @@ public class RelationshipClassificationEnforcementTest extends BaseRMTestCase { super.setUp(); propertiesDTO = new ClassificationAspectProperties(); - propertiesDTO.setClassificationLevelId(LEVEL1); + propertiesDTO.setClassificationLevelId(TOP_SECRET_ID); propertiesDTO.setClassifiedBy(generate()); propertiesDTO.setClassificationAgency(generate()); propertiesDTO.setClassificationReasonIds(Collections.singleton(REASON)); @@ -64,8 +64,8 @@ public class RelationshipClassificationEnforcementTest extends BaseRMTestCase * and a category, a folder and two records have been created * * When the user has been granted filing permissions - * and the clearance level 3 for the test user has been set - * and one of the records has been classified as level 1 + * and confidential clearance for the test user has been set + * and one of the records has been classified as top secret * and a relationship between those two records has been created * * Then the admin user should see both records in the folder @@ -106,7 +106,7 @@ public class RelationshipClassificationEnforcementTest extends BaseRMTestCase public void when() throws Exception { filePlanPermissionService.setPermission(category, myUser, FILING); - securityClearanceService.setUserSecurityClearance(myUser, LEVEL3); + securityClearanceService.setUserSecurityClearance(myUser, CONFIDENTIAL_ID); contentClassificationService.classifyContent(propertiesDTO, record1); relationshipService.addRelationship(CUSTOM_REF_RENDITION.getLocalName(), record1, record2); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SavedSearchClassificationEnforcementTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SavedSearchClassificationEnforcementTest.java index ddab2910a1..fe734b73ae 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SavedSearchClassificationEnforcementTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SavedSearchClassificationEnforcementTest.java @@ -81,7 +81,7 @@ public class SavedSearchClassificationEnforcementTest extends SearchClassificati testUser = generate(); createPerson(testUser); filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_ADMIN, testUser); - securityClearanceService.setUserSecurityClearance(testUser, LEVEL2); + securityClearanceService.setUserSecurityClearance(testUser, SECRET_ID); category = filePlanService.createRecordCategory(filePlan, generate()); folder = recordFolderService.createRecordFolder(category, generate()); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SearchClassificationEnforcementTestBase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SearchClassificationEnforcementTestBase.java index 8f22bd3ac6..5d659ec0fc 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SearchClassificationEnforcementTestBase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/interceptor/SearchClassificationEnforcementTestBase.java @@ -37,12 +37,12 @@ import org.alfresco.service.cmr.repository.NodeRef; public abstract class SearchClassificationEnforcementTestBase extends BaseRMTestCase { protected String testUser; - protected static final String LEVEL1 = "level1"; - protected static final String LEVEL2 = "level2"; + protected static final String TOP_SECRET_ID = "TS"; + protected static final String SECRET_ID = "S"; protected static final String REASON = "Test Reason 1"; - /** Classified properties for classification level 1. */ + /** Classified properties for top secret. */ protected ClassificationAspectProperties propertiesDTO1; - /** Classified properties for classification level 2. */ + /** Classified properties for secret. */ protected ClassificationAspectProperties propertiesDTO2; @Override @@ -50,12 +50,12 @@ public abstract class SearchClassificationEnforcementTestBase extends BaseRMTest { super.setUp(); propertiesDTO1 = new ClassificationAspectProperties(); - propertiesDTO1.setClassificationLevelId(LEVEL1); + propertiesDTO1.setClassificationLevelId(TOP_SECRET_ID); propertiesDTO1.setClassifiedBy(generate()); propertiesDTO1.setClassificationAgency(generate()); propertiesDTO1.setClassificationReasonIds(Collections.singleton(REASON)); propertiesDTO2 = new ClassificationAspectProperties(); - propertiesDTO2.setClassificationLevelId(LEVEL2); + propertiesDTO2.setClassificationLevelId(SECRET_ID); propertiesDTO2.setClassifiedBy(generate()); propertiesDTO2.setClassificationAgency(generate()); propertiesDTO2.setClassificationReasonIds(Collections.singleton(REASON)); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java index ebbda36da1..241720416c 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/destroy/DestroyContentTest.java @@ -440,7 +440,7 @@ public class DestroyContentTest extends BaseRMTestCase // classify the content ClassificationAspectProperties properties = new ClassificationAspectProperties(); - properties.setClassificationLevelId("level1"); + properties.setClassificationLevelId("TS"); properties.setClassifiedBy("me"); properties.setClassificationReasonIds(Collections.singleton("Test Reason 1")); contentClassificationService.classifyContent(properties, deleteableContent); @@ -505,7 +505,7 @@ public class DestroyContentTest extends BaseRMTestCase // classify the content ClassificationAspectProperties properties = new ClassificationAspectProperties(); - properties.setClassificationLevelId("level1"); + properties.setClassificationLevelId("TS"); properties.setClassifiedBy("me"); properties.setClassificationReasonIds(Collections.singleton("Test Reason 1")); contentClassificationService.classifyContent(properties, deleteableContent); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2260Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2260Test.java index 7e956b0f9c..356e6bf489 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2260Test.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM2260Test.java @@ -35,7 +35,7 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class RM2260Test extends BaseRMTestCase { - private static final String LEVEL = "level1"; + private static final String LEVEL = "TS"; private static final String REASON = "Test Reason 1"; private ClassificationAspectProperties propertiesDTO; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java index e22ba86800..b3894d5e2b 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/jscript/JSONConversionComponentTest.java @@ -39,15 +39,15 @@ import org.json.JSONObject; */ public class JSONConversionComponentTest extends BaseRMTestCase { - private static final String LEVEL1 = "level1"; + private static final String TOP_SECRET_ID = "TS"; private static final String REASON1 = "Test Reason 1"; private JSONConversionComponent converter; private ContentClassificationService contentClassificationService; private NodeRef record; - /** Classification properties for classification level 1. */ - private ClassificationAspectProperties level1PropertiesDTO; + /** Classification properties for top secret classification. */ + private ClassificationAspectProperties topSecretPropertiesDTO; /** Classification properties for unclassified content. */ private ClassificationAspectProperties unclassifiedPropertiesDTO; @@ -55,11 +55,11 @@ public class JSONConversionComponentTest extends BaseRMTestCase public void setUp() throws Exception { super.setUp(); - level1PropertiesDTO = new ClassificationAspectProperties(); - level1PropertiesDTO.setClassificationLevelId(LEVEL1); - level1PropertiesDTO.setClassifiedBy(generate()); - level1PropertiesDTO.setClassificationAgency(generate()); - level1PropertiesDTO.setClassificationReasonIds(Collections.singleton(REASON1)); + topSecretPropertiesDTO = new ClassificationAspectProperties(); + topSecretPropertiesDTO.setClassificationLevelId(TOP_SECRET_ID); + topSecretPropertiesDTO.setClassifiedBy(generate()); + topSecretPropertiesDTO.setClassificationAgency(generate()); + topSecretPropertiesDTO.setClassificationReasonIds(Collections.singleton(REASON1)); unclassifiedPropertiesDTO = new ClassificationAspectProperties(); unclassifiedPropertiesDTO.setClassificationLevelId(UNCLASSIFIED_ID); unclassifiedPropertiesDTO.setClassifiedBy(generate()); @@ -113,7 +113,7 @@ public class JSONConversionComponentTest extends BaseRMTestCase @Override public void when() throws Exception { - contentClassificationService.classifyContent(level1PropertiesDTO, record); + contentClassificationService.classifyContent(topSecretPropertiesDTO, record); jsonString = converter.toJSON(record, true); } @@ -227,7 +227,7 @@ public class JSONConversionComponentTest extends BaseRMTestCase @Override public void when() throws Exception { - contentClassificationService.classifyContent(level1PropertiesDTO, file); + contentClassificationService.classifyContent(topSecretPropertiesDTO, file); jsonString = converter.toJSON(file, true); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ClassificationRestApiTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ClassificationRestApiTest.java index 667c73fbf5..1d8b52476d 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ClassificationRestApiTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/ClassificationRestApiTest.java @@ -86,8 +86,8 @@ public class ClassificationRestApiTest extends BaseRMWebScriptTestCase /** Constants for classification request body parameters */ private static final String ID = "id"; - private static final String CLASSIFICATION_LEVEL_ID1_VALUE = "level1"; - private static final String CLASSIFICATION_LEVEL_ID2_VALUE = "level2"; + private static final String TOP_SECRET_ID = "TS"; + private static final String SECRET_ID = "S"; private static final String CLASSIFIED_BY1 = generate(); private static final String CLASSIFIED_BY2 = generate(); private static final String CLASSIFICATION_AGENCY1 = generate(); @@ -123,7 +123,7 @@ public class ClassificationRestApiTest extends BaseRMWebScriptTestCase // Classify content JSONObject requestBody = new JSONObject(); - requestBody.put(CLASSIFICATION_LEVEL_ID, CLASSIFICATION_LEVEL_ID1_VALUE); + requestBody.put(CLASSIFICATION_LEVEL_ID, TOP_SECRET_ID); requestBody.put(CLASSIFIED_BY, CLASSIFIED_BY1); requestBody.put(CLASSIFICATION_AGENCY, CLASSIFICATION_AGENCY1); JSONArray classificationReasons = new JSONArray(); @@ -142,7 +142,7 @@ public class ClassificationRestApiTest extends BaseRMWebScriptTestCase assertNotNull(responseAsJson); assertTrue(responseAsJson.getBoolean(RESPONSE_SUCCESS)); - assertEquals(CLASSIFICATION_LEVEL_ID1_VALUE, nodeService.getProperty(record, PROP_CURRENT_CLASSIFICATION)); + assertEquals(TOP_SECRET_ID, nodeService.getProperty(record, PROP_CURRENT_CLASSIFICATION)); assertEquals(CLASSIFIED_BY1, nodeService.getProperty(record, PROP_CLASSIFIED_BY)); assertEquals(CLASSIFICATION_AGENCY1, nodeService.getProperty(record, PROP_CLASSIFICATION_AGENCY)); List classificationReasonsList = (List) nodeService.getProperty(record, PROP_CLASSIFICATION_REASONS); @@ -160,7 +160,7 @@ public class ClassificationRestApiTest extends BaseRMWebScriptTestCase // Edit classified content requestBody = new JSONObject(); - requestBody.put(CLASSIFICATION_LEVEL_ID, CLASSIFICATION_LEVEL_ID2_VALUE); + requestBody.put(CLASSIFICATION_LEVEL_ID, SECRET_ID); requestBody.put(CLASSIFIED_BY, CLASSIFIED_BY2); requestBody.put(CLASSIFICATION_AGENCY, CLASSIFICATION_AGENCY2); classificationReasons = new JSONArray(); @@ -174,7 +174,7 @@ public class ClassificationRestApiTest extends BaseRMWebScriptTestCase assertNotNull(responseAsJson); assertTrue(responseAsJson.getBoolean(RESPONSE_SUCCESS)); - assertEquals(CLASSIFICATION_LEVEL_ID2_VALUE, nodeService.getProperty(record, PROP_CURRENT_CLASSIFICATION)); + assertEquals(SECRET_ID, nodeService.getProperty(record, PROP_CURRENT_CLASSIFICATION)); assertEquals(CLASSIFIED_BY2, nodeService.getProperty(record, PROP_CLASSIFIED_BY)); assertEquals(CLASSIFICATION_AGENCY2, nodeService.getProperty(record, PROP_CLASSIFICATION_AGENCY)); List editedClassificationReasonsList = (List) nodeService.getProperty(record, PROP_CLASSIFICATION_REASONS); @@ -206,7 +206,7 @@ public class ClassificationRestApiTest extends BaseRMWebScriptTestCase // Classify content JSONObject requestBody = new JSONObject(); - requestBody.put(CLASSIFICATION_LEVEL_ID, CLASSIFICATION_LEVEL_ID1_VALUE); + requestBody.put(CLASSIFICATION_LEVEL_ID, TOP_SECRET_ID); requestBody.put(CLASSIFIED_BY, CLASSIFIED_BY1); requestBody.put(CLASSIFICATION_AGENCY, CLASSIFICATION_AGENCY1); JSONArray classificationReasons = new JSONArray(); diff --git a/rm-server/test/resources/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json b/rm-server/test/resources/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json deleted file mode 100644 index 8ac1161a1e..0000000000 --- a/rm-server/test/resources/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json +++ /dev/null @@ -1,13 +0,0 @@ -[{ - "name" : "level1", - "displayLabel" : "rm.classification.level1" - },{ - "name" : "level2", - "displayLabel" : "rm.classification.level2" - },{ - "name" : "level3", - "displayLabel" : "rm.classification.level3" - },{ - "name" : "level4", - "displayLabel" : "rm.classification.level4" -}] \ No newline at end of file diff --git a/rm-server/test/resources/test.properties b/rm-server/test/resources/test.properties index 3238e2533a..c988e45267 100644 --- a/rm-server/test/resources/test.properties +++ b/rm-server/test/resources/test.properties @@ -1,5 +1 @@ test.company=Alfresco - -#Classification levels -rm.classification.level1=Level 1 -rm.classification.level4=Level 4 \ No newline at end of file diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAOUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAOUnitTest.java index 1745c8a63b..2893bd02bf 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAOUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceDAOUnitTest.java @@ -18,8 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.classification; -import static org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeServiceImplUnitTest.asLevelList; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -36,34 +34,6 @@ import org.junit.Test; */ public class ClassificationServiceDAOUnitTest { - private static final List DEFAULT_CLASSIFICATION_LEVELS = asLevelList("level1", "l1", - "level2", "l2", - "level3", "l3", - "level4", "l4"); - - @Test public void getConfiguredLevels_readingDefaultConfigurationShouldWork() - { - ClassificationServiceDAO c = new ClassificationServiceDAO(); - c.setLevelConfigLocation("/alfresco/module/org_alfresco_module_rm/classification/rm-classification-levels.json"); - List config = c.getConfiguredValues(ClassificationLevel.class); - assertEquals(DEFAULT_CLASSIFICATION_LEVELS, config); - } - - @Test public void getConfiguredLevels_readingMissingConfigurationShouldProduceEmptyConfig() throws Exception - { - ClassificationServiceDAO c = new ClassificationServiceDAO(); - c.setLevelConfigLocation("/no/such/resource"); - assertTrue(c.getConfiguredValues(ClassificationLevel.class).isEmpty()); - } - - @Test (expected = MalformedConfiguration.class) - public void getConfiguredLevels_readingMalformedConfigurationShouldFail() - { - ClassificationServiceDAO c = new ClassificationServiceDAO(); - c.setLevelConfigLocation("/alfresco/classification/rm-classification-levels-malformed.json"); - c.getConfiguredValues(ClassificationLevel.class); - } - @Test public void getConfiguredReasons_readingDefaultConfigurationShouldWork() { ClassificationServiceDAO c = new ClassificationServiceDAO(); @@ -83,7 +53,7 @@ public class ClassificationServiceDAOUnitTest public void getConfiguredReasons_readingMalformedConfigurationShouldFail() { ClassificationServiceDAO c = new ClassificationServiceDAO(); - c.setReasonConfigLocation("/alfresco/classification/rm-classification-levels-malformed.json"); + c.setReasonConfigLocation("/alfresco/classification/rm-classification-reasons-malformed.json"); c.getConfiguredValues(ClassificationReason.class); } } diff --git a/rm-server/unit-test/resources/alfresco/classification/rm-classification-levels-malformed.json b/rm-server/unit-test/resources/alfresco/classification/rm-classification-levels-malformed.json deleted file mode 100644 index b6d2f6b5a1..0000000000 --- a/rm-server/unit-test/resources/alfresco/classification/rm-classification-levels-malformed.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "name" : "TopSecret", - "displayLabel" : "Top Secret" - }, { { -] diff --git a/rm-server/unit-test/resources/alfresco/classification/rm-classification-reasons-malformed.json b/rm-server/unit-test/resources/alfresco/classification/rm-classification-reasons-malformed.json new file mode 100644 index 0000000000..f8d84fecc2 --- /dev/null +++ b/rm-server/unit-test/resources/alfresco/classification/rm-classification-reasons-malformed.json @@ -0,0 +1,6 @@ +[ + { + "id" : "1.4(a)", + "displayLabel" : "rm.classification-reason.14a" + }, { { +]