diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java index c4c4c0398c..f75da87eaa 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java @@ -160,6 +160,53 @@ public class ClassificationServiceBootstrapUnitTest implements ClassifiedContent classificationServiceBootstrap.getConfiguredSchemeEntities(ClassificationLevel.class, LEVELS_KEY, classificationLevelValidator); } + /** + * Check that we can add a classification entity after the system has been bootstrapped for the first time. + *

+ * RM-2484

+     * Given a classification scheme has been installed
+     * When I add new entities into the classification scheme configuration files
+     * And I restart the server
+     * Then the new entities are installed.
+     * 
+ */ + @Test public void addClassificationSchemeEntity() + { + List initialList = asLevelList("A", "Admin", "B", "Board Member"); + List correctedList = asLevelList("A", "Admin", "B", "Board Member", "C", "Common Employee"); + + when(mockClassificationServiceDAO.getConfiguredValues(ClassificationLevel.class)).thenReturn(correctedList); + when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn((Serializable) initialList); + + List entities = classificationServiceBootstrap.getConfiguredSchemeEntities(ClassificationLevel.class, LEVELS_KEY, classificationLevelValidator); + + assertEquals(correctedList, entities); + } + + /** + * Check that we can remove a classification entity after the system has been bootstrapped for the first time. + *

+ * RM-2486

+     * Given a classification scheme has been installed
+     * And no content is classified using a given entity
+     * When I delete the entity from the classification scheme configuration
+     * And I restart the server
+     * Then the entity is no longer available in the system.
+     * 
+ */ + @Test public void deleteUnusedClassificationSchemeEntity() + { + List initialList = asLevelList("A", "Admin", "B", "Board Member", "T", "Typo - Oops!", "C", "Common Employee"); + List correctedList = asLevelList("A", "Admin", "B", "Board Member", "C", "Common Employee"); + + when(mockClassificationServiceDAO.getConfiguredValues(ClassificationLevel.class)).thenReturn(correctedList); + when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn((Serializable) initialList); + + List entities = classificationServiceBootstrap.getConfiguredSchemeEntities(ClassificationLevel.class, LEVELS_KEY, classificationLevelValidator); + + assertEquals(correctedList, entities); + } + @Test public void pristineSystemShouldBootstrapReasonsConfiguration() { // There are no classification reasons stored in the AttributeService.