mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-2061 (Add classification properties to document details view)
RM-2062 (Add classification properties to record details view) +review RM-29 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@102759 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -78,6 +78,8 @@
|
|||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevels=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevels=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasons=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasons=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.classifyContent=ACL_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.classifyContent=ACL_ALLOW
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationLevelById=ACL_ALLOW
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.getClassificationReasonById=ACL_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.*=ACL_DENY
|
org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService.*=ACL_DENY
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
<!-- Authentication Helper -->
|
<!-- Authentication Helper -->
|
||||||
<bean name="rm.authenticationUtil" class="org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil"/>
|
<bean name="rm.authenticationUtil" class="org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil"/>
|
||||||
|
|
||||||
<!-- Transactional Resouce Helper -->
|
<!-- Transactional Resouce Helper -->
|
||||||
<bean name="rm.transactionalResourceHelper" class="org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper" />
|
<bean name="rm.transactionalResourceHelper" class="org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper" />
|
||||||
|
|
||||||
<!-- Alfresco Transaction Support Helper -->
|
<!-- Alfresco Transaction Support Helper -->
|
||||||
<bean name="rm.alfrescoTransactionSupport" class="org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport" />
|
<bean name="rm.alfrescoTransactionSupport" class="org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport" />
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Import RM model -->
|
<!-- Import RM model -->
|
||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-model-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-model-context.xml"/>
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
<!-- Import the deprecated beans -->
|
<!-- Import the deprecated beans -->
|
||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml"/>
|
||||||
|
|
||||||
<!-- Event types -->
|
<!-- Event types -->
|
||||||
<bean id="rmEventType" init-method="init" abstract="true">
|
<bean id="rmEventType" init-method="init" abstract="true">
|
||||||
<property name="recordsManagementEventService" ref="recordsManagementEventService"/>
|
<property name="recordsManagementEventService" ref="recordsManagementEventService"/>
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
<property name="dispositionService" ref="dispositionService"/>
|
<property name="dispositionService" ref="dispositionService"/>
|
||||||
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
|
<property name="recordsManagementActionService" ref="recordsManagementActionService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="rmEventType.versioned" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferenceCreateEventType" parent="rmEventType">
|
<bean id="rmEventType.versioned" class="org.alfresco.module.org_alfresco_module_rm.event.OnReferenceCreateEventType" parent="rmEventType">
|
||||||
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}versions"/>
|
<property name="referenceName" value="{http://www.alfresco.org/model/rmcustom/1.0}versions"/>
|
||||||
<property name="dispositionService" ref="dispositionService"/>
|
<property name="dispositionService" ref="dispositionService"/>
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry"/>
|
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry"/>
|
||||||
<property name="notificationHelper" ref="recordsManagementNotificationHelper"/>
|
<property name="notificationHelper" ref="recordsManagementNotificationHelper"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Job context -->
|
<!-- Job context -->
|
||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-job-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-job-context.xml"/>
|
||||||
|
|
||||||
@@ -209,6 +209,7 @@
|
|||||||
<property name="filterRegistry" ref="nodeFilterRegistry" />
|
<property name="filterRegistry" ref="nodeFilterRegistry" />
|
||||||
<property name="dispositionService" ref="dispositionService"/>
|
<property name="dispositionService" ref="dispositionService"/>
|
||||||
<property name="filePlanService" ref="FilePlanService" />
|
<property name="filePlanService" ref="FilePlanService" />
|
||||||
|
<property name="classificationService" ref="ClassificationService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="rmTypeFormFilter"
|
<bean id="rmTypeFormFilter"
|
||||||
|
@@ -53,7 +53,7 @@ public interface ClassificationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Classify a piece of content.
|
* Classify a piece of content.
|
||||||
*
|
*
|
||||||
* @param classificationLevelId The security clearance needed to access the content.
|
* @param classificationLevelId The security clearance needed to access the content.
|
||||||
* @param classificationAuthority The name of the authority responsible for the classification of this content.
|
* @param classificationAuthority The name of the authority responsible for the classification of this content.
|
||||||
* @param classificationReasonIds A non-empty set of ids of reasons for classifying the content in this way.
|
* @param classificationReasonIds A non-empty set of ids of reasons for classifying the content in this way.
|
||||||
@@ -66,4 +66,22 @@ public interface ClassificationService
|
|||||||
void classifyContent(String classificationLevelId, String classificationAuthority,
|
void classifyContent(String classificationLevelId, String classificationAuthority,
|
||||||
Set<String> classificationReasonIds, NodeRef content) throws LevelIdNotFound, ReasonIdNotFound,
|
Set<String> classificationReasonIds, NodeRef content) throws LevelIdNotFound, ReasonIdNotFound,
|
||||||
InvalidNodeRefException, InvalidNode;
|
InvalidNodeRefException, InvalidNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the classification level for the given classification level id
|
||||||
|
*
|
||||||
|
* @param classificationLevelId {@link String} The classification level id for which the classification level should be retrieved.
|
||||||
|
* @return The classification level for the given classification level id
|
||||||
|
* @throws LevelIdNotFound If the given classification level id is not found
|
||||||
|
*/
|
||||||
|
ClassificationLevel getClassificationLevelById(String classificationLevelId) throws LevelIdNotFound;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the classification reason for the given classification reason id
|
||||||
|
*
|
||||||
|
* @param classificationReasonId {@link String} The classification reason id for which the classification reason should be retrieved.
|
||||||
|
* @return The classification reason for the given classification reason id
|
||||||
|
* @throws ReasonIdNotFound If the given classification reason id is not found
|
||||||
|
*/
|
||||||
|
ClassificationReason getClassificationReasonById(String classificationReasonId) throws ReasonIdNotFound;
|
||||||
}
|
}
|
||||||
|
@@ -238,7 +238,8 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
|
||||||
checkClassificationLevelId(classificationLevelId);
|
// Check the classification level id - an exception will be thrown if the id cannot be found
|
||||||
|
getClassificationLevelById(classificationLevelId);
|
||||||
|
|
||||||
// Initial classification id
|
// Initial classification id
|
||||||
if (nodeService.getProperty(content, PROP_INITIAL_CLASSIFICATION) == null)
|
if (nodeService.getProperty(content, PROP_INITIAL_CLASSIFICATION) == null)
|
||||||
@@ -256,7 +257,8 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
|
|||||||
HashSet<String> classificationReasons = new HashSet<>();
|
HashSet<String> classificationReasons = new HashSet<>();
|
||||||
for (String classificationReasonId : classificationReasonIds)
|
for (String classificationReasonId : classificationReasonIds)
|
||||||
{
|
{
|
||||||
checkClassificationReasonId(classificationReasonId);
|
// Check the classification reason id - an exception will be thrown if the id cannot be found
|
||||||
|
getClassificationReasonById(classificationReasonId);
|
||||||
classificationReasons.add(classificationReasonId);
|
classificationReasons.add(classificationReasonId);
|
||||||
}
|
}
|
||||||
properties.put(PROP_CLASSIFICATION_REASONS, classificationReasons);
|
properties.put(PROP_CLASSIFICATION_REASONS, classificationReasons);
|
||||||
@@ -266,24 +268,22 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to check if a classification level with the given id exists
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService#getClassificationLevelById(java.lang.String)
|
||||||
*
|
|
||||||
* @param classificationLevelId {@link String} The id of the classification level
|
|
||||||
* @throws {@link LevelIdNotFound} throws an exception if a classification level with given id does not exist
|
|
||||||
*/
|
*/
|
||||||
private void checkClassificationLevelId(String classificationLevelId) throws LevelIdNotFound
|
@Override
|
||||||
|
public ClassificationLevel getClassificationLevelById(String classificationLevelId) throws LevelIdNotFound
|
||||||
{
|
{
|
||||||
levelManager.findLevelById(classificationLevelId);
|
checkNotBlank("classificationLevelId", classificationLevelId);
|
||||||
|
return levelManager.findLevelById(classificationLevelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to check if a classification reason with the given id exists
|
* @see org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService#getClassificationReasonById(java.lang.String)
|
||||||
*
|
|
||||||
* @param classificationReasonId {@String} The id of the classification reason
|
|
||||||
* @throws {@link ReasonIdNotFound} throws an exception if a classification reason with the given id does not exist
|
|
||||||
*/
|
*/
|
||||||
private void checkClassificationReasonId(String classificationReasonId) throws ReasonIdNotFound
|
@Override
|
||||||
|
public ClassificationReason getClassificationReasonById(String classificationReasonId) throws ReasonIdNotFound
|
||||||
{
|
{
|
||||||
reasonManager.findReasonById(classificationReasonId);
|
checkNotBlank("classificationReasonId", classificationReasonId);
|
||||||
|
return reasonManager.findReasonById(classificationReasonId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,13 +19,17 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.forms;
|
package org.alfresco.module.org_alfresco_module_rm.forms;
|
||||||
|
|
||||||
import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem;
|
import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem;
|
||||||
|
import static org.apache.commons.lang.StringUtils.isNotBlank;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.ImapModel;
|
import org.alfresco.model.ImapModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
|
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl;
|
||||||
@@ -70,6 +74,8 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
protected static final String TRANSIENT_DECLARED = "rmDeclared";
|
protected static final String TRANSIENT_DECLARED = "rmDeclared";
|
||||||
protected static final String TRANSIENT_CATEGORY_ID = "rmCategoryIdentifier";
|
protected static final String TRANSIENT_CATEGORY_ID = "rmCategoryIdentifier";
|
||||||
protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions";
|
protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions";
|
||||||
|
protected static final String TRANSIENT_CURRENT_CLASSIFICATION = "clfCurrentClassification";
|
||||||
|
protected static final String TRANSIENT_INITIAL_CLASSIFICATION = "clfInitialClassification";
|
||||||
|
|
||||||
/** Disposition service */
|
/** Disposition service */
|
||||||
private DispositionService dispositionService;
|
private DispositionService dispositionService;
|
||||||
@@ -77,6 +83,9 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
/** File Plan Service */
|
/** File Plan Service */
|
||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
|
|
||||||
|
/** Classification Service */
|
||||||
|
private ClassificationService classificationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the disposition service
|
* Returns the disposition service
|
||||||
*
|
*
|
||||||
@@ -97,6 +106,16 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
return this.filePlanService;
|
return this.filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the classification service
|
||||||
|
*
|
||||||
|
* @return Classification service
|
||||||
|
*/
|
||||||
|
protected ClassificationService getClassificationService()
|
||||||
|
{
|
||||||
|
return this.classificationService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the disposition service
|
* Sets the disposition service
|
||||||
*
|
*
|
||||||
@@ -115,6 +134,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
this.filePlanService = filePlanService;
|
this.filePlanService = filePlanService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param classificationService classification service
|
||||||
|
*/
|
||||||
|
public void setClassificationService(ClassificationService classificationService)
|
||||||
|
{
|
||||||
|
this.classificationService = classificationService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map)
|
* @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map)
|
||||||
*/
|
*/
|
||||||
@@ -171,7 +198,23 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
|||||||
protectRecordLevelDispositionPropertyField(form);
|
protectRecordLevelDispositionPropertyField(form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_CONTENT))
|
||||||
|
{
|
||||||
|
String initialClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_INITIAL_CLASSIFICATION);
|
||||||
|
if (isNotBlank(initialClassificationId))
|
||||||
|
{
|
||||||
|
String initialClassificationDisplayLabel = getClassificationService().getClassificationLevelById(initialClassificationId).getDisplayLabel();
|
||||||
|
addTransientPropertyField(form, TRANSIENT_INITIAL_CLASSIFICATION, DataTypeDefinition.TEXT, initialClassificationDisplayLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
String currentClassificationId = (String) nodeService.getProperty(nodeRef, ClassifiedContentModel.PROP_CURRENT_CLASSIFICATION);
|
||||||
|
if (isNotBlank(currentClassificationId))
|
||||||
|
{
|
||||||
|
String currentClassificationDisplayLabel = getClassificationService().getClassificationLevelById(currentClassificationId).getDisplayLabel();
|
||||||
|
addTransientPropertyField(form, TRANSIENT_CURRENT_CLASSIFICATION, DataTypeDefinition.TEXT, currentClassificationDisplayLabel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Matchers.anyString;
|
import static org.mockito.Matchers.anyString;
|
||||||
import static org.mockito.Matchers.eq;
|
import static org.mockito.Matchers.eq;
|
||||||
|
import static org.mockito.Mockito.doThrow;
|
||||||
import static org.mockito.Mockito.never;
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -36,11 +37,11 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.InvalidNode;
|
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.ClassificationServiceException.MissingConfiguration;
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.MissingConfiguration;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.ReasonIdNotFound;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
|
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.ExceptionUtils;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
|
||||||
@@ -61,6 +62,8 @@ import org.mockito.InjectMocks;
|
|||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link ClassificationServiceImpl}.
|
* Unit tests for {@link ClassificationServiceImpl}.
|
||||||
*
|
*
|
||||||
@@ -324,4 +327,40 @@ public class ClassificationServiceImplUnitTest
|
|||||||
classificationServiceImpl.classifyContent("levelId1", "classificationAuthority",
|
classificationServiceImpl.classifyContent("levelId1", "classificationAuthority",
|
||||||
Sets.newHashSet("reasonId1", "reasonId2"), classifiedContent);
|
Sets.newHashSet("reasonId1", "reasonId2"), classifiedContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getClassificationLevelById()
|
||||||
|
{
|
||||||
|
String levelId = "classificationLevelId1";
|
||||||
|
ClassificationLevel classificationLevel = new ClassificationLevel(levelId, "displayLabelKey");
|
||||||
|
when(mockLevelManager.findLevelById(levelId)).thenReturn(classificationLevel);
|
||||||
|
ClassificationLevel classificationLevelById = classificationServiceImpl.getClassificationLevelById(levelId);
|
||||||
|
assertEquals(classificationLevel, classificationLevelById);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = LevelIdNotFound.class)
|
||||||
|
public void getClassificationLevelById_nonExisting()
|
||||||
|
{
|
||||||
|
String classificationLevelId = "aRandomId";
|
||||||
|
doThrow(new LevelIdNotFound("Id not found!")).when(mockLevelManager).findLevelById(classificationLevelId);
|
||||||
|
classificationServiceImpl.getClassificationLevelById(classificationLevelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getClassificationReasonById()
|
||||||
|
{
|
||||||
|
String reasonId = "classificationReasonId1";
|
||||||
|
ClassificationReason classificationReason = new ClassificationReason(reasonId, "displayLabelKey");
|
||||||
|
when(mockReasonManager.findReasonById(reasonId)).thenReturn(classificationReason);
|
||||||
|
ClassificationReason classificationReasonById = classificationServiceImpl.getClassificationReasonById(reasonId);
|
||||||
|
assertEquals(classificationReason, classificationReasonById);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = ReasonIdNotFound.class)
|
||||||
|
public void getClassificationReasonById_nonExisting()
|
||||||
|
{
|
||||||
|
String classificationReasonId = "aRandomId";
|
||||||
|
doThrow(new ReasonIdNotFound("Id not found!")).when(mockReasonManager).findReasonById(classificationReasonId);
|
||||||
|
classificationServiceImpl.getClassificationReasonById(classificationReasonId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user