Additional checkin related to RM-2291. Change the unit test so that it validates only the levels configured by the user (in .json file) and excludes the built-in special case of Unclassified.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@106141 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2015-06-15 13:24:16 +00:00
parent 623ac8eff8
commit 1a3e5293ff

View File

@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.classification; package org.alfresco.module.org_alfresco_module_rm.classification;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static org.apache.commons.collections.ListUtils.union;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
@@ -57,10 +58,13 @@ import org.mockito.MockitoAnnotations;
*/ */
public class ClassificationServiceBootstrapUnitTest public class ClassificationServiceBootstrapUnitTest
{ {
private static final List<ClassificationLevel> DEFAULT_CLASSIFICATION_LEVELS = asLevelList("TS", "rm.classification.topSecret", private static final List<ClassificationLevel> DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS =
asLevelList("TS", "rm.classification.topSecret",
"S", "rm.classification.secret", "S", "rm.classification.secret",
"C", "rm.classification.confidential", "C", "rm.classification.confidential");
"U", "rm.classification.unclassified"); private static final List<ClassificationLevel> DEFAULT_CLASSIFICATION_LEVELS =
union(DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS,
asLevelList("U", "rm.classification.unclassified"));
private static final List<ClassificationLevel> ALT_CLASSIFICATION_LEVELS = asLevelList("B", "Board", private static final List<ClassificationLevel> ALT_CLASSIFICATION_LEVELS = asLevelList("B", "Board",
"EM", "ExecutiveManagement", "EM", "ExecutiveManagement",
"E", "Employee", "E", "Employee",
@@ -115,12 +119,12 @@ public class ClassificationServiceBootstrapUnitTest
@Test public void defaultLevelsConfigurationVanillaSystem() @Test public void defaultLevelsConfigurationVanillaSystem()
{ {
when(mockClassificationServiceDAO.getConfiguredLevels()).thenReturn(DEFAULT_CLASSIFICATION_LEVELS); when(mockClassificationServiceDAO.getConfiguredLevels()).thenReturn(DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS);
when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn(null); when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn(null);
classificationServiceBootstrap.initConfiguredClassificationLevels(); classificationServiceBootstrap.initConfiguredClassificationLevels();
verify(mockAttributeService).setAttribute(eq((Serializable) DEFAULT_CLASSIFICATION_LEVELS), verify(mockAttributeService).setAttribute(eq((Serializable) DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS),
anyString(), anyString(), anyString()); anyString(), anyString(), anyString());
} }