From 8bdb8f28c960a31500ff5d8c49fb2e3af1b70c2b Mon Sep 17 00:00:00 2001 From: Tom Page Date: Wed, 12 Aug 2015 07:23:38 +0000 Subject: [PATCH] RM-2484 RM-2486 Tests for adding and deleting entities. +review RM git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@109933 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- ...lassificationServiceBootstrapUnitTest.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) 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.