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
This commit is contained in:
Tom Page
2015-08-12 07:23:38 +00:00
parent 0ba5ed3878
commit 8bdb8f28c9

View File

@@ -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.
* <p>
* <a href="https://issues.alfresco.com/jira/browse/RM-2484">RM-2484</a><pre>
* 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.
* </pre>
*/
@Test public void addClassificationSchemeEntity()
{
List<ClassificationLevel> initialList = asLevelList("A", "Admin", "B", "Board Member");
List<ClassificationLevel> correctedList = asLevelList("A", "Admin", "B", "Board Member", "C", "Common Employee");
when(mockClassificationServiceDAO.<ClassificationLevel>getConfiguredValues(ClassificationLevel.class)).thenReturn(correctedList);
when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn((Serializable) initialList);
List<ClassificationLevel> 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.
* <p>
* <a href="https://issues.alfresco.com/jira/browse/RM-2486">RM-2486</a><pre>
* 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.
* </pre>
*/
@Test public void deleteUnusedClassificationSchemeEntity()
{
List<ClassificationLevel> initialList = asLevelList("A", "Admin", "B", "Board Member", "T", "Typo - Oops!", "C", "Common Employee");
List<ClassificationLevel> correctedList = asLevelList("A", "Admin", "B", "Board Member", "C", "Common Employee");
when(mockClassificationServiceDAO.<ClassificationLevel>getConfiguredValues(ClassificationLevel.class)).thenReturn(correctedList);
when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn((Serializable) initialList);
List<ClassificationLevel> entities = classificationServiceBootstrap.getConfiguredSchemeEntities(ClassificationLevel.class, LEVELS_KEY, classificationLevelValidator);
assertEquals(correctedList, entities);
}
@Test public void pristineSystemShouldBootstrapReasonsConfiguration()
{
// There are no classification reasons stored in the AttributeService.