mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-3265 Add test for the Move action on a destroyed record folder.
This commit is contained in:
@@ -34,6 +34,7 @@ import java.util.Map;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction;
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||||
@@ -61,8 +62,8 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given two categories, both with cut off immediately schedules, when the record is move
|
* Given two categories, both with cut off immediately schedules, when the record is move then all the parts of the
|
||||||
* then all the parts of the record should be correct based on the new schedule.
|
* record should be correct based on the new schedule.
|
||||||
*
|
*
|
||||||
* @see https://issues.alfresco.com/jira/browse/RM-1345
|
* @see https://issues.alfresco.com/jira/browse/RM-1345
|
||||||
*/
|
*/
|
||||||
@@ -101,7 +102,8 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
// check the search aspect properties
|
// check the search aspect properties
|
||||||
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
||||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
|
assertEquals(CutOffAction.NAME,
|
||||||
|
nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||||
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -137,7 +139,8 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
|
|
||||||
// check the search aspect properties
|
// check the search aspect properties
|
||||||
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
||||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
|
assertEquals(CutOffAction.NAME,
|
||||||
|
nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||||
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -183,7 +186,8 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
// check the search aspect properties
|
// check the search aspect properties
|
||||||
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
|
||||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
|
assertEquals(CutOffAction.NAME,
|
||||||
|
nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||||
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -263,7 +267,8 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
// check the search aspect properties
|
// check the search aspect properties
|
||||||
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
|
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
|
||||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
|
assertEquals(CutOffAction.NAME,
|
||||||
|
nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -301,7 +306,8 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
|
|
||||||
// check the search aspect properties
|
// check the search aspect properties
|
||||||
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
|
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
|
||||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
|
assertEquals(CutOffAction.NAME,
|
||||||
|
nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -394,7 +400,6 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// try and move a cutoff folder
|
// try and move a cutoff folder
|
||||||
public void testMoveCutoffRecordFolder() throws Exception
|
public void testMoveCutoffRecordFolder() throws Exception
|
||||||
{
|
{
|
||||||
@@ -446,11 +451,66 @@ public class MoveRecordFolderTest extends BaseRMTestCase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try and move a destroyed folder
|
||||||
|
public void testMoveDestroyedRecordFolder() throws Exception
|
||||||
|
{
|
||||||
|
final NodeRef destination = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// create a record category (no disposition schedule)
|
||||||
|
return filePlanService.createRecordCategory(filePlan, "Caitlin Reed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final NodeRef testFolder = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// create folder
|
||||||
|
NodeRef testFolder = recordFolderService.createRecordFolder(rmContainer, "Peter Edward Francis");
|
||||||
|
|
||||||
|
// complete event
|
||||||
|
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
||||||
|
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
||||||
|
rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params);
|
||||||
|
|
||||||
|
// cutoff & destroy folder
|
||||||
|
rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME);
|
||||||
|
rmActionService.executeRecordsManagementAction(testFolder, DestroyAction.NAME);
|
||||||
|
|
||||||
|
return testFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run() throws Exception
|
||||||
|
{
|
||||||
|
Capability moveCapability = capabilityService.getCapability("MoveRecordFolder");
|
||||||
|
assertEquals(AccessDecisionVoter.ACCESS_GRANTED, moveCapability.evaluate(testFolder, destination));
|
||||||
|
|
||||||
|
return fileFolderService.move(testFolder, destination, null).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(NodeRef result) throws Exception
|
||||||
|
{
|
||||||
|
assertNotNull(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private NodeRef createRecordCategory(boolean recordLevel)
|
private NodeRef createRecordCategory(boolean recordLevel)
|
||||||
{
|
{
|
||||||
NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
DispositionSchedule dis = utils.createBasicDispositionSchedule(rc, GUID.generate(), GUID.generate(), recordLevel, false);
|
DispositionSchedule dis = utils.createBasicDispositionSchedule(rc, GUID.generate(), GUID.generate(),
|
||||||
|
recordLevel, false);
|
||||||
Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
|
Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
|
||||||
adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME);
|
adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME);
|
||||||
adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate());
|
adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate());
|
||||||
|
Reference in New Issue
Block a user