Rename ClassificationService to ClassificationSchemeService.

Also rename ClassificationServiceException to ClassificationException.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@105317 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tom Page
2015-06-02 10:20:37 +00:00
parent 81dbb54471
commit ae171d5008
36 changed files with 160 additions and 161 deletions

View File

@@ -42,7 +42,7 @@ public class ClassificationLevelConstraintUnitTest
private static final List<ClassificationLevel> DEFAULT_LEVELS = Arrays.asList(LEVEL_ONE, LEVEL_TWO);
@InjectMocks ClassificationLevelConstraint classificationLevelConstraint;
@Mock ClassificationService mockClassificationService;
@Mock ClassificationSchemeService mockClassificationSchemeService;
@Before
public void setUp()
@@ -50,7 +50,7 @@ public class ClassificationLevelConstraintUnitTest
MockitoAnnotations.initMocks(this);
// Currently this list of levels suffices for all the tests.
doReturn(DEFAULT_LEVELS).when(mockClassificationService).getClassificationLevels();
doReturn(DEFAULT_LEVELS).when(mockClassificationSchemeService).getClassificationLevels();
}
/** Check that evaluateSingleValue throws no exceptions when an id is found. */

View File

@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.junit.Before;
import org.junit.Test;
@@ -63,14 +63,14 @@ public class ClassificationLevelManagerUnitTest
ClassificationLevel actual = classificationLevelManager.getMostSecureLevel();
assertEquals(LEVEL_1, actual);
}
/**
* Given that I have created the classification level manager with a list of classification levels
* Then the unclassified level is available
*/
@Test public void getUnclassifiedLevel()
{
assertEquals(LEVELS.size() + 1, classificationLevelManager.getClassificationLevels().size());
assertEquals(ClassificationLevelManager.UNCLASSIFIED, classificationLevelManager.findLevelById(ClassificationLevelManager.UNCLASSIFIED_ID));
}
assertEquals(LEVELS.size() + 1, classificationLevelManager.getClassificationLevels().size());
assertEquals(ClassificationLevelManager.UNCLASSIFIED, classificationLevelManager.findLevelById(ClassificationLevelManager.UNCLASSIFIED_ID));
}
}

View File

@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
import org.junit.Before;
import org.junit.Test;

View File

@@ -27,8 +27,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.ReasonIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeService;
@@ -42,12 +42,12 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
/**
* Unit tests for {@link ClassificationServiceImpl}.
* Unit tests for {@link ClassificationSchemeServiceImpl}.
*
* @author Neil Mc Erlean
* @since 3.0
*/
public class ClassificationServiceImplUnitTest
public class ClassificationSchemeServiceImplUnitTest
{
private static final List<ClassificationLevel> DEFAULT_CLASSIFICATION_LEVELS = asLevelList("Top Secret", "rm.classification.topSecret",
"Secret", "rm.classification.secret",
@@ -78,7 +78,7 @@ public class ClassificationServiceImplUnitTest
return levels;
}
@InjectMocks private ClassificationServiceImpl classificationServiceImpl;
@InjectMocks private ClassificationSchemeServiceImpl classificationSchemeServiceImpl;
@Mock private NodeService mockNodeService;
@Mock private DictionaryService mockDictionaryService;
@@ -99,7 +99,7 @@ public class ClassificationServiceImplUnitTest
{
ClassificationLevel targetLevel = new ClassificationLevel("Secret", "rm.classification.secret");
List<ClassificationLevel> actual = classificationServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
List<ClassificationLevel> actual = classificationSchemeServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
List<ClassificationLevel> expected = asLevelList("Secret", "rm.classification.secret",
"Confidential", "rm.classification.confidential",
@@ -116,7 +116,7 @@ public class ClassificationServiceImplUnitTest
{
ClassificationLevel targetLevel = new ClassificationLevel("UnrecognisedLevel", "rm.classification.IMadeThisUp");
List<ClassificationLevel> actual = classificationServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
List<ClassificationLevel> actual = classificationSchemeServiceImpl.restrictList(DEFAULT_CLASSIFICATION_LEVELS, targetLevel);
assertEquals("Expected an empty list when the target level is not found.", 0, actual.size());
}
@@ -127,7 +127,7 @@ public class ClassificationServiceImplUnitTest
String levelId = "classificationLevelId1";
ClassificationLevel classificationLevel = new ClassificationLevel(levelId, "displayLabelKey");
when(mockLevelManager.findLevelById(levelId)).thenReturn(classificationLevel);
ClassificationLevel classificationLevelById = classificationServiceImpl.getClassificationLevelById(levelId);
ClassificationLevel classificationLevelById = classificationSchemeServiceImpl.getClassificationLevelById(levelId);
assertEquals(classificationLevel, classificationLevelById);
}
@@ -136,7 +136,7 @@ public class ClassificationServiceImplUnitTest
{
String classificationLevelId = "aRandomId";
doThrow(new LevelIdNotFound("Id not found!")).when(mockLevelManager).findLevelById(classificationLevelId);
classificationServiceImpl.getClassificationLevelById(classificationLevelId);
classificationSchemeServiceImpl.getClassificationLevelById(classificationLevelId);
}
@Test
@@ -145,7 +145,7 @@ public class ClassificationServiceImplUnitTest
String reasonId = "classificationReasonId1";
ClassificationReason classificationReason = new ClassificationReason(reasonId, "displayLabelKey");
when(mockReasonManager.findReasonById(reasonId)).thenReturn(classificationReason);
ClassificationReason classificationReasonById = classificationServiceImpl.getClassificationReasonById(reasonId);
ClassificationReason classificationReasonById = classificationSchemeServiceImpl.getClassificationReasonById(reasonId);
assertEquals(classificationReason, classificationReasonById);
}
@@ -154,6 +154,6 @@ public class ClassificationServiceImplUnitTest
{
String classificationReasonId = "aRandomId";
doThrow(new ReasonIdNotFound("Id not found!")).when(mockReasonManager).findReasonById(classificationReasonId);
classificationServiceImpl.getClassificationReasonById(classificationReasonId);
classificationSchemeServiceImpl.getClassificationReasonById(classificationReasonId);
}
}

