mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3727 - added unit test for reviewed action and removed notification issued property
This commit is contained in:
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Vital Record
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vital Record
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=Next Review
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=Next Review
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Indicates that a due for review notification has been issued for this record
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Indicates that a due for review notification has been issued for this record
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Scheduled
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Scheduled
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Besonders relevanter Record
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Besonders relevanter Record
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=N\u00e4chste \u00dcberpr\u00fcfung
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=N\u00e4chste \u00dcberpr\u00fcfung
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Gibt an, dass f\u00fcr diesen Record eine Benachrichtigung aufgrund einer f\u00e4lligen \u00dcberpr\u00fcfung ausgegeben wurde.
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Gibt an, dass f\u00fcr diesen Record eine Benachrichtigung aufgrund einer f\u00e4lligen \u00dcberpr\u00fcfung ausgegeben wurde.
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Geplant
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Geplant
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento de archivo vital
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento de archivo vital
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revisi\u00f3n
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revisi\u00f3n
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Indica que se ha emitido una notificaci\u00f3n de pendiente de revisi\u00f3n para este documento de archivo
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Indica que se ha emitido una notificaci\u00f3n de pendiente de revisi\u00f3n para este documento de archivo
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Planificado
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Planificado
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Document d'archives essentiel
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Document d'archives essentiel
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=V\u00e9rification suivante
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=V\u00e9rification suivante
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Indique qu'une notification d'arriv\u00e9e \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification a \u00e9t\u00e9 \u00e9mise pour ce document d'archives
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Indique qu'une notification d'arriv\u00e9e \u00e0 \u00e9ch\u00e9ance pour v\u00e9rification a \u00e9t\u00e9 \u00e9mise pour ce document d'archives
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Planifi\u00e9
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Planifi\u00e9
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Record fondamentale
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Record fondamentale
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=Prossimo esame
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=Prossimo esame
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Indica che \u00e8 stata rilasciata una notifica di esame per questo record
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Indica che \u00e8 stata rilasciata una notifica di esame per questo record
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Programmato
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Programmato
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=\u30d0\u30a4\u30bf\u30eb\u30e
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=\u6b21\u56de\u306e\u30ec\u30d3\u30e5\u30fc
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9650\u304c\u901a\u77e5\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3059
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=\u3053\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u30ec\u30d3\u30e5\u30fc\u671f\u9650\u304c\u901a\u77e5\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u793a\u3059
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u6e08\u307f
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Sv\u00e6rt viktig oppf\u00f8r
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Sv\u00e6rt viktig oppf\u00f8ring
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=Neste gjennomgang
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=Neste gjennomgang
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Planlagt
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Planlagt
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Vitale record
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Vitale record
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=Volgende revisie
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=Volgende revisie
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Geeft aan dat er een revisie-gereedmelding is afgegeven voor deze record
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Geeft aan dat er een revisie-gereedmelding is afgegeven voor deze record
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Gepland
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Gepland
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=Documento arquiv\u00edstico v
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=Documento arquiv\u00edstico vital
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=Pr\u00f3xima revis\u00e3o
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=Pr\u00f3xima revis\u00e3o
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=Indica que foi emitida uma notifica\u00e7\u00e3o de prazo para revis\u00e3o para este documento arquiv\u00edstico
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=Indica que foi emitida uma notifica\u00e7\u00e3o de prazo para revis\u00e3o para este documento arquiv\u00edstico
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=Programado
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=Programado
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=\u041a\u043b\u044e\u0447\u043
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0449\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=\u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043e
|
||||
|
@@ -174,8 +174,6 @@ rma_recordsmanagement.aspect.rma_vitalRecord.title=\u6838\u5fc3\u8bb0\u5f55
|
||||
rma_recordsmanagement.aspect.rma_vitalRecord.decription=\u6838\u5fc3\u8bb0\u5f55
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.title=\u4e0b\u4e2a\u5ba1\u67e5
|
||||
rma_recordsmanagement.property.rma_reviewAsOf.decription=\u4e0b\u4e2a\u5ba1\u67e5
|
||||
rma_recordsmanagement.property.rma_notificationIssued.title=\u6307\u793a\u5df2\u7ecf\u4e3a\u8be5\u8bb0\u5f55\u53d1\u51fa\u5ba1\u67e5\u5230\u671f\u901a\u77e5
|
||||
rma_recordsmanagement.property.rma_notificationIssued.decription=\u6307\u793a\u5df2\u7ecf\u4e3a\u8be5\u8bb0\u5f55\u53d1\u51fa\u5ba1\u67e5\u5230\u671f\u901a\u77e5
|
||||
|
||||
rma_recordsmanagement.aspect.rma_scheduled.title=\u5df2\u8ba1\u5212
|
||||
rma_recordsmanagement.aspect.rma_scheduled.decription=\u5df2\u8ba1\u5212
|
||||
|
@@ -866,13 +866,6 @@
|
||||
<type>d:date</type>
|
||||
<mandatory>false</mandatory>
|
||||
</property>
|
||||
<property name="rma:notificationIssued">
|
||||
<title>Indicates whether a notification that this record is due for review has been issued</title>
|
||||
<type>d:boolean</type>
|
||||
<protected>true</protected>
|
||||
<mandatory>false</mandatory>
|
||||
<default>false</default>
|
||||
</property>
|
||||
</properties>
|
||||
<mandatory-aspects>
|
||||
<aspect>rma:filePlanComponent</aspect>
|
||||
|
@@ -120,27 +120,12 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
|
||||
}
|
||||
};
|
||||
|
||||
RetryingTransactionCallback<Boolean> txUpdateNodesCallback = new RetryingTransactionCallback<Boolean>()
|
||||
{
|
||||
// Set the notification issued property.
|
||||
public Boolean execute()
|
||||
{
|
||||
for (NodeRef node : resultNodes)
|
||||
{
|
||||
nodeService.setProperty(node, RecordsManagementModel.PROP_NOTIFICATION_ISSUED, "true");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Now do the work, one action in each transaction
|
||||
*/
|
||||
// don't retry the send email
|
||||
retryingTransactionHelper.setMaxRetries(0);
|
||||
retryingTransactionHelper.doInTransaction(txCallbackSendEmail);
|
||||
retryingTransactionHelper.setMaxRetries(10);
|
||||
retryingTransactionHelper.doInTransaction(txUpdateNodesCallback);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -133,7 +133,6 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
||||
// Vital record aspect
|
||||
QName ASPECT_VITAL_RECORD = QName.createQName(RM_URI, "vitalRecord");
|
||||
QName PROP_REVIEW_AS_OF = QName.createQName(RM_URI, "reviewAsOf");
|
||||
QName PROP_NOTIFICATION_ISSUED = QName.createQName(RM_URI, "notificationIssued");
|
||||
|
||||
// Cut off aspect
|
||||
QName ASPECT_CUT_OFF = QName.createQName(RM_URI, "cutOff");
|
||||
|
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2017 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
* -
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* -
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* -
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.vital;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.repo.dictionary.types.period.Days;
|
||||
import org.alfresco.repo.dictionary.types.period.Immediately;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.alfresco.service.cmr.repository.Period;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.extensions.webscripts.GUID;
|
||||
|
||||
/**
|
||||
* Unit test for {@link ReviewedAction} class
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @sincev 2.6
|
||||
*/
|
||||
public class ReviewedActionUnitTest implements RecordsManagementModel
|
||||
{
|
||||
private @Mock VitalRecordService mockedVitalRecordService;
|
||||
private @Mock RecordService mockedRecordService;
|
||||
private @Mock NodeService mockedNodeService;
|
||||
|
||||
private @InjectMocks ReviewedAction reviewedAction;
|
||||
|
||||
@Before
|
||||
public void testSetup()
|
||||
{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a record having the vital record definition of immediately
|
||||
* When I mark the record as reviewed
|
||||
* Then review as of date is removed from the record
|
||||
*/
|
||||
@Test
|
||||
public void testReviewRecordWithAdHocReviewPeriod()
|
||||
{
|
||||
/*
|
||||
* Given
|
||||
*/
|
||||
NodeRef mockedRecord = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
|
||||
when(mockedRecordService.isRecord(mockedRecord)).thenReturn(true);
|
||||
|
||||
VitalRecordDefinition mockedVRDef = mock(VitalRecordDefinition.class);
|
||||
when(mockedVRDef.isEnabled()).thenReturn(true);
|
||||
when(mockedVitalRecordService.getVitalRecordDefinition(mockedRecord)).thenReturn(mockedVRDef);
|
||||
|
||||
Period mockedReviewPeriod = mock(Period.class);
|
||||
when(mockedReviewPeriod.getPeriodType()).thenReturn(Immediately.PERIOD_TYPE);
|
||||
when(mockedVRDef.getReviewPeriod()).thenReturn(mockedReviewPeriod);
|
||||
|
||||
/*
|
||||
* When
|
||||
*/
|
||||
reviewedAction.executeImpl(null, mockedRecord);
|
||||
|
||||
/*
|
||||
* Then
|
||||
*/
|
||||
verify(mockedNodeService).removeProperty(mockedRecord, PROP_REVIEW_AS_OF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a record having a recurent vital record definition
|
||||
* When I mark the record as reviewed
|
||||
* Then the review as of date is updated according to the next review period computed by the vital record definition
|
||||
*/
|
||||
@Test
|
||||
public void testReviewRecordWithRecurentReviewPeriod()
|
||||
{
|
||||
/*
|
||||
* Given
|
||||
*/
|
||||
NodeRef mockedRecord = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
|
||||
when(mockedRecordService.isRecord(mockedRecord)).thenReturn(true);
|
||||
|
||||
VitalRecordDefinition mockedVRDef = mock(VitalRecordDefinition.class);
|
||||
when(mockedVRDef.isEnabled()).thenReturn(true);
|
||||
when(mockedVitalRecordService.getVitalRecordDefinition(mockedRecord)).thenReturn(mockedVRDef);
|
||||
|
||||
Date mockedNextReviewDate = mock(Date.class);
|
||||
when(mockedVRDef.getNextReviewDate()).thenReturn(mockedNextReviewDate);
|
||||
|
||||
Period mockedReviewPeriod = mock(Period.class);
|
||||
when(mockedReviewPeriod.getPeriodType()).thenReturn(Days.PERIOD_TYPE);
|
||||
when(mockedVRDef.getReviewPeriod()).thenReturn(mockedReviewPeriod);
|
||||
|
||||
/*
|
||||
* When
|
||||
*/
|
||||
reviewedAction.executeImpl(null, mockedRecord);
|
||||
|
||||
/*
|
||||
* Then
|
||||
*/
|
||||
verify(mockedNodeService).setProperty(mockedRecord, PROP_REVIEW_AS_OF, mockedNextReviewDate);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user