mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM: RecordsManagementService refactor
* move candiate methods into FilePlanService * deprecation of RMService methods * remove all deprecation warnings from code * update filePlanService unit tests * remove all other spurious warnings from RM code * a couple of performance enhancements in the bowls of the capability evaluation code * first pass at parametising RecordsManagementAuditService with file plan (so capability evaluation had a tangable reference) * fix up unit test failures and other fall out from refactors git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@52504 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,12 +26,12 @@ import java.util.Set;
|
||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CompositeCapability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
@@ -88,7 +88,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
|
||||
|
||||
// MoveTo artifacts
|
||||
moveToFolder = rmService.createRecordFolder(rmContainer, "moveToFolder");
|
||||
moveToCategory = rmService.createRecordCategory(rmContainer, "moveToCategory");
|
||||
moveToCategory = filePlanService.createRecordCategory(rmContainer, "moveToCategory");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -187,7 +187,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
|
||||
else
|
||||
{
|
||||
// Do the kind check here ...
|
||||
FilePlanComponentKind actualKind = rmService.getFilePlanComponentKind(filePlanComponent);
|
||||
FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(filePlanComponent);
|
||||
List<String> kinds = capability.getKinds();
|
||||
|
||||
if (kinds == null ||
|
||||
|
@@ -139,9 +139,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
// TestRecordCategory1
|
||||
NodeRef recCat1 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1");
|
||||
assertNotNull(recCat1);
|
||||
List<NodeRef> recCat1ImmediateChildren = rmService.getAllContained(recCat1);
|
||||
List<NodeRef> recCat1ImmediateChildren = filePlanService.getAllContained(recCat1);
|
||||
assertTrue(recCat1ImmediateChildren.size() == 3);
|
||||
List<NodeRef> recCat1AllChildren = rmService.getAllContained(recCat1, true);
|
||||
List<NodeRef> recCat1AllChildren = filePlanService.getAllContained(recCat1, true);
|
||||
assertTrue(recCat1AllChildren.size() == 6);
|
||||
DispositionSchedule recCat1DispositionSchedule = dispositionService.getDispositionSchedule(recCat1);
|
||||
assertNull(recCat1DispositionSchedule);
|
||||
@@ -149,9 +149,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
// TestRecordCategory2
|
||||
NodeRef recCat2 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2");
|
||||
assertNotNull(recCat2);
|
||||
List<NodeRef> recCat2ImmediateChildren = rmService.getAllContained(recCat2);
|
||||
List<NodeRef> recCat2ImmediateChildren = filePlanService.getAllContained(recCat2);
|
||||
assertTrue(recCat2ImmediateChildren.size() == 2);
|
||||
List<NodeRef> recCat2AllChildren = rmService.getAllContained(recCat2, true);
|
||||
List<NodeRef> recCat2AllChildren = filePlanService.getAllContained(recCat2, true);
|
||||
assertTrue(recCat2AllChildren.size() == 4);
|
||||
DispositionSchedule recCat2DispositionSchedule = dispositionService.getDispositionSchedule(recCat2);
|
||||
assertNull(recCat2DispositionSchedule);
|
||||
@@ -159,9 +159,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
// TestRecordCategory1: Test the "second level" categories and record folders
|
||||
NodeRef recCat11 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory11");
|
||||
assertNotNull(recCat11);
|
||||
List<NodeRef> recCat11ImmediateChilderen = rmService.getAllContained(recCat11);
|
||||
List<NodeRef> recCat11ImmediateChilderen = filePlanService.getAllContained(recCat11);
|
||||
assertTrue(recCat11ImmediateChilderen.size() == 2);
|
||||
List<NodeRef> recCat11Childeren = rmService.getAllContained(recCat11, true);
|
||||
List<NodeRef> recCat11Childeren = filePlanService.getAllContained(recCat11, true);
|
||||
assertTrue(recCat11Childeren.size() == 2);
|
||||
assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder1"));
|
||||
assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder2"));
|
||||
@@ -172,9 +172,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
|
||||
NodeRef recCat12 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory12");
|
||||
assertNotNull(recCat12);
|
||||
List<NodeRef> recCat12ImmediateChildren = rmService.getAllContained(recCat12);
|
||||
List<NodeRef> recCat12ImmediateChildren = filePlanService.getAllContained(recCat12);
|
||||
assertTrue(recCat12ImmediateChildren.size() == 1);
|
||||
List<NodeRef> recCat12Children = rmService.getAllContained(recCat12, true);
|
||||
List<NodeRef> recCat12Children = filePlanService.getAllContained(recCat12, true);
|
||||
assertTrue(recCat12Children.size() == 1);
|
||||
assertNotNull(nodeService.getChildByName(recCat12, ContentModel.ASSOC_CONTAINS, "TestRecordFolder3"));
|
||||
DispositionSchedule recCat12DispositionSchedule = dispositionService.getDispositionSchedule(recCat12);
|
||||
@@ -187,7 +187,7 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
|
||||
NodeRef recCat13 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory13");
|
||||
assertNotNull(recCat13);
|
||||
List<NodeRef> recCat13ImmediateChildren = rmService.getAllContained(recCat13);
|
||||
List<NodeRef> recCat13ImmediateChildren = filePlanService.getAllContained(recCat13);
|
||||
assertTrue(recCat13ImmediateChildren.size() == 0);
|
||||
DispositionSchedule recCat13DispositionSchedule = dispositionService.getDispositionSchedule(recCat13);
|
||||
assertNotNull(recCat13DispositionSchedule);
|
||||
@@ -195,16 +195,16 @@ public class DataSetServiceImplTest extends BaseRMTestCase
|
||||
// TestRecordCategory2: Test the "second level" categories and record folders
|
||||
NodeRef recCat21 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory21");
|
||||
assertNotNull(recCat21);
|
||||
List<NodeRef> recCat21ImmediateChildren = rmService.getAllContained(recCat21);
|
||||
List<NodeRef> recCat21ImmediateChildren = filePlanService.getAllContained(recCat21);
|
||||
assertTrue(recCat21ImmediateChildren.size() == 0);
|
||||
DispositionSchedule recCat21DispositionSchedule = dispositionService.getDispositionSchedule(recCat21);
|
||||
assertNotNull(recCat21DispositionSchedule);
|
||||
|
||||
NodeRef recCat22 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory22");
|
||||
assertNotNull(recCat22);
|
||||
List<NodeRef> recCat22ImmediateChildren = rmService.getAllContained(recCat22);
|
||||
List<NodeRef> recCat22ImmediateChildren = filePlanService.getAllContained(recCat22);
|
||||
assertTrue(recCat22ImmediateChildren.size() == 2);
|
||||
List<NodeRef> recCat22Children = rmService.getAllContained(recCat22, true);
|
||||
List<NodeRef> recCat22Children = filePlanService.getAllContained(recCat22, true);
|
||||
assertTrue(recCat22Children.size() == 2);
|
||||
assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder4"));
|
||||
assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder5"));
|
||||
|
@@ -308,7 +308,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
public Void run()
|
||||
{
|
||||
// Add a new disposition schedule
|
||||
NodeRef container = rmService.createRecordCategory(rmContainer, "hasDisposableTest");
|
||||
NodeRef container = filePlanService.createRecordCategory(rmContainer, "hasDisposableTest");
|
||||
DispositionSchedule ds = utils.createBasicDispositionSchedule(container);
|
||||
|
||||
assertTrue(dispositionService.hasDisposableItems(dispositionSchedule));
|
||||
@@ -410,7 +410,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
public NodeRef run()
|
||||
{
|
||||
// Create a new container
|
||||
NodeRef container = rmService.createRecordCategory(filePlan, "testCreateDispositionSchedule");
|
||||
NodeRef container = filePlanService.createRecordCategory(filePlan, "testCreateDispositionSchedule");
|
||||
|
||||
// Create a new disposition schedule
|
||||
utils.createBasicDispositionSchedule(container, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false, true);
|
||||
@@ -456,8 +456,8 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
public Void run()
|
||||
{
|
||||
// Create a new structure container
|
||||
NodeRef testA = rmService.createRecordCategory(mhContainer, "testA");
|
||||
NodeRef testB = rmService.createRecordCategory(testA, "testB");
|
||||
NodeRef testA = filePlanService.createRecordCategory(mhContainer, "testA");
|
||||
NodeRef testB = filePlanService.createRecordCategory(testA, "testB");
|
||||
|
||||
// Create new disposition schedules
|
||||
utils.createBasicDispositionSchedule(testA, "testA", "testA", false, true);
|
||||
@@ -839,7 +839,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
testRM263RecordCategory = rmService.createRecordCategory(rmContainer, "rm263");
|
||||
testRM263RecordCategory = filePlanService.createRecordCategory(rmContainer, "rm263");
|
||||
testRM263DispositionSchedule = utils.createBasicDispositionSchedule(
|
||||
testRM263RecordCategory,
|
||||
"test",
|
||||
@@ -914,7 +914,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
testRM386RecordCategory = rmService.createRecordCategory(rmContainer, "RM386");
|
||||
testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386");
|
||||
testRM386DispositionSchedule = utils.createBasicDispositionSchedule(
|
||||
testRM386RecordCategory,
|
||||
"disposition instructions",
|
||||
|
@@ -65,7 +65,7 @@ public class ExtendedSecurityServiceImplTest extends BaseRMTestCase
|
||||
record = utils.createRecord(rmFolder, "record.txt");
|
||||
recordToo = utils.createRecord(rmFolder, "recordToo.txt");
|
||||
|
||||
moveRecordCategory = rmService.createRecordCategory(filePlan, "moveRecordCategory");
|
||||
moveRecordCategory = filePlanService.createRecordCategory(filePlan, "moveRecordCategory");
|
||||
moveRecordFolder = rmService.createRecordFolder(moveRecordCategory, "moveRecordFolder");
|
||||
}
|
||||
|
||||
|
@@ -18,9 +18,14 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
/**
|
||||
@@ -92,4 +97,441 @@ public class FilePlanServiceImplTest extends BaseRMTestCase
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public void testIsFilePlanComponent() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan));
|
||||
assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer));
|
||||
assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder));
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#getFilePlanComponentKind(NodeRef)
|
||||
*/
|
||||
public void testGetFilePlanComponentKind() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run() throws Exception
|
||||
{
|
||||
return utils.createRecord(rmFolder, "testRecord.txt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef result) throws Exception
|
||||
{
|
||||
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
|
||||
assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer));
|
||||
assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder));
|
||||
assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result));
|
||||
// TODO HOLD and TRANSFER
|
||||
assertNull(filePlanService.getFilePlanComponentKind(folder));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#isRecordCategory(NodeRef)
|
||||
*/
|
||||
public void testIsRecordCategory() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan));
|
||||
assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer));
|
||||
assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder));
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String)
|
||||
* @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName)
|
||||
*/
|
||||
public void testCreateFilePlan() throws Exception
|
||||
{
|
||||
// Create default type of root
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
String id = setString("id", GUID.generate());
|
||||
return filePlanService.createFilePlan(folder, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef result)
|
||||
{
|
||||
assertNotNull("Unable to create records management root", result);
|
||||
basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN);
|
||||
}
|
||||
});
|
||||
|
||||
// Create specific type of root
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
String id = setString("id", GUID.generate());
|
||||
return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef result)
|
||||
{
|
||||
assertNotNull("Unable to create records management root", result);
|
||||
basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN);
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: creating root in existing hierarchy
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.createFilePlan(rmContainer, GUID.generate());
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: type no extended from root container
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A basic test of a records management container
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @param name name of the container
|
||||
* @param type the type of container
|
||||
*/
|
||||
private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type)
|
||||
{
|
||||
// Check the basic details
|
||||
assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME));
|
||||
assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER));
|
||||
assertEquals(type, nodeService.getType(nodeRef));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#createRecordCategory(NodeRef, String)
|
||||
* @see FilePlanService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName)
|
||||
*/
|
||||
public void testCreateRecordCategory() throws Exception
|
||||
{
|
||||
// Create container (in root)
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
String id = setString("id", GUID.generate());
|
||||
return filePlanService.createRecordCategory(filePlan, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef result)
|
||||
{
|
||||
assertNotNull("Unable to create records management container", result);
|
||||
basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY);
|
||||
}
|
||||
});
|
||||
|
||||
// Create container (in container)
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
String id = setString("id", GUID.generate());
|
||||
return filePlanService.createRecordCategory(rmContainer, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(NodeRef result)
|
||||
{
|
||||
assertNotNull("Unable to create records management container", result);
|
||||
basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY);
|
||||
}
|
||||
});
|
||||
|
||||
// TODO need a custom type of container!
|
||||
// Create container of a given type
|
||||
// doTestInTransaction(new Test<NodeRef>()
|
||||
// {
|
||||
// @Override
|
||||
// public NodeRef run()
|
||||
// {
|
||||
// String id = setString("id", GUID.generate());
|
||||
// return rmService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void test(NodeRef result)
|
||||
// {
|
||||
// assertNotNull("Unable to create records management container", result);
|
||||
// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES);
|
||||
// }
|
||||
// });
|
||||
|
||||
// Fail Test: parent is not a container
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.createRecordCategory(folder, GUID.generate());
|
||||
}
|
||||
});
|
||||
|
||||
// Fail Test: type is not a sub-type of rm:recordsManagementContainer
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#getAllContained(NodeRef)
|
||||
* @see FilePlanService#getAllContained(NodeRef, boolean)
|
||||
*/
|
||||
public void testGetAllContained() throws Exception
|
||||
{
|
||||
// Get all contained test
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
// Add to the test data
|
||||
NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries");
|
||||
NodeRef seriesChildFolder = rmService.createRecordFolder(series, "seriesRecordFolder");
|
||||
NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer");
|
||||
|
||||
// Put in model
|
||||
setNodeRef("series", series);
|
||||
setNodeRef("seriesChildFolder", seriesChildFolder);
|
||||
setNodeRef("seriesChildContainer", seriesChildContainer);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(Void result) throws Exception
|
||||
{
|
||||
List<NodeRef> nodes = filePlanService.getAllContained(rmContainer);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(2, nodes.size());
|
||||
assertTrue(nodes.contains(getNodeRef("series")));
|
||||
assertTrue(nodes.contains(rmFolder));
|
||||
|
||||
nodes = filePlanService.getAllContained(rmContainer, false);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(2, nodes.size());
|
||||
assertTrue(nodes.contains(getNodeRef("series")));
|
||||
assertTrue(nodes.contains(rmFolder));
|
||||
|
||||
nodes = filePlanService.getAllContained(rmContainer, true);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(4, nodes.size());
|
||||
assertTrue(nodes.contains(getNodeRef("series")));
|
||||
assertTrue(nodes.contains(rmFolder));
|
||||
assertTrue(nodes.contains(getNodeRef("seriesChildFolder")));
|
||||
assertTrue(nodes.contains(getNodeRef("seriesChildContainer")));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: call on record folder
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.getAllContained(rmFolder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#getContainedRecordCategories(NodeRef)
|
||||
* @see FilePlanService#getContainedRecordCategories(NodeRef, boolean)
|
||||
*/
|
||||
public void testGetContainedRecordCategories() throws Exception
|
||||
{
|
||||
// Test getting all contained containers
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
// Add to the test data
|
||||
NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries");
|
||||
NodeRef seriesChildFolder = rmService.createRecordFolder(series, "seriesRecordFolder");
|
||||
NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer");
|
||||
|
||||
// Put in model
|
||||
setNodeRef("series", series);
|
||||
setNodeRef("seriesChildFolder", seriesChildFolder);
|
||||
setNodeRef("seriesChildContainer", seriesChildContainer);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(Void result) throws Exception
|
||||
{
|
||||
List<NodeRef> nodes = filePlanService.getContainedRecordCategories(rmContainer);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(1, nodes.size());
|
||||
assertTrue(nodes.contains(getNodeRef("series")));
|
||||
|
||||
nodes = filePlanService.getContainedRecordCategories(rmContainer, false);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(1, nodes.size());
|
||||
assertTrue(nodes.contains(getNodeRef("series")));
|
||||
|
||||
nodes = filePlanService.getContainedRecordCategories(rmContainer, true);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(2, nodes.size());
|
||||
assertTrue(nodes.contains(getNodeRef("series")));
|
||||
assertTrue(nodes.contains(getNodeRef("seriesChildContainer")));
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: call on record folder
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.getContainedRecordCategories(rmFolder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FilePlanService#getContainedRecordFolders(NodeRef)
|
||||
* @see FilePlanService#getContainedRecordFolders(NodeRef, boolean)
|
||||
*/
|
||||
public void testGetContainedRecordFolders() throws Exception
|
||||
{
|
||||
// Test getting all contained record folders
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
// Add to the test data
|
||||
NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries");
|
||||
NodeRef seriesChildFolder = rmService.createRecordFolder(series, "seriesRecordFolder");
|
||||
NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer");
|
||||
|
||||
// Put in model
|
||||
setNodeRef("series", series);
|
||||
setNodeRef("seriesChildFolder", seriesChildFolder);
|
||||
setNodeRef("seriesChildContainer", seriesChildContainer);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(Void result) throws Exception
|
||||
{
|
||||
List<NodeRef> nodes = filePlanService.getContainedRecordFolders(rmContainer);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(1, nodes.size());
|
||||
assertTrue(nodes.contains(rmFolder));
|
||||
|
||||
nodes = filePlanService.getContainedRecordFolders(rmContainer, false);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(1, nodes.size());
|
||||
assertTrue(nodes.contains(rmFolder));
|
||||
|
||||
nodes = filePlanService.getContainedRecordFolders(rmContainer, true);
|
||||
assertNotNull(nodes);
|
||||
assertEquals(2, nodes.size());
|
||||
assertTrue(nodes.contains(rmFolder));
|
||||
assertTrue(nodes.contains(getNodeRef("seriesChildFolder")));
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: call on record folder
|
||||
doTestInTransaction(new FailureTest()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
filePlanService.getContainedRecordFolders(rmFolder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to create a simple multi-hierarchy record taxonomy
|
||||
*/
|
||||
public void testCreateSimpleHierarchy()
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
// Create 3 level hierarchy
|
||||
NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1"));
|
||||
assertNotNull("Unable to create container", levelOne);
|
||||
NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2"));
|
||||
assertNotNull("Unable to create container", levelTwo);
|
||||
NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3"));
|
||||
assertNotNull("Unable to create container", levelThree);
|
||||
NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", rmService.createRecordFolder(levelThree, "recordFolder3"));
|
||||
assertNotNull("Unable to create record folder", levelThreeRecordFolder);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(Void result)
|
||||
{
|
||||
// Test that the hierarchy has been created correctly
|
||||
basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY);
|
||||
basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY);
|
||||
basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY);
|
||||
basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER);
|
||||
|
||||
// TODO need to check that the parents and children can be retrieved correctly
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -55,10 +55,10 @@ public class FreezeServiceImplTest extends BaseRMTestCase
|
||||
assertTrue(recordService.isRecord(recordTwo));
|
||||
assertTrue(recordService.isRecord(recordThree));
|
||||
assertTrue(recordService.isRecord(recordFour));
|
||||
assertTrue(rmService.isFilePlanComponent(recordOne));
|
||||
assertTrue(rmService.isFilePlanComponent(recordTwo));
|
||||
assertTrue(rmService.isFilePlanComponent(recordThree));
|
||||
assertTrue(rmService.isFilePlanComponent(recordFour));
|
||||
assertTrue(filePlanService.isFilePlanComponent(recordOne));
|
||||
assertTrue(filePlanService.isFilePlanComponent(recordTwo));
|
||||
assertTrue(filePlanService.isFilePlanComponent(recordThree));
|
||||
assertTrue(filePlanService.isFilePlanComponent(recordFour));
|
||||
|
||||
// Freeze a record
|
||||
freezeService.freeze("FreezeReason", recordOne);
|
||||
|
@@ -67,16 +67,25 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
// test start time recorded
|
||||
testStartTime = new Date();
|
||||
|
||||
// Stop and clear the log
|
||||
auditService.stop();
|
||||
auditService.clear();
|
||||
auditService.start();
|
||||
|
||||
// check that audit service is started
|
||||
assertTrue(auditService.isEnabled());
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
// test start time recorded
|
||||
testStartTime = new Date();
|
||||
|
||||
// Stop and clear the log
|
||||
auditService.stopAuditLog(filePlan);
|
||||
auditService.clearAuditLog(filePlan);
|
||||
auditService.startAuditLog(filePlan);
|
||||
|
||||
// check that audit service is started
|
||||
assertTrue(auditService.isAuditLogEnabled(filePlan));
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +109,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
super.tearDown();
|
||||
|
||||
// ensure the audit is restarted
|
||||
auditService.start();
|
||||
auditService.startAuditLog(filePlan);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,7 +283,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
public void testAdminMethods() throws InterruptedException
|
||||
{
|
||||
// Stop the audit
|
||||
auditService.stop();
|
||||
auditService.stopAuditLog(filePlan);
|
||||
|
||||
Thread.sleep(5000);
|
||||
|
||||
@@ -294,7 +303,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
result1.size(), result2.size());
|
||||
|
||||
// repeat with a start
|
||||
auditService.start();
|
||||
auditService.startAuditLog(filePlan);
|
||||
updateTitle(filePlan, rmAdminName);
|
||||
|
||||
Thread.sleep(5000);
|
||||
@@ -308,8 +317,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
Thread.sleep(5000);
|
||||
|
||||
// Stop and delete all entries
|
||||
auditService.stop();
|
||||
auditService.clear();
|
||||
auditService.stopAuditLog(filePlan);
|
||||
auditService.clearAuditLog(filePlan);
|
||||
|
||||
// There should be no entries
|
||||
List<RecordsManagementAuditEntry> result4 = getAuditTrail(rmAdminName);
|
||||
@@ -327,9 +336,9 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
|
||||
public void xtestAuditAuthentication()
|
||||
{
|
||||
auditService.stop();
|
||||
auditService.clear();
|
||||
auditService.start();
|
||||
auditService.stopAuditLog(filePlan);
|
||||
auditService.clearAuditLog(filePlan);
|
||||
auditService.startAuditLog(filePlan);
|
||||
|
||||
//MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
|
||||
//PersonService personService = serviceRegistry.getPersonService();
|
||||
@@ -359,7 +368,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
auditService.stop();
|
||||
auditService.stopAuditLog(filePlan);
|
||||
List<RecordsManagementAuditEntry> result1 = getAuditTrail(rmAdminName);
|
||||
// Check that the username is reflected correctly in the results
|
||||
assertFalse("No audit results were generated for the failed login.", result1.isEmpty());
|
||||
@@ -392,8 +401,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
personProperties.put(ContentModel.PROP_LASTNAME, "Dickons");
|
||||
personService.createPerson(personProperties);
|
||||
|
||||
auditService.clear();
|
||||
auditService.start();
|
||||
auditService.clearAuditLog(filePlan);
|
||||
auditService.startAuditLog(filePlan);
|
||||
try
|
||||
{
|
||||
AuthenticationUtil.pushAuthentication();
|
||||
@@ -403,7 +412,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
auditService.stop();
|
||||
auditService.stopAuditLog(filePlan);
|
||||
List<RecordsManagementAuditEntry> result2 = getAuditTrail(rmAdminName);
|
||||
found = false;
|
||||
for (RecordsManagementAuditEntry entry : result2)
|
||||
|
@@ -20,8 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.test.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -40,6 +40,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
/**
|
||||
* @see RecordsManagementService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testIsFilePlanComponent() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
@@ -59,6 +60,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
/**
|
||||
* @see RecordsManagementService#getFilePlanComponentKind(NodeRef)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testGetFilePlanComponentKind() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
@@ -105,6 +107,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
/**
|
||||
* @see RecordsManagementService#isRecordCategory(NodeRef)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testIsRecordCategory() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<NodeRef>()
|
||||
@@ -140,14 +143,6 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
});
|
||||
}
|
||||
|
||||
// TODO void testIsRecord()
|
||||
|
||||
// TODO void testIsHold()
|
||||
|
||||
// TODO void testIsTransfer()
|
||||
|
||||
// TODO void testGetNodeRefPath()
|
||||
|
||||
/**
|
||||
* @see RecordsManagementService#getRecordsManagementRoot()
|
||||
*/
|
||||
@@ -195,6 +190,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
* @see RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String)
|
||||
* @see RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testCreateFilePlan() throws Exception
|
||||
{
|
||||
// Create default type of root
|
||||
@@ -260,6 +256,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
* @see RecordsManagementService#createRecordCategory(NodeRef, String)
|
||||
* @see RecordsManagementService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testCreateRecordCategory() throws Exception
|
||||
{
|
||||
// Create container (in root)
|
||||
@@ -342,6 +339,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
* @see RecordsManagementService#getAllContained(NodeRef)
|
||||
* @see RecordsManagementService#getAllContained(NodeRef, boolean)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testGetAllContained() throws Exception
|
||||
{
|
||||
// Get all contained test
|
||||
@@ -404,6 +402,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
* @see RecordsManagementService#getContainedRecordCategories(NodeRef)
|
||||
* @see RecordsManagementService#getContainedRecordCategories(NodeRef, boolean)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testGetContainedRecordCategories() throws Exception
|
||||
{
|
||||
// Test getting all contained containers
|
||||
@@ -461,6 +460,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
* @see RecordsManagementService#getContainedRecordFolders(NodeRef)
|
||||
* @see RecordsManagementService#getContainedRecordFolders(NodeRef, boolean)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testGetContainedRecordFolders() throws Exception
|
||||
{
|
||||
// Test getting all contained record folders
|
||||
@@ -575,6 +575,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
|
||||
/**
|
||||
* Test to create a simple multi-hierarchy record taxonomy
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testCreateSimpleHierarchy()
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
|
@@ -196,7 +196,7 @@ public class VitalRecordServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
return rmService.createRecordCategory(mhContainer35, GUID.generate());
|
||||
return filePlanService.createRecordCategory(mhContainer35, GUID.generate());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.test.system;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.transaction.UserTransaction;
|
||||
@@ -28,10 +27,10 @@ import javax.transaction.UserTransaction;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
@@ -54,12 +53,12 @@ public class PerformanceDataLoadSystemTest extends TestCase implements RecordsMa
|
||||
{
|
||||
private ApplicationContext appContext;
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
private RecordsManagementService rmService;
|
||||
private DispositionService dispositionService;
|
||||
private TransactionService transactionService;
|
||||
private NodeService nodeService;
|
||||
private ContentService contentService;
|
||||
private IdentifierService identifierService;
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
UserTransaction userTransaction;
|
||||
|
||||
@@ -75,10 +74,10 @@ public class PerformanceDataLoadSystemTest extends TestCase implements RecordsMa
|
||||
authenticationComponent = (AuthenticationComponent)appContext.getBean("authenticationComponent");
|
||||
transactionService = (TransactionService)appContext.getBean("transactionService");
|
||||
nodeService = (NodeService)appContext.getBean("nodeService");
|
||||
rmService = (RecordsManagementService)appContext.getBean("recordsManagementService");
|
||||
contentService = (ContentService)appContext.getBean("contentService");
|
||||
identifierService = (IdentifierService)appContext.getBean("identifierService");
|
||||
dispositionService = (DispositionService)appContext.getBean("dispositionService");
|
||||
filePlanService = (FilePlanService)appContext.getBean("filePlanService");
|
||||
|
||||
// Set authentication
|
||||
authenticationComponent.setCurrentUser("admin");
|
||||
@@ -96,13 +95,11 @@ public class PerformanceDataLoadSystemTest extends TestCase implements RecordsMa
|
||||
|
||||
public void testLoadTestData() throws Exception
|
||||
{
|
||||
// Get the file plan node
|
||||
List<NodeRef> roots = rmService.getFilePlans();
|
||||
if (roots.size() != 1)
|
||||
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||
if (filePlan == null)
|
||||
{
|
||||
fail("There is more than one root to load the test data into.");
|
||||
fail("The default RM site is not present.");
|
||||
}
|
||||
NodeRef filePlan = roots.get(0);
|
||||
|
||||
for (int i = 0; i < SERIES_COUNT; i++)
|
||||
{
|
||||
|
@@ -23,9 +23,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService;
|
||||
@@ -293,7 +293,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
// Get the application context
|
||||
applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);
|
||||
utils = new CommonRMTestUtils(applicationContext);
|
||||
|
||||
|
||||
// Initialise the service beans
|
||||
initServices();
|
||||
|
||||
@@ -484,6 +484,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
ContentModel.TYPE_FOLDER,
|
||||
containerProps).getChildRef();
|
||||
assertNotNull("Could not create base folder", folder);
|
||||
|
||||
permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true);
|
||||
permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true);
|
||||
|
||||
siteInfo = siteService.createSite(
|
||||
"rm-site-dashboard",
|
||||
@@ -497,7 +500,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
assertNotNull("Site document library container was not created successfully.", filePlan);
|
||||
|
||||
// Create RM container
|
||||
rmContainer = rmService.createRecordCategory(filePlan, "rmContainer");
|
||||
rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer");
|
||||
assertNotNull("Could not create rm container", rmContainer);
|
||||
|
||||
// Create disposition schedule
|
||||
@@ -633,27 +636,27 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected void setupMultiHierarchyTestDataImpl()
|
||||
{
|
||||
// Create root mh container
|
||||
mhContainer = rmService.createRecordCategory(filePlan, "mhContainer");
|
||||
mhContainer = filePlanService.createRecordCategory(filePlan, "mhContainer");
|
||||
|
||||
// Level 1
|
||||
mhContainer11 = rmService.createRecordCategory(mhContainer, "mhContainer11");
|
||||
mhContainer11 = filePlanService.createRecordCategory(mhContainer, "mhContainer11");
|
||||
mhDispositionSchedule11 = utils.createBasicDispositionSchedule(mhContainer11, "ds11", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true);
|
||||
mhContainer12 = rmService.createRecordCategory(mhContainer, "mhContainer12");
|
||||
mhContainer12 = filePlanService.createRecordCategory(mhContainer, "mhContainer12");
|
||||
mhDispositionSchedule12 = utils.createBasicDispositionSchedule(mhContainer12, "ds12", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true);
|
||||
|
||||
// Level 2
|
||||
mhContainer21 = rmService.createRecordCategory(mhContainer11, "mhContainer21");
|
||||
mhContainer22 = rmService.createRecordCategory(mhContainer12, "mhContainer22");
|
||||
mhContainer23 = rmService.createRecordCategory(mhContainer12, "mhContainer23");
|
||||
mhContainer21 = filePlanService.createRecordCategory(mhContainer11, "mhContainer21");
|
||||
mhContainer22 = filePlanService.createRecordCategory(mhContainer12, "mhContainer22");
|
||||
mhContainer23 = filePlanService.createRecordCategory(mhContainer12, "mhContainer23");
|
||||
mhDispositionSchedule23 = utils.createBasicDispositionSchedule(mhContainer23, "ds23", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true);
|
||||
|
||||
// Level 3
|
||||
mhContainer31 = rmService.createRecordCategory(mhContainer21, "mhContainer31");
|
||||
mhContainer32 = rmService.createRecordCategory(mhContainer22, "mhContainer32");
|
||||
mhContainer33 = rmService.createRecordCategory(mhContainer22, "mhContainer33");
|
||||
mhContainer31 = filePlanService.createRecordCategory(mhContainer21, "mhContainer31");
|
||||
mhContainer32 = filePlanService.createRecordCategory(mhContainer22, "mhContainer32");
|
||||
mhContainer33 = filePlanService.createRecordCategory(mhContainer22, "mhContainer33");
|
||||
mhDispositionSchedule33 = utils.createBasicDispositionSchedule(mhContainer33, "ds33", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true);
|
||||
mhContainer34 = rmService.createRecordCategory(mhContainer23, "mhContainer34");
|
||||
mhContainer35 = rmService.createRecordCategory(mhContainer23, "mhContainer35");
|
||||
mhContainer34 = filePlanService.createRecordCategory(mhContainer23, "mhContainer34");
|
||||
mhContainer35 = filePlanService.createRecordCategory(mhContainer23, "mhContainer35");
|
||||
mhDispositionSchedule35 = utils.createBasicDispositionSchedule(mhContainer35, "ds35", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true);
|
||||
|
||||
// Record folders
|
||||
|
@@ -23,14 +23,15 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||
@@ -107,6 +108,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
protected RecordsManagementAuditService auditService;
|
||||
protected CapabilityService capabilityService;
|
||||
protected VitalRecordService vitalRecordService;
|
||||
protected FilePlanService filePlanService;
|
||||
|
||||
/** test data */
|
||||
protected StoreRef storeRef;
|
||||
@@ -178,6 +180,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService");
|
||||
capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService");
|
||||
vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService");
|
||||
filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,10 +279,10 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
filePlan = siteService.getContainer(SITE_ID, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||
assertNotNull("Site document library container was not created successfully.", filePlan);
|
||||
|
||||
recordSeries = rmService.createRecordCategory(filePlan, "recordSeries");
|
||||
recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries");
|
||||
assertNotNull("Could not create record category with no disposition schedule", recordSeries);
|
||||
|
||||
recordCategory = rmService.createRecordCategory(recordSeries, "rmContainer");
|
||||
recordCategory = filePlanService.createRecordCategory(recordSeries, "rmContainer");
|
||||
assertNotNull("Could not create record category", recordCategory);
|
||||
|
||||
// Make vital record
|
||||
|
@@ -147,7 +147,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
|
||||
ContentModel.TYPE_CONTENT,
|
||||
properties).getChildRef();
|
||||
properties).getChildRef();
|
||||
|
||||
// Set the content
|
||||
ContentWriter writer = contentService.getWriter(recordOne, ContentModel.PROP_CONTENT, true);
|
||||
|
@@ -19,6 +19,7 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.webscript;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase;
|
||||
import org.json.JSONArray;
|
||||
@@ -37,7 +38,7 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
|
||||
public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
|
||||
{
|
||||
/** URLs for the REST API */
|
||||
private static final String GET_CAPABILITIES_URL = "/api/capabilities?";
|
||||
private static final String GET_CAPABILITIES_URL = "/api/node/{0}/{1}/{2}/capabilities?";
|
||||
|
||||
/**
|
||||
* Tests the REST API to get the list of capabilities
|
||||
@@ -47,14 +48,21 @@ public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
|
||||
*/
|
||||
public void testGetCapabilitiesAction() throws IOException, JSONException
|
||||
{
|
||||
String baseURL = MessageFormat.format(GET_CAPABILITIES_URL,
|
||||
filePlan.getStoreRef().getProtocol(),
|
||||
filePlan.getStoreRef().getIdentifier(),
|
||||
filePlan.getId());
|
||||
|
||||
// Format url and send request
|
||||
String getUrl = String.format(GET_CAPABILITIES_URL + "includeAll=%s", true);
|
||||
String getUrl = String.format(baseURL + "includeAll=%s", true);
|
||||
Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
|
||||
|
||||
// Check the content from the response
|
||||
String getContentAsString = getResponse.getContentAsString();
|
||||
assertNotNull(getContentAsString);
|
||||
|
||||
System.out.println(getContentAsString);
|
||||
|
||||
// Convert the response to json and check the data
|
||||
JSONObject getContentAsJson = new JSONObject(getContentAsString);
|
||||
JSONObject getData = getContentAsJson.getJSONObject("data");
|
||||
@@ -65,7 +73,7 @@ public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
|
||||
assertNotNull(getDataSets);
|
||||
|
||||
// Format url and send another request with different parameter
|
||||
getUrl = String.format(GET_CAPABILITIES_URL + "grouped=%s", true);
|
||||
getUrl = String.format(baseURL + "grouped=%s", true);
|
||||
getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
|
||||
|
||||
// Check the content from the response
|
||||
@@ -73,7 +81,7 @@ public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
|
||||
assertNotNull(getContentAsString);
|
||||
|
||||
// If both parameters are specified the result should be the same with only specifying the "grouped" parameter
|
||||
getUrl = String.format(GET_CAPABILITIES_URL + "includeAll=%s&grouped=%s", true, true);
|
||||
getUrl = String.format(baseURL + "includeAll=%s&grouped=%s", true, true);
|
||||
getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
|
||||
getContentAsString.equalsIgnoreCase(getResponse.getContentAsString());
|
||||
|
||||
|
@@ -127,7 +127,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
|
||||
|
||||
// create a new recordCategory node in the recordSeries and then get
|
||||
// the disposition schedule
|
||||
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
|
||||
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
|
||||
dispositionService.createDispositionSchedule(newRecordCategory, null);
|
||||
|
||||
categoryNodeUrl = newRecordCategory.toString().replace("://", "/");
|
||||
@@ -154,7 +154,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
|
||||
{
|
||||
// create a new recordCategory node in the recordSeries and then get
|
||||
// the disposition schedule
|
||||
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
|
||||
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
|
||||
dispositionService.createDispositionSchedule(newRecordCategory, null);
|
||||
|
||||
String categoryNodeUrl = newRecordCategory.toString().replace("://", "/");
|
||||
@@ -232,7 +232,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
|
||||
|
||||
public void testPutDispositionAction() throws Exception
|
||||
{
|
||||
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
|
||||
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
|
||||
dispositionService.createDispositionSchedule(newRecordCategory, null);
|
||||
|
||||
// create an action definition to then update
|
||||
@@ -301,7 +301,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
|
||||
|
||||
public void testDeleteDispositionAction() throws Exception
|
||||
{
|
||||
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
|
||||
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
|
||||
dispositionService.createDispositionSchedule(newRecordCategory, null);
|
||||
|
||||
// create an action definition to then delete
|
||||
|
Reference in New Issue
Block a user