diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionTestSuite.java
index 71fe483156..e1938d1d28 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionTestSuite.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/DispositionTestSuite.java
@@ -31,7 +31,8 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses(
{
- CutOffTest.class
+ CutOffTest.class,
+ UpdateDispositionScheduleTest.class
})
public class DispositionTestSuite
{
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateDispositionScheduleTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateDispositionScheduleTest.java
new file mode 100644
index 0000000000..06ce6a5399
--- /dev/null
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateDispositionScheduleTest.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2005-2014 Alfresco Software Limited.
+ *
+ * This file is part of Alfresco
+ *
+ * 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
+ * Given a record subject to a disposition schedule + * And the next step is due to run at some period after the date the content was created + * When I update the period of the next step (and wait for this to be processed) + * Then the "as of" date is updated to be at the new period after the creation date. + *+ */ + public void testUpdatePeriod() + { + test() + .given(() -> { + // Create a category. + category = filePlanService.createRecordCategory(filePlan, CATEGORY_NAME); + // Create a disposition schedule for the category (Cut off immediately, then Destroy 1 year after the creation date). + DispositionSchedule dispSched = utils.createBasicDispositionSchedule(category, "instructions", "authority", true, false); + Map
+ * This actually just checks that they're more than one and less than three years apart, because leap years make
+ * things hard to calculate.
+ *
+ * @return true if the two dates are about two years apart.
+ */
+ private boolean aboutTwoYearsApart(Date start, Date end)
+ {
+ long days = daysBetween(start, end);
+ long yearInDays = 365;
+ return (yearInDays < days) && (days < 3 * yearInDays);
+ }
+
+ /** Find the number of days between the two dates. */
+ private long daysBetween(Date start, Date end)
+ {
+ return TimeUnit.MILLISECONDS.toDays(end.getTime() - start.getTime());
+ }
+}
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java
index 3d66cb81bb..275dc089da 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java
@@ -56,7 +56,7 @@ import org.springframework.context.ApplicationContext;
/**
* Common RM test utility methods.
- *
+ *
* @author Roy Wetherall
*/
public class CommonRMTestUtils implements RecordsManagementModel
@@ -76,10 +76,12 @@ public class CommonRMTestUtils implements RecordsManagementModel
public static final String DEFAULT_EVENT_NAME = "case_closed";
public static final String PERIOD_NONE = "none|0";
public static final String PERIOD_IMMEDIATELY = "immediately|0";
+ public static final String PERIOD_ONE_YEAR = "year|1";
+ public static final String PERIOD_THREE_YEARS = "year|3";
/**
* Constructor
- *
+ *
* @param applicationContext application context
*/
public CommonRMTestUtils(ApplicationContext applicationContext)
@@ -95,7 +97,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
/**
* Create a disposition schedule
- *
+ *
* @param container record category
* @return {@link DispositionSchedule} created disposition schedule node reference
*/
@@ -129,15 +131,15 @@ public class CommonRMTestUtils implements RecordsManagementModel
boolean extendedDispositionSchedule)
{
return createDispositionSchedule(
- container,
- dispositionInstructions,
- dispositionAuthority,
- isRecordLevel,
- defaultDispositionActions,
- extendedDispositionSchedule,
+ container,
+ dispositionInstructions,
+ dispositionAuthority,
+ isRecordLevel,
+ defaultDispositionActions,
+ extendedDispositionSchedule,
DEFAULT_EVENT_NAME);
}
-
+
/**
* Create test disposition schedule
*/
@@ -241,8 +243,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
modelSecurityService.setEnabled(false);
try
{
- nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date());
- nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue");
+ nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date());
+ nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue");
actionService.executeRecordsManagementAction(record, "declareRecord");
}
finally
@@ -255,7 +257,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
}, AuthenticationUtil.getAdminUserName());
- }
+ }
public void closeFolder(final NodeRef recordFolder)
{
@@ -293,10 +295,10 @@ public class CommonRMTestUtils implements RecordsManagementModel
return filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities);
}
-
+
/**
* Helper method to complete event on disposable item
- *
+ *
* @param disposableItem disposable item (record or record folder)
* @param eventName event name
*/
@@ -305,8 +307,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
// build action properties
Map