View File

@@ -35,7 +35,7 @@ import java.util.List;
import java.util.stream.Stream;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.MissingConfiguration;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.MissingConfiguration;
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.service.cmr.attributes.AttributeService;

View File

@@ -18,14 +18,14 @@
*/
package org.alfresco.module.org_alfresco_module_rm.classification;
import static org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceImplUnitTest.asLevelList;
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;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.MalformedConfiguration;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.MalformedConfiguration;
import org.junit.Test;
/**

View File

@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.junit.Before;
import org.junit.Test;

View File

@@ -42,8 +42,8 @@ import com.google.common.collect.Sets;
import org.alfresco.model.ContentModel;
import org.alfresco.model.QuickShareModel;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.InvalidNode;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.InvalidNode;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;

View File

@@ -31,7 +31,7 @@ import static org.mockito.Mockito.when;
import java.util.List;
import com.google.common.collect.ImmutableList;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -62,7 +62,7 @@ public class SecurityClearanceServiceImplUnitTest
@Mock private DictionaryService mockDictionaryService;
@Mock private NodeService mockNodeService;
@Mock private PersonService mockPersonService;
@Mock private ClassificationService mockClassificationService;
@Mock private ClassificationSchemeService mockClassificationSchemeService;
@Mock private ClearanceLevelManager mockClearanceLevelManager;
@Mock private ClassificationLevelComparator mockClassificationLevelComparator;
@@ -95,7 +95,7 @@ public class SecurityClearanceServiceImplUnitTest
{
final PersonInfo user1 = createMockPerson("user1", "User", "One", null);
MockAuthenticationUtilHelper.setup(mockAuthenticationUtil, user1.getUserName());
when(mockClassificationService.getUnclassifiedClassificationLevel())
when(mockClassificationSchemeService.getUnclassifiedClassificationLevel())
.thenReturn(ClassificationLevelManager.UNCLASSIFIED);
when(mockClearanceLevelManager.findLevelByClassificationLevelId(ClassificationLevelManager.UNCLASSIFIED_ID))
.thenReturn(ClearanceLevelManager.NO_CLEARANCE);

View File

@@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest;
import org.json.JSONObject;
import org.junit.Test;
@@ -53,7 +53,7 @@ public class ClassificationLevelsGetUnitTest extends BaseWebScriptUnitTest
/** ClassificationLevelsGet webscript instance */
private @Spy @InjectMocks ClassificationLevelsGet webScript;
private @Mock ClassificationService mockClassificationService;
private @Mock ClassificationSchemeService mockClassificationSchemeService;
private List<ClassificationLevel> classificationLevels;
@@ -83,7 +83,7 @@ public class ClassificationLevelsGetUnitTest extends BaseWebScriptUnitTest
new ClassificationLevel("id2", "labelKey2"));
// setup interactions
doReturn(classificationLevels).when(mockClassificationService).getClassificationLevels();
doReturn(classificationLevels).when(mockClassificationSchemeService).getClassificationLevels();
// execute web script
JSONObject json = executeJSONWebScript(new HashMap<String, String>());

View File

@@ -29,7 +29,7 @@ import java.util.List;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationReason;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationSchemeService;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest;
import org.json.JSONObject;
import org.junit.Test;
@@ -53,7 +53,7 @@ public class ReasonsGetUnitTest extends BaseWebScriptUnitTest
/** ReasonsGet webscript instance */
private @Spy @InjectMocks ReasonsGet webScript;
private @Mock ClassificationService mockClassificationService;
private @Mock ClassificationSchemeService mockClassificationSchemeService;
private List<ClassificationReason> reasonsList;
@@ -83,7 +83,7 @@ public class ReasonsGetUnitTest extends BaseWebScriptUnitTest
reasonsList = Arrays.asList(reasonA, reasonB);
// setup interactions
doReturn(reasonsList).when(mockClassificationService).getClassificationReasons();
doReturn(reasonsList).when(mockClassificationSchemeService).getClassificationReasons();
// setup web script parameters
Map<String, String> parameters = new HashMap<String, String>();

View File

@@ -10,7 +10,7 @@ import java.util.Map;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationLevel;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException;
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.classification.SecurityClearanceService;
@@ -114,7 +114,7 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId))
.thenThrow(new ClassificationServiceException.LevelIdNotFound(clearanceId));
.thenThrow(new ClassificationException.LevelIdNotFound(clearanceId));
// Execute web script - this should throw the expected exception.
executeJSONWebScript(parameters);
@@ -135,7 +135,7 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId)).thenThrow(
new ClassificationServiceException.LevelIdNotFound(clearanceId));
new ClassificationException.LevelIdNotFound(clearanceId));
try
{