destroyParamsB = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME,
+ PROP_DISPOSITION_DESCRIPTION, "description",
+ PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_WEEK,
+ PROP_DISPOSITION_PERIOD_PROPERTY, PROP_CUT_OFF_DATE);
+ dispositionService.addDispositionActionDefinition(dispSchedB, destroyParamsB);
+ // Create a folder within each category.
+ folderA = recordFolderService.createRecordFolder(categoryA, FOLDER_A_NAME);
+ folderB = recordFolderService.createRecordFolder(categoryB, FOLDER_B_NAME);
+ }
+
+ /**
+ * RM-2526
+ *
+ * Given a record subject to a disposition schedule
+ * And it is linked to a disposition schedule with the same step order, but a longer destroy step
+ * When the record is moved onto the destroy step
+ * Then the "as of" date is calculated using the longer period.
+ *
+ */
+ public void testLinkedToLongerSchedule()
+ {
+ Calendar calendar = Calendar.getInstance();
+ test()
+ .given(() -> {
+ setUpFilePlan();
+ // Create a record filed under category A and linked to category B.
+ record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
+ recordService.link(record, folderB);
+ })
+ .when(() -> {
+ // Cut off the record.
+ dispositionService.cutoffDisposableItem(record);
+ // Ensure the update has been applied to the record.
+ internalDispositionService.updateNextDispositionAction(record);
+ calendar.setTime((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE));
+ calendar.add(Calendar.WEEK_OF_YEAR, 1);
+ })
+ .then()
+ .expect(calendar.getTime())
+ .from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate())
+ .because("Record should follow largest rentention schedule period, which is one week.");
+ }
+
+ /**
+ * RM-2526
+ *
+ * Given a record subject to a disposition schedule
+ * And it is linked to a disposition schedule with the same step order, but a shorter destroy step
+ * When the record is moved onto the destroy step
+ * Then the "as of" date is calculated using the longer period.
+ *
+ */
+ public void testLinkedToShorterSchedule()
+ {
+ Calendar calendar = Calendar.getInstance();
+ test()
+ .given(() -> {
+ setUpFilePlan();
+ // Create a record filed under category B and linked to category A.
+ record = fileFolderService.create(folderB, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
+ recordService.link(record, folderA);
+ })
+ .when(() -> {
+ // Cut off the record.
+ dispositionService.cutoffDisposableItem(record);
+ // Ensure the update has been applied to the record.
+ internalDispositionService.updateNextDispositionAction(record);
+ calendar.setTime((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE));
+ calendar.add(Calendar.WEEK_OF_YEAR, 1);
+ })
+ .then()
+ .expect(calendar.getTime())
+ .from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate())
+ .because("Record should follow largest rentention schedule period, which is one week.");
+ }
+}
diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java
index 462198f5a7..355d9c7eef 100644
--- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java
+++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java
@@ -44,6 +44,7 @@ import org.alfresco.module.org_alfresco_module_rm.action.impl.EditDispositionAct
import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
+import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
@@ -51,7 +52,7 @@ import org.alfresco.service.namespace.QName;
* Update next disposition step integration tests.
*
* @author Roxana Lucanu
-* @since 2.4.1
+* @since 2.3.1
*/
public class UpdateNextDispositionActionTest extends BaseRMTestCase
{
@@ -103,11 +104,6 @@ public class UpdateNextDispositionActionTest extends BaseRMTestCase
// complete record
utils.completeRecord(record);
- // set the disposition as of date to now on the record
- rmActionService.executeRecordsManagementAction(record,
- EditDispositionActionAsOfDateAction.NAME,
- Collections.singletonMap(EditDispositionActionAsOfDateAction.PARAM_AS_OF_DATE, new Date()));
-
// cut off
rmActionService.executeRecordsManagementAction(record, CutOffAction.NAME, null);
}
@@ -115,7 +111,7 @@ public class UpdateNextDispositionActionTest extends BaseRMTestCase
@Override
public void then() throws Exception
{
- assertTrue(nodeService.hasAspect(record, ASPECT_CUT_OFF));
+ assertTrue("Record " + record + " doesn't have the cutOff aspect.", nodeService.hasAspect(record, ASPECT_CUT_OFF));
}
});
}
@@ -128,7 +124,7 @@ public class UpdateNextDispositionActionTest extends BaseRMTestCase
Map cutOff = new HashMap(3);
cutOff.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME);
cutOff.put(PROP_DISPOSITION_DESCRIPTION, generate());
- cutOff.put(PROP_DISPOSITION_PERIOD, PERIOD_ONE_WEEK);
+ cutOff.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
dispositionService.addDispositionActionDefinition(ds, cutOff);
// create the properties for TRANSFER action and add it to the disposition action definition
diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java
index 65721473d3..5973378a60 100644
--- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java
+++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java
@@ -666,7 +666,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
checkDisposableItemChanged(mhRecordFolder42);
checkDisposableItemChanged(record43);
checkDisposableItemUnchanged(mhRecordFolder44);
- checkDisposableItemUnchanged(record45);;
+ checkDisposableItemUnchanged(record45);
}
});
diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java
index 506b8c03da..1bc023392e 100644
--- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java
+++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java
@@ -274,7 +274,7 @@ public class RecordServiceImplUnitTest extends BaseUnitTest
DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class);
when(recordDispositionSchedule.isRecordLevelDisposition())
.thenReturn(true);
- when(mockedDispositionService.getDispositionSchedule(record))
+ when(mockedDispositionService.getOriginDispositionSchedule(record))
.thenReturn(recordDispositionSchedule);
DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class);