I've tweaked the tests a bit to handle daylight savings.

This commit is contained in:
roxana
2016-10-24 15:30:37 +03:00
parent 4abeb19938
commit cb3357080d
2 changed files with 14 additions and 9 deletions

View File

@@ -280,7 +280,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
DispositionSchedule originDispositionSchedule = getOriginDispositionSchedule(nodeRef);
// if the initial disposition schedule of the record is folder based
if (originDispositionSchedule!= null &&
if (originDispositionSchedule == null ||
isNotTrue(originDispositionSchedule.isRecordLevelDisposition()))
{
return null;

View File

@@ -3,11 +3,10 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition;
import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
@@ -21,6 +20,8 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.extensions.webscripts.GUID;
import com.google.common.collect.ImmutableMap;
public class MultipleSchedulesTest extends BaseRMTestCase
{
/** A unique prefix for the constants in this test. */
@@ -118,6 +119,7 @@ public class MultipleSchedulesTest extends BaseRMTestCase
*/
public void testLinkedToLongerSchedule()
{
Calendar calendar = Calendar.getInstance();
test()
.given(() -> {
setUpFilePlan();
@@ -130,11 +132,12 @@ public class MultipleSchedulesTest extends BaseRMTestCase
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(7 * 24 * 60 * 60 * 1000L)
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate().getTime()
- ((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE)).getTime())
.expect(calendar.getTime())
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate())
.because("Record should follow largest rentention schedule period, which is one week.");
}
@@ -149,6 +152,7 @@ public class MultipleSchedulesTest extends BaseRMTestCase
*/
public void testLinkedToShorterSchedule()
{
Calendar calendar = Calendar.getInstance();
test()
.given(() -> {
setUpFilePlan();
@@ -161,11 +165,12 @@ public class MultipleSchedulesTest extends BaseRMTestCase
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(7 * 24 * 60 * 60 * 1000L)
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate().getTime()
- ((Date) nodeService.getProperty(record, PROP_CUT_OFF_DATE)).getTime())
.expect(calendar.getTime())
.from(() -> dispositionService.getNextDispositionAction(record).getAsOfDate())
.because("Record should follow largest rentention schedule period, which is one week.");
}
}