mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-01 14:41:46 +00:00
Removed applicationContext from the java classes where possible and used dependency injection instead.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@58099 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,67 +22,52 @@ import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
|
||||
/**
|
||||
* Record service implementation unit test.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class CreateRecordActionTest extends BaseRMTestCase
|
||||
{
|
||||
/** Services */
|
||||
protected ActionService dmActionService;
|
||||
protected PermissionService dmPermissionService;
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
dmActionService = (ActionService)applicationContext.getBean("ActionService");
|
||||
dmPermissionService = (PermissionService)applicationContext.getBean("PermissionService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isUserTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean isCollaborationSiteTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void testCreateRecordAction()
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
public Void run()
|
||||
{
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
Action action = dmActionService.createAction(CreateRecordAction.NAME);
|
||||
{
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
Action action = actionService.createAction(CreateRecordAction.NAME);
|
||||
action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false);
|
||||
action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan);
|
||||
dmActionService.executeAction(action, dmDocument);
|
||||
|
||||
actionService.executeAction(action, dmDocument);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test(Void result) throws Exception
|
||||
|
||||
public void test(Void result) throws Exception
|
||||
{
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, dmPermissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
};
|
||||
},
|
||||
dmCollaborator);
|
||||
}
|
||||
},
|
||||
dmCollaborator);
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@ import org.alfresco.module.org_alfresco_module_rm.action.impl.FileToAction;
|
||||
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.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
@@ -50,15 +49,6 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
|
||||
private static final String PATH_SUB1 = "rmcontainer/${node.cm:title}";
|
||||
|
||||
protected ActionService dmActionService;
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
dmActionService = (ActionService) applicationContext.getBean("ActionService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCollaborationSiteTest()
|
||||
{
|
||||
@@ -92,7 +82,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
params.put(FileToAction.PARAM_DESTINATION_RECORD_FOLDER, rmFolder);
|
||||
|
||||
// execute file-to action
|
||||
actionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
|
||||
// check things have gone according to plan
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
@@ -114,7 +104,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
public Void run()
|
||||
{
|
||||
nodeService.setProperty(dmDocument, ContentModel.PROP_TITLE, "mytestvalue");
|
||||
|
||||
|
||||
// create record from document
|
||||
recordService.createRecord(filePlan, dmDocument);
|
||||
|
||||
@@ -144,7 +134,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
params.put(FileToAction.PARAM_PATH, PATH);
|
||||
|
||||
// execute file-to action
|
||||
actionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
|
||||
// check things have gone according to plan
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
@@ -172,7 +162,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
params.put(FileToAction.PARAM_PATH, PATH2);
|
||||
|
||||
// execute file-to action
|
||||
actionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
|
||||
// check things have gone according to plan
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
@@ -222,7 +212,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
params.put(FileToAction.PARAM_CREATE_RECORD_FOLDER, true);
|
||||
|
||||
// execute file-to action
|
||||
actionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
|
||||
// show the folder has now been created
|
||||
createdRecordFolder = fileFolderService.resolveNamePath(filePlan, new ArrayList<String>(Arrays.asList(pathValues)), false);
|
||||
@@ -277,7 +267,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
params.put(FileToAction.PARAM_PATH, PATH_BAD);
|
||||
|
||||
// execute file-to action
|
||||
actionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -295,7 +285,7 @@ public class FileToActionTest extends BaseRMTestCase
|
||||
params.put(FileToAction.PARAM_PATH, PATH_CREATE);
|
||||
|
||||
// execute file-to action
|
||||
actionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(dmDocument, FileToAction.NAME, params);
|
||||
|
||||
}
|
||||
});
|
||||
|
@@ -25,7 +25,6 @@ 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;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
@@ -36,17 +35,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
*/
|
||||
public class HideRecordActionTest extends BaseRMTestCase
|
||||
{
|
||||
/** Services */
|
||||
protected ActionService dmActionService;
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
dmActionService = (ActionService) applicationContext.getBean("ActionService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isUserTest()
|
||||
{
|
||||
@@ -82,9 +70,9 @@ public class HideRecordActionTest extends BaseRMTestCase
|
||||
NodeRef doc = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
|
||||
// Create a record from that document
|
||||
Action createAction = dmActionService.createAction(CreateRecordAction.NAME);
|
||||
Action createAction = actionService.createAction(CreateRecordAction.NAME);
|
||||
createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan);
|
||||
dmActionService.executeAction(createAction, doc);
|
||||
actionService.executeAction(createAction, doc);
|
||||
|
||||
// Check if the document is a record now
|
||||
assertTrue(recordService.isRecord(doc));
|
||||
@@ -96,8 +84,8 @@ public class HideRecordActionTest extends BaseRMTestCase
|
||||
assertTrue(nodeService.getParentAssocs(doc).size() == 2);
|
||||
|
||||
// Hide the document. The user has the write permissions so he should be able to hide it
|
||||
Action hideAction = dmActionService.createAction(HideRecordAction.NAME);
|
||||
dmActionService.executeAction(hideAction, doc);
|
||||
Action hideAction = actionService.createAction(HideRecordAction.NAME);
|
||||
actionService.executeAction(hideAction, doc);
|
||||
|
||||
// The document should be removed from the collaboration site
|
||||
assertTrue(nodeService.getParentAssocs(doc).size() == 1);
|
||||
|
@@ -20,10 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.test.action;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
|
||||
/**
|
||||
* Reject Action Unit Test
|
||||
@@ -33,22 +31,9 @@ import org.alfresco.service.cmr.action.ActionService;
|
||||
*/
|
||||
public class RejectActionTest extends BaseRMTestCase
|
||||
{
|
||||
/** Services */
|
||||
protected ActionService rmActionService;
|
||||
protected ExtendedSecurityService extendedSecurityService;
|
||||
|
||||
/** Reject reason */
|
||||
private final String REJECT_REASON = "rejectReason:Not valid!£$%^&*()_+";
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
rmActionService = (ActionService) applicationContext.getBean("ActionService");
|
||||
extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isUserTest()
|
||||
{
|
||||
@@ -68,9 +53,9 @@ public class RejectActionTest extends BaseRMTestCase
|
||||
public Void run()
|
||||
{
|
||||
// Create a record from the document
|
||||
Action createAction = rmActionService.createAction(CreateRecordAction.NAME);
|
||||
Action createAction = actionService.createAction(CreateRecordAction.NAME);
|
||||
createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan);
|
||||
rmActionService.executeAction(createAction, dmDocument);
|
||||
actionService.executeAction(createAction, dmDocument);
|
||||
|
||||
// Check if the document is a record now
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
@@ -91,8 +76,8 @@ public class RejectActionTest extends BaseRMTestCase
|
||||
public void run()
|
||||
{
|
||||
// The test should fail if the reject reason is not supplied
|
||||
Action rejectAction = rmActionService.createAction(RejectAction.NAME);
|
||||
rmActionService.executeAction(rejectAction, dmDocument);
|
||||
Action rejectAction = actionService.createAction(RejectAction.NAME);
|
||||
actionService.executeAction(rejectAction, dmDocument);
|
||||
}
|
||||
},
|
||||
dmCollaborator);
|
||||
@@ -102,9 +87,9 @@ public class RejectActionTest extends BaseRMTestCase
|
||||
public Void run()
|
||||
{
|
||||
// Create the reject action and add the reject reason
|
||||
Action rejectAction = rmActionService.createAction(RejectAction.NAME);
|
||||
Action rejectAction = actionService.createAction(RejectAction.NAME);
|
||||
rejectAction.setParameterValue(RejectAction.PARAM_REASON, REJECT_REASON);
|
||||
rmActionService.executeAction(rejectAction, dmDocument);
|
||||
actionService.executeAction(rejectAction, dmDocument);
|
||||
|
||||
// The "record" aspect should be removed
|
||||
assertFalse(nodeService.hasAspect(dmDocument, ASPECT_RECORD));
|
||||
|
@@ -48,12 +48,6 @@ public class RM1008Test extends BaseRMTestCase
|
||||
{
|
||||
private String myUser;
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRecordTest()
|
||||
{
|
||||
@@ -260,8 +254,8 @@ public class RM1008Test extends BaseRMTestCase
|
||||
@Override
|
||||
public NodeRef run()
|
||||
{
|
||||
actionService.executeRecordsManagementAction(transferFolder, "cutoff");
|
||||
actionService.executeRecordsManagementAction(transferFolder, "transfer");
|
||||
rmActionService.executeRecordsManagementAction(transferFolder, "cutoff");
|
||||
rmActionService.executeRecordsManagementAction(transferFolder, "transfer");
|
||||
|
||||
NodeRef transferContainer = filePlanService.getTransferContainer(filePlan);
|
||||
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(transferContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
|
@@ -156,10 +156,10 @@ public class RM1039Test extends BaseRMTestCase
|
||||
// complete event
|
||||
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
||||
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
||||
actionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(testFolder, CompleteEventAction.NAME, params);
|
||||
|
||||
// cutoff folder
|
||||
actionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME);
|
||||
rmActionService.executeRecordsManagementAction(testFolder, CutOffAction.NAME);
|
||||
|
||||
// take a look at the move capability
|
||||
Capability moveCapability = capabilityService.getCapability("Move");
|
||||
|
@@ -24,8 +24,6 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionPropertySubs;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
|
||||
/**
|
||||
* Extended action service test.
|
||||
@@ -35,10 +33,6 @@ import org.alfresco.service.cmr.security.PermissionService;
|
||||
*/
|
||||
public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
{
|
||||
/** Services */
|
||||
protected ActionService dmActionService;
|
||||
protected PermissionService dmPermissionService;
|
||||
|
||||
/** Action names */
|
||||
public static final String TEST_ACTION = "testAction";
|
||||
public static final String TEST_ACTION_2 = "testAction2";
|
||||
@@ -47,14 +41,6 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
public static final String RECORD_AND_FOLDER_ONLY_ACTION = "recordandFolderOnlyAction";
|
||||
public static final String DELEGATE_ACTION = "rmDelegateAction";
|
||||
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
dmActionService = (ActionService) applicationContext.getBean("ActionService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isUserTest()
|
||||
{
|
||||
@@ -81,7 +67,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
{
|
||||
public Void run()
|
||||
{
|
||||
List<ActionDefinition> result = dmActionService.getActionDefinitions(recordOne);
|
||||
List<ActionDefinition> result = actionService.getActionDefinitions(recordOne);
|
||||
assertNotNull(result);
|
||||
assertFalse(containsAction(result, TEST_ACTION));
|
||||
assertTrue(containsAction(result, TEST_ACTION_2));
|
||||
@@ -90,7 +76,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION));
|
||||
assertTrue(containsAction(result, DELEGATE_ACTION));
|
||||
|
||||
result = dmActionService.getActionDefinitions(rmFolder);
|
||||
result = actionService.getActionDefinitions(rmFolder);
|
||||
assertNotNull(result);
|
||||
assertFalse(containsAction(result, TEST_ACTION));
|
||||
assertTrue(containsAction(result, TEST_ACTION_2));
|
||||
@@ -99,7 +85,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
assertTrue(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION));
|
||||
assertFalse(containsAction(result, DELEGATE_ACTION));
|
||||
|
||||
result = dmActionService.getActionDefinitions(rmContainer);
|
||||
result = actionService.getActionDefinitions(rmContainer);
|
||||
assertNotNull(result);
|
||||
assertFalse(containsAction(result, TEST_ACTION));
|
||||
assertTrue(containsAction(result, TEST_ACTION_2));
|
||||
@@ -108,7 +94,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION));
|
||||
assertFalse(containsAction(result, DELEGATE_ACTION));
|
||||
|
||||
result = dmActionService.getActionDefinitions(dmDocument);
|
||||
result = actionService.getActionDefinitions(dmDocument);
|
||||
assertNotNull(result);
|
||||
assertFalse(containsAction(result, TEST_ACTION));
|
||||
assertFalse(containsAction(result, TEST_ACTION_2));
|
||||
@@ -117,7 +103,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
assertFalse(containsAction(result, RECORD_AND_FOLDER_ONLY_ACTION));
|
||||
assertFalse(containsAction(result, DELEGATE_ACTION));
|
||||
|
||||
result = dmActionService.getActionDefinitions(dmFolder);
|
||||
result = actionService.getActionDefinitions(dmFolder);
|
||||
assertNotNull(result);
|
||||
assertFalse(containsAction(result, TEST_ACTION));
|
||||
assertFalse(containsAction(result, TEST_ACTION_2));
|
||||
@@ -153,7 +139,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
{
|
||||
public Void run()
|
||||
{
|
||||
Action action = dmActionService.createAction(TestActionPropertySubs.NAME);
|
||||
Action action = actionService.createAction(TestActionPropertySubs.NAME);
|
||||
|
||||
action.setParameterValue("dayShort", "${date.day.short}");
|
||||
action.setParameterValue("dayShort2", "${date.day}");
|
||||
@@ -177,7 +163,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase
|
||||
|
||||
action.setParameterValue("combo", "${date.year.long}/${date.month.short}/${node.cm:name}-${message.test.company}.txt");
|
||||
|
||||
dmActionService.executeAction(action, rmFolder);
|
||||
actionService.executeAction(action, rmFolder);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -36,8 +35,6 @@ import org.alfresco.util.GUID;
|
||||
*/
|
||||
public class ExtendedSecurityServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
private ExtendedSecurityService extendedSecurityService;
|
||||
|
||||
private NodeRef record;
|
||||
private NodeRef recordToo;
|
||||
private NodeRef moveRecordCategory;
|
||||
@@ -49,14 +46,6 @@ public class ExtendedSecurityServiceImplTest extends BaseRMTestCase
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
extendedSecurityService = (ExtendedSecurityService)applicationContext.getBean("ExtendedSecurityService");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupTestDataImpl()
|
||||
{
|
||||
|
@@ -31,53 +31,30 @@ import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessPermission;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
/**
|
||||
* Records Service Implementation Test
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @author Tuna Aksoy
|
||||
* @since 2.1
|
||||
*/
|
||||
public class RecordServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
/** Services */
|
||||
protected ActionService dmActionService;
|
||||
|
||||
protected PermissionService dmPermissionService;
|
||||
|
||||
protected ExtendedSecurityService extendedSecurityService;
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices()
|
||||
*/
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
dmActionService = (ActionService) applicationContext.getBean("ActionService");
|
||||
dmPermissionService = (PermissionService) applicationContext.getBean("PermissionService");
|
||||
extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a user test
|
||||
*
|
||||
*
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest()
|
||||
*/
|
||||
@Override
|
||||
@@ -88,7 +65,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
|
||||
/**
|
||||
* This is a record test
|
||||
*
|
||||
*
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest()
|
||||
*/
|
||||
@Override
|
||||
@@ -126,7 +103,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
|
||||
/**
|
||||
* Helper method for getting a list of record meta data aspects
|
||||
*
|
||||
*
|
||||
* @return Record meta data aspects as list
|
||||
*/
|
||||
private List<QName> getAspectList()
|
||||
@@ -193,85 +170,85 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void testExtendedWriters() throws Exception
|
||||
{
|
||||
final ExtendedReaderDynamicAuthority readerDy = (ExtendedReaderDynamicAuthority)applicationContext.getBean("extendedReaderDynamicAuthority");
|
||||
final ExtendedWriterDynamicAuthority writerDy = (ExtendedWriterDynamicAuthority)applicationContext.getBean("extendedWriterDynamicAuthority");
|
||||
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
{
|
||||
assertNull(extendedSecurityService.getExtendedReaders(recordOne));
|
||||
assertNull(extendedSecurityService.getExtendedWriters(recordOne));
|
||||
|
||||
|
||||
assertFalse(readerDy.hasAuthority(recordOne, dmCollaborator));
|
||||
assertFalse(writerDy.hasAuthority(recordOne, dmCollaborator));
|
||||
|
||||
|
||||
assertFalse(readerDy.hasAuthority(filePlan, dmCollaborator));
|
||||
assertFalse(writerDy.hasAuthority(filePlan, dmCollaborator));
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, dmCollaborator);
|
||||
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
{
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING));
|
||||
|
||||
|
||||
assertFalse(readerDy.hasAuthority(recordOne, dmCollaborator));
|
||||
assertFalse(writerDy.hasAuthority(recordOne, dmCollaborator));
|
||||
|
||||
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA));
|
||||
|
||||
|
||||
assertFalse(readerDy.hasAuthority(filePlan, dmCollaborator));
|
||||
assertFalse(writerDy.hasAuthority(filePlan, dmCollaborator));
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, dmCollaborator);
|
||||
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
{
|
||||
Set<String> writers = new HashSet<String>(1);
|
||||
writers.add(dmCollaborator);
|
||||
extendedSecurityService.addExtendedSecurity(recordOne, null, writers);
|
||||
|
||||
|
||||
assertNull(extendedSecurityService.getExtendedReaders(recordOne));
|
||||
assertFalse(extendedSecurityService.getExtendedWriters(recordOne).isEmpty());
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
{
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.FILING));
|
||||
|
||||
|
||||
assertFalse(readerDy.hasAuthority(recordOne, dmCollaborator));
|
||||
assertTrue(writerDy.hasAuthority(recordOne, dmCollaborator));
|
||||
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA));
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, dmCollaborator);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -308,7 +285,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
AccessStatus.DENIED, // record folder
|
||||
AccessStatus.DENIED); // doc/record
|
||||
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan,
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
checkPermissions(FILING, AccessStatus.DENIED, // file plan
|
||||
@@ -325,10 +302,10 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
AccessStatus.DENIED, // record category
|
||||
AccessStatus.DENIED, // record folder
|
||||
AccessStatus.ALLOWED); // doc/record
|
||||
|
||||
|
||||
permissionReport();
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, dmPermissionService.hasPermission(filePlan,
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
checkPermissions(FILING, AccessStatus.DENIED, // file plan
|
||||
@@ -353,9 +330,9 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
// ****
|
||||
// Capability Tests
|
||||
// ****
|
||||
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.EDIT_NON_RECORD_METADATA));
|
||||
|
||||
@@ -410,7 +387,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
}
|
||||
}, dmConsumer);
|
||||
}
|
||||
|
||||
|
||||
private void permissionReport()
|
||||
{
|
||||
Set<String> writers = extendedSecurityService.getExtendedWriters(dmDocument);
|
||||
@@ -418,30 +395,28 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
System.out.println("writer: " + writer);
|
||||
}
|
||||
|
||||
|
||||
System.out.println("Users assigned to extended writers role:");
|
||||
Set<String> assignedUsers = filePlanRoleService.getUsersAssignedToRole(filePlan, FilePlanRoleService.ROLE_EXTENDED_WRITERS);
|
||||
for (String assignedUser : assignedUsers)
|
||||
{
|
||||
System.out.println(" ... " + assignedUser);
|
||||
System.out.println(" ... " + assignedUser);
|
||||
}
|
||||
|
||||
PermissionService ps = (PermissionService)applicationContext.getBean("permissionService");
|
||||
|
||||
Set<AccessPermission> perms = ps.getAllSetPermissions(filePlan);
|
||||
Set<AccessPermission> perms = permissionService.getAllSetPermissions(filePlan);
|
||||
for (AccessPermission perm : perms)
|
||||
{
|
||||
if (perm.getPermission().contains(RMPermissionModel.EDIT_NON_RECORD_METADATA))
|
||||
{
|
||||
System.out.println(" ... " + perm.getAuthority() + " - " + perm.getPermission() + " - " + perm.getAccessStatus().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (AccessPermission perm : perms)
|
||||
{
|
||||
if (perm.getPermission().contains(RMPermissionModel.VIEW_RECORDS))
|
||||
{
|
||||
System.out.println(" ... " + perm.getAuthority() + " - " + perm.getPermission() + " - " + perm.getAccessStatus().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +450,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
AccessStatus.DENIED, // record folder
|
||||
AccessStatus.DENIED); // doc/record
|
||||
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan,
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
checkPermissions(FILING, AccessStatus.DENIED, // file plan
|
||||
@@ -492,7 +467,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
AccessStatus.DENIED, // record folder
|
||||
AccessStatus.DENIED); // doc/record
|
||||
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan,
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
checkPermissions(FILING, AccessStatus.DENIED, // file plan
|
||||
@@ -614,11 +589,11 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
private void checkPermissions(String permission, AccessStatus filePlanExpected, AccessStatus unfiledExpected,
|
||||
AccessStatus recordCatExpected, AccessStatus recordFolderExpected, AccessStatus recordExpected)
|
||||
{
|
||||
assertEquals(filePlanExpected, dmPermissionService.hasPermission(filePlan, permission));
|
||||
assertEquals(unfiledExpected, dmPermissionService.hasPermission(unfiledContainer, permission));
|
||||
assertEquals(recordCatExpected, dmPermissionService.hasPermission(rmContainer, permission));
|
||||
assertEquals(recordFolderExpected, dmPermissionService.hasPermission(rmFolder, permission));
|
||||
assertEquals(recordExpected, dmPermissionService.hasPermission(dmDocument, permission));
|
||||
assertEquals(filePlanExpected, permissionService.hasPermission(filePlan, permission));
|
||||
assertEquals(unfiledExpected, permissionService.hasPermission(unfiledContainer, permission));
|
||||
assertEquals(recordCatExpected, permissionService.hasPermission(rmContainer, permission));
|
||||
assertEquals(recordFolderExpected, permissionService.hasPermission(rmFolder, permission));
|
||||
assertEquals(recordExpected, permissionService.hasPermission(dmDocument, permission));
|
||||
}
|
||||
|
||||
private String createUserWithCapabilties(final String... capabiltyNames)
|
||||
@@ -680,14 +655,14 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
}
|
||||
});
|
||||
|
||||
// test normal user
|
||||
// test normal user
|
||||
doTestInTransaction(new VoidTest()
|
||||
{
|
||||
@Override
|
||||
public void runImpl() throws Exception
|
||||
{
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(recordOne, RMPermissionModel.READ_RECORDS));
|
||||
|
||||
|
||||
assertFalse(recordService.isPropertyEditable(recordOne, PROP_ORIGINATING_ORGANIZATION));
|
||||
assertFalse(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION));
|
||||
assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION));
|
||||
@@ -705,7 +680,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
assertFalse(recordService.isPropertyEditable(recordOne, PROP_ORIGINATING_ORGANIZATION));
|
||||
assertTrue(recordService.isPropertyEditable(recordOne, PROP_DESCRIPTION));
|
||||
assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION));
|
||||
assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION));
|
||||
assertFalse(recordService.isPropertyEditable(recordDeclaredOne, PROP_DESCRIPTION));
|
||||
}
|
||||
}, nonRecordMetadata);
|
||||
|
||||
@@ -737,7 +712,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
}
|
||||
}, declaredRecordMetadata);
|
||||
}
|
||||
|
||||
|
||||
public void testRecordPropertiesUpdate() throws Exception
|
||||
{
|
||||
final String nonRecordMetadata = createUserWithCapabilties(
|
||||
@@ -761,42 +736,42 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
filePlanPermissionService.setPermission(rmFolder, declaredRecordMetadata, RMPermissionModel.FILING);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// test rmadmin
|
||||
canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, rmAdminName);
|
||||
canEditProperty(recordOne, PROP_ORIGINATING_ORGANIZATION, rmAdminName);
|
||||
cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, rmAdminName);
|
||||
canEditProperty(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION, rmAdminName);
|
||||
|
||||
|
||||
// test normal user
|
||||
cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, rmUserName);
|
||||
cantEditProperty(recordOne, PROP_ORIGINATING_ORGANIZATION, rmUserName);
|
||||
cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, rmUserName);
|
||||
cantEditProperty(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION, rmUserName);
|
||||
|
||||
|
||||
// test undeclared record with edit non-record metadata capability
|
||||
canEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata);
|
||||
cantEditProperty(recordOne, PROP_ORIGINATING_ORGANIZATION, nonRecordMetadata);
|
||||
// test declared record with edit non-record metadata capability
|
||||
cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, nonRecordMetadata);
|
||||
cantEditProperty(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION, nonRecordMetadata);
|
||||
|
||||
|
||||
// test undeclared record with edit record metadata capability
|
||||
cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, recordMetadata);
|
||||
canEditProperty(recordOne, PROP_ORIGINATING_ORGANIZATION, recordMetadata);
|
||||
// test declared record with edit record metadata capability
|
||||
cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, recordMetadata);
|
||||
cantEditProperty(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION, recordMetadata);
|
||||
|
||||
|
||||
// test undeclared record with edit declared record metadata capability
|
||||
cantEditProperty(recordOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata);
|
||||
cantEditProperty(recordOne, PROP_ORIGINATING_ORGANIZATION, declaredRecordMetadata);
|
||||
// test declared record with edit declared record metadata capability
|
||||
cantEditProperty(recordDeclaredOne, ContentModel.PROP_DESCRIPTION, declaredRecordMetadata);
|
||||
canEditProperty(recordDeclaredOne, PROP_ORIGINATING_ORGANIZATION, declaredRecordMetadata);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void cantEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception
|
||||
{
|
||||
boolean failure = false;
|
||||
@@ -809,7 +784,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
nodeService.setProperty(nodeRef, property, GUID.generate());
|
||||
}
|
||||
|
||||
|
||||
}, user);
|
||||
}
|
||||
catch (Throwable exception)
|
||||
@@ -817,14 +792,14 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
// expected
|
||||
failure = true;
|
||||
}
|
||||
|
||||
|
||||
// assert fail not failure
|
||||
if (failure == false)
|
||||
{
|
||||
fail("Property should not have been editable.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void canEditProperty(final NodeRef nodeRef, final QName property, String user) throws Exception
|
||||
{
|
||||
doTestInTransaction(new VoidTest()
|
||||
|
@@ -78,9 +78,9 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
createdCustomProperties = new ArrayList<QName>();
|
||||
madeCustomisable = new ArrayList<QName>();
|
||||
super.setUp();
|
||||
createdCustomProperties = new ArrayList<QName>();
|
||||
madeCustomisable = new ArrayList<QName>();
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
protected void setupTestData()
|
||||
{
|
||||
super.setupTestData();
|
||||
super.setupTestData();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
@Override
|
||||
public Object execute() throws Throwable
|
||||
@@ -108,13 +108,13 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
|
||||
for (QName createdCustomProperty : createdCustomProperties)
|
||||
{
|
||||
adminService.removeCustomPropertyDefinition(createdCustomProperty);
|
||||
}
|
||||
rmAdminService.removeCustomPropertyDefinition(createdCustomProperty);
|
||||
}
|
||||
|
||||
for (QName customisable : madeCustomisable)
|
||||
{
|
||||
adminService.unmakeCustomisable(customisable);
|
||||
}
|
||||
rmAdminService.unmakeCustomisable(customisable);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -128,24 +128,24 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
*/
|
||||
public void testGetCustomisable() throws Exception
|
||||
{
|
||||
// Get the customisable types
|
||||
doTestInTransaction(new Test<Void>()
|
||||
// Get the customisable types
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
Set<QName> list = adminService.getCustomisable();
|
||||
assertNotNull(list);
|
||||
assertTrue(list.containsAll(
|
||||
CollectionUtils.arrayToList(new QName[]
|
||||
{
|
||||
ASPECT_RECORD,
|
||||
TYPE_RECORD_FOLDER,
|
||||
TYPE_NON_ELECTRONIC_DOCUMENT,
|
||||
TYPE_RECORD_CATEGORY
|
||||
})));
|
||||
Set<QName> list = rmAdminService.getCustomisable();
|
||||
assertNotNull(list);
|
||||
assertTrue(list.containsAll(
|
||||
CollectionUtils.arrayToList(new QName[]
|
||||
{
|
||||
ASPECT_RECORD,
|
||||
TYPE_RECORD_FOLDER,
|
||||
TYPE_NON_ELECTRONIC_DOCUMENT,
|
||||
TYPE_RECORD_CATEGORY
|
||||
})));
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -153,17 +153,17 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
/**
|
||||
* @see RecordsManagementAdminService#isCustomisable(QName)
|
||||
*/
|
||||
public void testIsCustomisable() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
public void testIsCustomisable() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
assertFalse(adminService.isCustomisable(TYPE_CONTENT));
|
||||
assertFalse(adminService.isCustomisable(ASPECT_DUBLINCORE));
|
||||
assertTrue(adminService.isCustomisable(TYPE_RECORD_FOLDER));
|
||||
assertTrue(adminService.isCustomisable(ASPECT_RECORD));
|
||||
assertFalse(rmAdminService.isCustomisable(TYPE_CONTENT));
|
||||
assertFalse(rmAdminService.isCustomisable(ASPECT_DUBLINCORE));
|
||||
assertTrue(rmAdminService.isCustomisable(TYPE_RECORD_FOLDER));
|
||||
assertTrue(rmAdminService.isCustomisable(ASPECT_RECORD));
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -177,192 +177,192 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
*/
|
||||
public void testAddCustomPropertyDefinition() throws Exception
|
||||
{
|
||||
// Add property to Record (id specified, short version)
|
||||
doTestInTransaction(new Test<QName>()
|
||||
// Add property to Record (id specified, short version)
|
||||
doTestInTransaction(new Test<QName>()
|
||||
{
|
||||
@Override
|
||||
public QName run() throws Exception
|
||||
{
|
||||
// Check the property does not exist
|
||||
assertFalse(adminService.existsCustomProperty(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1")));
|
||||
// Check the property does not exist
|
||||
assertFalse(rmAdminService.existsCustomProperty(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1")));
|
||||
|
||||
return adminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"),
|
||||
ASPECT_RECORD,
|
||||
"Label1",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
return rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"),
|
||||
ASPECT_RECORD,
|
||||
"Label1",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(QName result) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), result);
|
||||
assertTrue(adminService.existsCustomProperty(result));
|
||||
try
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"), result);
|
||||
assertTrue(rmAdminService.existsCustomProperty(result));
|
||||
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = adminService.getCustomPropertyDefinitions(ASPECT_RECORD);
|
||||
assertNotNull(propDefs);
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD);
|
||||
assertNotNull(propDefs);
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label1", propDef.getTitle(dictionaryService));
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Store the created property for cleanup later
|
||||
createdCustomProperties.add(result);
|
||||
}
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label1", propDef.getTitle(dictionaryService));
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Store the created property for cleanup later
|
||||
createdCustomProperties.add(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Add property to record (no id, short version)
|
||||
doTestInTransaction(new Test<QName>()
|
||||
// Add property to record (no id, short version)
|
||||
doTestInTransaction(new Test<QName>()
|
||||
{
|
||||
@Override
|
||||
public QName run() throws Exception
|
||||
{
|
||||
return adminService.addCustomPropertyDefinition(
|
||||
null,
|
||||
ASPECT_RECORD,
|
||||
"Label2",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
return rmAdminService.addCustomPropertyDefinition(
|
||||
null,
|
||||
ASPECT_RECORD,
|
||||
"Label2",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(QName result) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI());
|
||||
assertTrue(adminService.existsCustomProperty(result));
|
||||
try
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI());
|
||||
assertTrue(rmAdminService.existsCustomProperty(result));
|
||||
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = adminService.getCustomPropertyDefinitions(ASPECT_RECORD);
|
||||
assertNotNull(propDefs);
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD);
|
||||
assertNotNull(propDefs);
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label2", propDef.getTitle(dictionaryService));
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Store the created property for cleanup later
|
||||
createdCustomProperties.add(result);
|
||||
}
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label2", propDef.getTitle(dictionaryService));
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Store the created property for cleanup later
|
||||
createdCustomProperties.add(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Add property to record (long version)
|
||||
doTestInTransaction(new Test<QName>()
|
||||
// Add property to record (long version)
|
||||
doTestInTransaction(new Test<QName>()
|
||||
{
|
||||
@Override
|
||||
public QName run() throws Exception
|
||||
{
|
||||
return adminService.addCustomPropertyDefinition(
|
||||
null,
|
||||
ASPECT_RECORD,
|
||||
"Label3",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description",
|
||||
"default",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null);
|
||||
return rmAdminService.addCustomPropertyDefinition(
|
||||
null,
|
||||
ASPECT_RECORD,
|
||||
"Label3",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description",
|
||||
"default",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(QName result) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI());
|
||||
assertTrue(adminService.existsCustomProperty(result));
|
||||
try
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(RecordsManagementCustomModel.RM_CUSTOM_URI, result.getNamespaceURI());
|
||||
assertTrue(rmAdminService.existsCustomProperty(result));
|
||||
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = adminService.getCustomPropertyDefinitions(ASPECT_RECORD);
|
||||
assertNotNull(propDefs);
|
||||
//assertEquals(3, propDefs.size());
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_RECORD);
|
||||
assertNotNull(propDefs);
|
||||
//assertEquals(3, propDefs.size());
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label3", propDef.getTitle(dictionaryService));
|
||||
assertEquals("default", propDef.getDefaultValue());
|
||||
assertFalse(propDef.isMandatory());
|
||||
assertFalse(propDef.isMultiValued());
|
||||
assertFalse(propDef.isProtected());
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label3", propDef.getTitle(dictionaryService));
|
||||
assertEquals("default", propDef.getDefaultValue());
|
||||
assertFalse(propDef.isMandatory());
|
||||
assertFalse(propDef.isMultiValued());
|
||||
assertFalse(propDef.isProtected());
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Store the created property for cleanup later
|
||||
createdCustomProperties.add(result);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Store the created property for cleanup later
|
||||
createdCustomProperties.add(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: Add a property with the same name twice
|
||||
doTestInTransaction(new FailureTest
|
||||
// Failure: Add a property with the same name twice
|
||||
doTestInTransaction(new FailureTest
|
||||
(
|
||||
"Can not create a property with the same id twice",
|
||||
CustomMetadataException.class
|
||||
)
|
||||
{
|
||||
@Override
|
||||
public void run() throws Exception
|
||||
{
|
||||
adminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"),
|
||||
ASPECT_RECORD,
|
||||
"Label1",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: Try and add a property to a type that isn't customisable
|
||||
doTestInTransaction(new FailureTest
|
||||
(
|
||||
"Can not add a custom property to a type that isn't registered as customisable",
|
||||
"Can not create a property with the same id twice",
|
||||
CustomMetadataException.class
|
||||
)
|
||||
{
|
||||
@Override
|
||||
public void run() throws Exception
|
||||
{
|
||||
adminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myContentProp"),
|
||||
TYPE_CONTENT,
|
||||
"Label1",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myRecordProp1"),
|
||||
ASPECT_RECORD,
|
||||
"Label1",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
});
|
||||
|
||||
// Failure: Try and add a property to a type that isn't customisable
|
||||
doTestInTransaction(new FailureTest
|
||||
(
|
||||
"Can not add a custom property to a type that isn't registered as customisable",
|
||||
CustomMetadataException.class
|
||||
)
|
||||
{
|
||||
@Override
|
||||
public void run() throws Exception
|
||||
{
|
||||
rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myContentProp"),
|
||||
TYPE_CONTENT,
|
||||
"Label1",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -372,47 +372,47 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
*/
|
||||
public void testMakeCustomisable() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<QName>()
|
||||
doTestInTransaction(new Test<QName>()
|
||||
{
|
||||
@Override
|
||||
public QName run() throws Exception
|
||||
{
|
||||
// Make a type customisable
|
||||
assertFalse(adminService.isCustomisable(TYPE_CUSTOM_TYPE));
|
||||
adminService.makeCustomisable(TYPE_CUSTOM_TYPE);
|
||||
madeCustomisable.add(TYPE_CUSTOM_TYPE);
|
||||
assertTrue(adminService.isCustomisable(TYPE_CUSTOM_TYPE));
|
||||
// Make a type customisable
|
||||
assertFalse(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE));
|
||||
rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE);
|
||||
madeCustomisable.add(TYPE_CUSTOM_TYPE);
|
||||
assertTrue(rmAdminService.isCustomisable(TYPE_CUSTOM_TYPE));
|
||||
|
||||
// Add a custom property
|
||||
return adminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"),
|
||||
TYPE_CUSTOM_TYPE,
|
||||
"Label",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
// Add a custom property
|
||||
return rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"),
|
||||
TYPE_CUSTOM_TYPE,
|
||||
"Label",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(QName result) throws Exception
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), result);
|
||||
assertTrue(adminService.existsCustomProperty(result));
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"), result);
|
||||
assertTrue(rmAdminService.existsCustomProperty(result));
|
||||
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = adminService.getCustomPropertyDefinitions(TYPE_CUSTOM_TYPE);
|
||||
assertNotNull(propDefs);
|
||||
assertEquals(1, propDefs.size());
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = rmAdminService.getCustomPropertyDefinitions(TYPE_CUSTOM_TYPE);
|
||||
assertNotNull(propDefs);
|
||||
assertEquals(1, propDefs.size());
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label", propDef.getTitle(dictionaryService));
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label", propDef.getTitle(dictionaryService));
|
||||
|
||||
}
|
||||
});
|
||||
@@ -422,42 +422,42 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public QName run() throws Exception
|
||||
{
|
||||
// Make an aspect customisable
|
||||
assertFalse(adminService.isCustomisable(ASPECT_CUSTOM_ASPECT));
|
||||
adminService.makeCustomisable(ASPECT_CUSTOM_ASPECT);
|
||||
madeCustomisable.add(ASPECT_CUSTOM_ASPECT);
|
||||
assertTrue(adminService.isCustomisable(ASPECT_CUSTOM_ASPECT));
|
||||
// Make an aspect customisable
|
||||
assertFalse(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT));
|
||||
rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT);
|
||||
madeCustomisable.add(ASPECT_CUSTOM_ASPECT);
|
||||
assertTrue(rmAdminService.isCustomisable(ASPECT_CUSTOM_ASPECT));
|
||||
|
||||
// Add a custom property
|
||||
return adminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"),
|
||||
ASPECT_CUSTOM_ASPECT,
|
||||
"Label",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
// Add a custom property
|
||||
return rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"),
|
||||
ASPECT_CUSTOM_ASPECT,
|
||||
"Label",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test(QName result) throws Exception
|
||||
{
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), result);
|
||||
assertTrue(adminService.existsCustomProperty(result));
|
||||
// Check the property QName is correct
|
||||
assertNotNull(result);
|
||||
assertEquals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"), result);
|
||||
assertTrue(rmAdminService.existsCustomProperty(result));
|
||||
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = adminService.getCustomPropertyDefinitions(ASPECT_CUSTOM_ASPECT);
|
||||
assertNotNull(propDefs);
|
||||
assertEquals(1, propDefs.size());
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
// Check that property is available as a custom property
|
||||
Map<QName, PropertyDefinition> propDefs = rmAdminService.getCustomPropertyDefinitions(ASPECT_CUSTOM_ASPECT);
|
||||
assertNotNull(propDefs);
|
||||
assertEquals(1, propDefs.size());
|
||||
assertTrue(propDefs.containsKey(result));
|
||||
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label", propDef.getTitle(dictionaryService));
|
||||
// Check the property definition
|
||||
PropertyDefinition propDef = propDefs.get(result);
|
||||
assertNotNull(propDef);
|
||||
assertEquals(DataTypeDefinition.TEXT, propDef.getDataType().getName());
|
||||
assertEquals("Description", propDef.getDescription(dictionaryService));
|
||||
assertEquals("Label", propDef.getTitle(dictionaryService));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -470,18 +470,18 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public QName run() throws Exception
|
||||
{
|
||||
adminService.makeCustomisable(TYPE_CUSTOM_TYPE);
|
||||
rmAdminService.makeCustomisable(TYPE_CUSTOM_TYPE);
|
||||
madeCustomisable.add(TYPE_CUSTOM_TYPE);
|
||||
adminService.addCustomPropertyDefinition(
|
||||
rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewProperty"),
|
||||
TYPE_CUSTOM_TYPE,
|
||||
"Label",
|
||||
DataTypeDefinition.TEXT,
|
||||
"Title",
|
||||
"Description");
|
||||
adminService.makeCustomisable(ASPECT_CUSTOM_ASPECT);
|
||||
rmAdminService.makeCustomisable(ASPECT_CUSTOM_ASPECT);
|
||||
madeCustomisable.add(ASPECT_CUSTOM_ASPECT);
|
||||
adminService.addCustomPropertyDefinition(
|
||||
rmAdminService.addCustomPropertyDefinition(
|
||||
QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "myNewAspectProperty"),
|
||||
ASPECT_CUSTOM_ASPECT,
|
||||
"Label",
|
||||
@@ -530,18 +530,18 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
|
||||
public void testCreateAndUseCustomChildReference() throws Exception
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
long now = System.currentTimeMillis();
|
||||
createAndUseCustomReference(CustomReferenceType.PARENT_CHILD, null, "superseded" + now, "superseding" + now);
|
||||
}
|
||||
|
||||
public void testCreateAndUseCustomNonChildReference() throws Exception
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
createAndUseCustomReference(CustomReferenceType.BIDIRECTIONAL, "supporting" + now, null, null);
|
||||
createAndUseCustomReference(CustomReferenceType.BIDIRECTIONAL, "supporting" + now, null, null);
|
||||
}
|
||||
|
||||
private void createAndUseCustomReference(final CustomReferenceType refType, final String label, final String source, final String target) throws Exception
|
||||
{
|
||||
private void createAndUseCustomReference(final CustomReferenceType refType, final String label, final String source, final String target) throws Exception
|
||||
{
|
||||
final NodeRef testRecord1 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef execute() throws Throwable
|
||||
@@ -577,12 +577,12 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
if (label != null)
|
||||
{
|
||||
// A bidirectional reference
|
||||
qNameResult = adminService.addCustomAssocDefinition(label);
|
||||
qNameResult = rmAdminService.addCustomAssocDefinition(label);
|
||||
}
|
||||
else
|
||||
{
|
||||
// A parent/child reference
|
||||
qNameResult = adminService.addCustomChildAssocDefinition(source, target);
|
||||
qNameResult = rmAdminService.addCustomChildAssocDefinition(source, target);
|
||||
}
|
||||
System.out.println("Creating new " + refType + " reference definition: " + qNameResult);
|
||||
System.out.println(" params- label: '" + label + "' source: '" + source + "' target: '" + target + "'");
|
||||
@@ -596,7 +596,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
// Confirm the custom reference is included in the list from adminService.
|
||||
Map<QName, AssociationDefinition> customRefDefinitions = adminService.getCustomReferenceDefinitions();
|
||||
Map<QName, AssociationDefinition> customRefDefinitions = rmAdminService.getCustomReferenceDefinitions();
|
||||
AssociationDefinition retrievedRefDefn = customRefDefinitions.get(generatedQName);
|
||||
assertNotNull("Custom reference definition from adminService was null.", retrievedRefDefn);
|
||||
assertEquals(generatedQName, retrievedRefDefn.getName());
|
||||
@@ -674,7 +674,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
// Just dump them out for visual inspection
|
||||
System.out.println("Available custom properties:");
|
||||
Map<QName, PropertyDefinition> props = adminService.getCustomPropertyDefinitions();
|
||||
Map<QName, PropertyDefinition> props = rmAdminService.getCustomPropertyDefinitions();
|
||||
for (QName prop : props.keySet())
|
||||
{
|
||||
System.out.println(" - " + prop.toString());
|
||||
@@ -697,7 +697,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
// Just dump them out for visual inspection
|
||||
System.out.println("Available custom references:");
|
||||
Map<QName, AssociationDefinition> references = adminService.getCustomReferenceDefinitions();
|
||||
Map<QName, AssociationDefinition> references = rmAdminService.getCustomReferenceDefinitions();
|
||||
for (QName reference : references.keySet())
|
||||
{
|
||||
System.out.println(" - " + reference.toString());
|
||||
@@ -716,7 +716,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
// Just dump them out for visual inspection
|
||||
System.out.println("Available custom constraints:");
|
||||
List<ConstraintDefinition> constraints = adminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
List<ConstraintDefinition> constraints = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
for (ConstraintDefinition constraint : constraints)
|
||||
{
|
||||
System.out.println(" - " + constraint.getName());
|
||||
@@ -755,8 +755,8 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
utils.declareRecord(testRecord1);
|
||||
utils.declareRecord(testRecord2);
|
||||
utils.declareRecord(testRecord1);
|
||||
utils.declareRecord(testRecord2);
|
||||
|
||||
policyComponent.bindClassBehaviour(
|
||||
RecordsManagementPolicies.BEFORE_CREATE_REFERENCE,
|
||||
@@ -770,7 +770,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
assertFalse(beforeMarker);
|
||||
assertFalse(onMarker);
|
||||
|
||||
adminService.addCustomReference(testRecord1, testRecord2, CUSTOM_REF_VERSIONS);
|
||||
rmAdminService.addCustomReference(testRecord1, testRecord2, CUSTOM_REF_VERSIONS);
|
||||
|
||||
assertTrue(beforeMarker);
|
||||
assertTrue(onMarker);
|
||||
@@ -782,7 +782,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
inTest = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void beforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
|
||||
{
|
||||
@@ -801,7 +801,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
public Integer execute() throws Throwable
|
||||
{
|
||||
List<ConstraintDefinition> result = adminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
List<ConstraintDefinition> result = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
assertNotNull(result);
|
||||
return result.size();
|
||||
}
|
||||
@@ -821,7 +821,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
|
||||
final QName result = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, conLocalName);
|
||||
|
||||
adminService.addCustomConstraintDefinition(result, conTitle, true, allowedValues, MatchLogic.AND);
|
||||
rmAdminService.addCustomConstraintDefinition(result, conTitle, true, allowedValues, MatchLogic.AND);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
@@ -834,7 +834,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
List<ConstraintDefinition> customConstraintDefs = adminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
List<ConstraintDefinition> customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
assertEquals(beforeCnt+1, customConstraintDefs.size());
|
||||
|
||||
boolean found = false;
|
||||
@@ -871,7 +871,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
allowedValues.add("RED");
|
||||
allowedValues.add("YELLOW");
|
||||
|
||||
adminService.changeCustomConstraintValues(testCon, allowedValues);
|
||||
rmAdminService.changeCustomConstraintValues(testCon, allowedValues);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -883,7 +883,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
List<ConstraintDefinition> customConstraintDefs = adminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
List<ConstraintDefinition> customConstraintDefs = rmAdminService.getCustomConstraintDefinitions(RecordsManagementCustomModel.RM_CUSTOM_MODEL);
|
||||
assertEquals(beforeCnt+1, customConstraintDefs.size());
|
||||
|
||||
boolean found = false;
|
||||
@@ -927,7 +927,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
boolean mandatory = false;
|
||||
boolean isProtected = false;
|
||||
|
||||
QName propName = adminService.addCustomPropertyDefinition(null, ASPECT_RECORD, propLocalName, dataType, propTitle, description, defaultValue, multiValued, mandatory, isProtected, testCon);
|
||||
QName propName = rmAdminService.addCustomPropertyDefinition(null, ASPECT_RECORD, propLocalName, dataType, propTitle, description, defaultValue, multiValued, mandatory, isProtected, testCon);
|
||||
createdCustomProperties.add(propName);
|
||||
return null;
|
||||
}
|
||||
|
@@ -50,9 +50,6 @@ import org.alfresco.util.Pair;
|
||||
public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
implements RMPermissionModel
|
||||
{
|
||||
/** Records management audit service */
|
||||
private RecordsManagementAuditService auditService;
|
||||
|
||||
/** Test record */
|
||||
private NodeRef record;
|
||||
|
||||
@@ -76,30 +73,18 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
testStartTime = new Date();
|
||||
|
||||
// Stop and clear the log
|
||||
auditService.stopAuditLog(filePlan);
|
||||
auditService.clearAuditLog(filePlan);
|
||||
auditService.startAuditLog(filePlan);
|
||||
rmAuditService.stopAuditLog(filePlan);
|
||||
rmAuditService.clearAuditLog(filePlan);
|
||||
rmAuditService.startAuditLog(filePlan);
|
||||
|
||||
// check that audit service is started
|
||||
assertTrue(auditService.isAuditLogEnabled(filePlan));
|
||||
assertTrue(rmAuditService.isAuditLogEnabled(filePlan));
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices()
|
||||
*/
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
// get the audit service
|
||||
auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest()
|
||||
*/
|
||||
@@ -143,7 +128,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
List<AuditEvent> events = auditService.getAuditEvents();
|
||||
List<AuditEvent> events = rmAuditService.getAuditEvents();
|
||||
|
||||
System.out.println("Found audit events:");
|
||||
for (AuditEvent event : events)
|
||||
@@ -271,7 +256,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
public void testAdminMethods() throws InterruptedException
|
||||
{
|
||||
// Stop the audit
|
||||
auditService.stopAuditLog(filePlan);
|
||||
rmAuditService.stopAuditLog(filePlan);
|
||||
|
||||
Thread.sleep(5000);
|
||||
|
||||
@@ -291,7 +276,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
result1.size(), result2.size());
|
||||
|
||||
// repeat with a start
|
||||
auditService.startAuditLog(filePlan);
|
||||
rmAuditService.startAuditLog(filePlan);
|
||||
updateTitle(filePlan, rmAdminName);
|
||||
|
||||
Thread.sleep(5000);
|
||||
@@ -305,8 +290,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
Thread.sleep(5000);
|
||||
|
||||
// Stop and delete all entries
|
||||
auditService.stopAuditLog(filePlan);
|
||||
auditService.clearAuditLog(filePlan);
|
||||
rmAuditService.stopAuditLog(filePlan);
|
||||
rmAuditService.clearAuditLog(filePlan);
|
||||
|
||||
// There should be no entries
|
||||
List<RecordsManagementAuditEntry> result4 = getAuditTrail(rmAdminName);
|
||||
@@ -324,9 +309,9 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
|
||||
public void xtestAuditAuthentication()
|
||||
{
|
||||
auditService.stopAuditLog(filePlan);
|
||||
auditService.clearAuditLog(filePlan);
|
||||
auditService.startAuditLog(filePlan);
|
||||
rmAuditService.stopAuditLog(filePlan);
|
||||
rmAuditService.clearAuditLog(filePlan);
|
||||
rmAuditService.startAuditLog(filePlan);
|
||||
|
||||
//MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
|
||||
//PersonService personService = serviceRegistry.getPersonService();
|
||||
@@ -356,7 +341,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
auditService.stopAuditLog(filePlan);
|
||||
rmAuditService.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());
|
||||
@@ -389,8 +374,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
personProperties.put(ContentModel.PROP_LASTNAME, "Dickons");
|
||||
personService.createPerson(personProperties);
|
||||
|
||||
auditService.clearAuditLog(filePlan);
|
||||
auditService.startAuditLog(filePlan);
|
||||
rmAuditService.clearAuditLog(filePlan);
|
||||
rmAuditService.startAuditLog(filePlan);
|
||||
try
|
||||
{
|
||||
AuthenticationUtil.pushAuthentication();
|
||||
@@ -400,7 +385,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
AuthenticationUtil.popAuthentication();
|
||||
}
|
||||
auditService.stopAuditLog(filePlan);
|
||||
rmAuditService.stopAuditLog(filePlan);
|
||||
List<RecordsManagementAuditEntry> result2 = getAuditTrail(rmAdminName);
|
||||
found = false;
|
||||
for (RecordsManagementAuditEntry entry : result2)
|
||||
@@ -435,7 +420,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public List<RecordsManagementAuditEntry> run() throws Exception
|
||||
{
|
||||
return auditService.getAuditTrail(params);
|
||||
return rmAuditService.getAuditTrail(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -21,7 +21,6 @@ package org.alfresco.module.org_alfresco_module_rm.test.service;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
@@ -38,7 +37,6 @@ public class RecordsManagementEventServiceImplTest extends BaseRMTestCase implem
|
||||
{
|
||||
protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
|
||||
|
||||
private RecordsManagementEventService rmEventService;
|
||||
private RetryingTransactionHelper transactionHelper;
|
||||
|
||||
@Override
|
||||
@@ -47,7 +45,6 @@ public class RecordsManagementEventServiceImplTest extends BaseRMTestCase implem
|
||||
super.setUp();
|
||||
|
||||
// Get the service required in the tests
|
||||
this.rmEventService = (RecordsManagementEventService)this.applicationContext.getBean("RecordsManagementEventService");
|
||||
this.transactionHelper = (RetryingTransactionHelper)this.applicationContext.getBean("retryingTransactionHelper");
|
||||
|
||||
// Set the current security context as admin
|
||||
|
@@ -30,7 +30,7 @@ import org.alfresco.util.TestWithUserUtils;
|
||||
|
||||
/**
|
||||
* Search service implementation unit test.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@@ -41,29 +41,27 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static final String SEARCH1 = "search1";
|
||||
private static final String SEARCH2 = "search2";
|
||||
private static final String SEARCH3 = "search3";
|
||||
private static final String SEARCH4 = "search4";
|
||||
|
||||
|
||||
private static final String USER1 = "user1";
|
||||
private static final String USER2 = "user2";
|
||||
|
||||
|
||||
private NodeRef folderLevelRecordFolder;
|
||||
private NodeRef recordLevelRecordFolder;
|
||||
|
||||
|
||||
private NodeRef recordOne;
|
||||
private NodeRef recordTwo;
|
||||
private NodeRef recordThree;
|
||||
private NodeRef recordFour;
|
||||
private NodeRef recordFive;
|
||||
private NodeRef recordSix;
|
||||
|
||||
private MutableAuthenticationService authenticationService;
|
||||
|
||||
|
||||
private int numberOfReports;
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestData()
|
||||
*/
|
||||
@@ -71,28 +69,26 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
protected void setupTestData()
|
||||
{
|
||||
super.setupTestData();
|
||||
|
||||
authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
|
||||
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
// Create test users
|
||||
// Create test users
|
||||
TestWithUserUtils.createUser(USER1, USER1, rootNodeRef, nodeService, authenticationService);
|
||||
TestWithUserUtils.createUser(USER2, USER2, rootNodeRef, nodeService, authenticationService);
|
||||
|
||||
|
||||
// Count the number of pre-defined reports
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||
assertNotNull(searches);
|
||||
numberOfReports = searches.size();
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupMultiHierarchyTestData()
|
||||
*/
|
||||
@@ -100,27 +96,27 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
protected void setupMultiHierarchyTestData()
|
||||
{
|
||||
super.setupMultiHierarchyTestData();
|
||||
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
folderLevelRecordFolder = mhRecordFolder42;
|
||||
recordLevelRecordFolder = mhRecordFolder43;
|
||||
|
||||
recordLevelRecordFolder = mhRecordFolder43;
|
||||
|
||||
recordOne = utils.createRecord(folderLevelRecordFolder, "recordOne.txt", null, "record one - folder level - elephant");
|
||||
recordTwo = utils.createRecord(folderLevelRecordFolder, "recordTwo.txt", null, "record two - folder level - snake");
|
||||
recordThree = utils.createRecord(folderLevelRecordFolder, "recordThree.txt", null, "record three - folder level - monkey");
|
||||
recordFour = utils.createRecord(recordLevelRecordFolder, "recordFour.txt", null, "record four - record level - elephant");
|
||||
recordFive = utils.createRecord(recordLevelRecordFolder, "recordFive.txt", null, "record five - record level - snake");
|
||||
recordSix = utils.createRecord(recordLevelRecordFolder, "recordSix.txt", null, "record six - record level - monkey");
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
@@ -132,38 +128,38 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
// Delete test users
|
||||
TestWithUserUtils.deleteUser(USER1, USER1, rootNodeRef, nodeService, authenticationService);
|
||||
TestWithUserUtils.deleteUser(USER2, USER2, rootNodeRef, nodeService, authenticationService);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
public void testSearch()
|
||||
{
|
||||
// Full text search
|
||||
// Full text search
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
String query = "keywords:\"elephant\"";
|
||||
String query = "keywords:\"elephant\"";
|
||||
RecordsManagementSearchParameters params = new RecordsManagementSearchParameters();
|
||||
params.setIncludeUndeclaredRecords(true);
|
||||
List<NodeRef> results = rmSearchService.search(siteId, query, params);
|
||||
assertNotNull(results);
|
||||
assertEquals(2, results.size());
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
|
||||
// Property search
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
public void testSaveSearch()
|
||||
{
|
||||
// Add some saved searches (as admin user)
|
||||
@@ -176,12 +172,12 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
checkSearchDetails(details1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Add some saved searches (as user1)
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@@ -192,12 +188,12 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
checkSearchDetails(details1, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||
SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details2, siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}, USER1);
|
||||
|
||||
}, USER1);
|
||||
|
||||
// Get searches (as admin user)
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@@ -207,26 +203,26 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||
assertNotNull(searches);
|
||||
assertEquals(numberOfReports + 2, searches.size());
|
||||
|
||||
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||
assertNotNull(search1);
|
||||
checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
|
||||
|
||||
SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2);
|
||||
assertNotNull(search2);
|
||||
checkSearchDetails(search2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
|
||||
SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3);
|
||||
assertNull(search3);
|
||||
|
||||
|
||||
SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4);
|
||||
assertNull(search4);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Get searches (as user1)
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@@ -236,27 +232,27 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||
assertNotNull(searches);
|
||||
assertEquals(numberOfReports + 3, searches.size());
|
||||
|
||||
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||
assertNotNull(search1);
|
||||
checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
|
||||
|
||||
SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2);
|
||||
assertNull(search2);
|
||||
|
||||
|
||||
SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3);
|
||||
assertNotNull(search3);
|
||||
checkSearchDetails(search3, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
|
||||
SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4);
|
||||
assertNotNull(search4);
|
||||
checkSearchDetails(search4, siteId, "search4", "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}, USER1);
|
||||
|
||||
|
||||
// Update search (as admin user)
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@@ -266,31 +262,31 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||
assertNotNull(search1);
|
||||
checkSearchDetails(search1, siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
|
||||
|
||||
rmSearchService.saveSearch(siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
||||
|
||||
|
||||
search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||
assertNotNull(search1);
|
||||
checkSearchDetails(search1, siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
||||
|
||||
return null;
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Delete searches (as admin user)
|
||||
|
||||
// Delete searches (as admin user)
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check the details of the saved search.
|
||||
*/
|
||||
private void checkSearchDetails(
|
||||
SavedSearchDetails details,
|
||||
String siteid,
|
||||
String name,
|
||||
String description,
|
||||
String query,
|
||||
RecordsManagementSearchParameters searchParameters,
|
||||
SavedSearchDetails details,
|
||||
String siteid,
|
||||
String name,
|
||||
String description,
|
||||
String query,
|
||||
RecordsManagementSearchParameters searchParameters,
|
||||
boolean isPublic)
|
||||
{
|
||||
assertNotNull(details);
|
||||
@@ -299,7 +295,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
assertEquals(description, details.getDescription());
|
||||
assertEquals(query, details.getSearch());
|
||||
assertEquals(isPublic, details.isPublic());
|
||||
|
||||
|
||||
assertEquals(searchParameters.getMaxItems(), details.getSearchParameters().getMaxItems());
|
||||
assertEquals(searchParameters.isIncludeRecords(), details.getSearchParameters().isIncludeRecords());
|
||||
assertEquals(searchParameters.isIncludeUndeclaredRecords(), details.getSearchParameters().isIncludeUndeclaredRecords());
|
||||
@@ -307,7 +303,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
assertEquals(searchParameters.isIncludeRecordFolders(), details.getSearchParameters().isIncludeRecordFolders());
|
||||
assertEquals(searchParameters.isIncludeFrozen(), details.getSearchParameters().isIncludeFrozen());
|
||||
assertEquals(searchParameters.isIncludeCutoff(), details.getSearchParameters().isIncludeCutoff());
|
||||
|
||||
|
||||
// Check the other stuff ....
|
||||
}
|
||||
}
|
||||
|
@@ -23,13 +23,11 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
|
||||
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.DestroyAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.report.Report;
|
||||
import org.alfresco.module.org_alfresco_module_rm.report.ReportModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.report.ReportService;
|
||||
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;
|
||||
@@ -37,28 +35,16 @@ import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Report service implementation unit test.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
||||
{
|
||||
private ReportService reportService;
|
||||
private RecordsManagementActionService recordsManagementActionService;
|
||||
|
||||
@Override
|
||||
protected boolean isRecordTest()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
reportService = (ReportService)applicationContext.getBean("ReportService");
|
||||
recordsManagementActionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService");
|
||||
}
|
||||
|
||||
public void testGetReportTypes() throws Exception
|
||||
{
|
||||
@@ -68,20 +54,20 @@ public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
||||
public Void run() throws Exception
|
||||
{
|
||||
Set<QName> reportTypes = reportService.getReportTypes();
|
||||
|
||||
|
||||
assertNotNull(reportTypes);
|
||||
assertFalse(reportTypes.isEmpty());
|
||||
|
||||
|
||||
for (QName reportType : reportTypes)
|
||||
{
|
||||
System.out.println(reportType.toString());
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void testGenerateReport() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
@@ -90,15 +76,15 @@ public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
||||
public Void run() throws Exception
|
||||
{
|
||||
Report report = reportService.generateReport(TYPE_DESTRUCTION_REPORT, rmFolder);
|
||||
|
||||
|
||||
System.out.println(report.getReportName());
|
||||
System.out.println(report.getReportContent().getContentString());
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void testFileReport() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
@@ -108,17 +94,17 @@ public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
||||
{
|
||||
Report report = reportService.generateReport(TYPE_DESTRUCTION_REPORT, rmFolder);
|
||||
NodeRef reportNodeRef = reportService.fileReport(filePlan, report);
|
||||
|
||||
|
||||
assertNotNull(reportNodeRef);
|
||||
assertTrue(recordService.isRecord(reportNodeRef));
|
||||
assertFalse(recordService.isFiled(reportNodeRef));
|
||||
assertEquals(TYPE_DESTRUCTION_REPORT, nodeService.getType(reportNodeRef));
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void testFileDestructionReportAction() throws Exception
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
@@ -128,12 +114,12 @@ public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
||||
{
|
||||
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
||||
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
||||
recordsManagementActionService.executeRecordsManagementAction(rmFolder, CompleteEventAction.NAME, params);
|
||||
recordsManagementActionService.executeRecordsManagementAction(rmFolder, CutOffAction.NAME);
|
||||
recordsManagementActionService.executeRecordsManagementAction(rmFolder, DestroyAction.NAME);
|
||||
recordsManagementActionService.executeRecordsManagementAction(rmFolder, "fileDestructionReport");
|
||||
rmActionService.executeRecordsManagementAction(rmFolder, CompleteEventAction.NAME, params);
|
||||
rmActionService.executeRecordsManagementAction(rmFolder, CutOffAction.NAME);
|
||||
rmActionService.executeRecordsManagementAction(rmFolder, DestroyAction.NAME);
|
||||
rmActionService.executeRecordsManagementAction(rmFolder, "fileDestructionReport");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -28,59 +28,50 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
|
||||
|
||||
/**
|
||||
* Notification helper (system) test
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class NotificationServiceHelperSystemTest extends BaseRMTestCase
|
||||
{
|
||||
private static final String NOTIFICATION_ROLE = "RecordsManager";
|
||||
private static final String EMAIL_ADDRESS = "roy.wetherall@alfreso.com";
|
||||
|
||||
|
||||
/** Services */
|
||||
private RecordsManagementNotificationHelper notificationHelper;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private PersonService personService;
|
||||
private AuthorityService authorityService;
|
||||
|
||||
|
||||
/** Test data */
|
||||
private NodeRef record;
|
||||
private List<NodeRef> records;
|
||||
private List<NodeRef> records;
|
||||
private String userName;
|
||||
private NodeRef person;
|
||||
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
|
||||
// Get the notification helper
|
||||
notificationHelper = (RecordsManagementNotificationHelper)applicationContext.getBean("recordsManagementNotificationHelper");
|
||||
authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
|
||||
authorityService = (AuthorityService)applicationContext.getBean("AuthorityService");
|
||||
personService = (PersonService)applicationContext.getBean("PersonService");
|
||||
notificationHelper = (RecordsManagementNotificationHelper)applicationContext.getBean("recordsManagementNotificationHelper");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setupTestData()
|
||||
{
|
||||
super.setupTestData();
|
||||
|
||||
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
@Override
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
|
||||
|
||||
// Create a user
|
||||
userName = GUID.generate();
|
||||
authenticationService.createAuthentication(userName, "".toCharArray());
|
||||
@@ -90,46 +81,46 @@ public class NotificationServiceHelperSystemTest extends BaseRMTestCase
|
||||
props.put(PROP_LASTNAME, "User");
|
||||
props.put(PROP_EMAIL, EMAIL_ADDRESS);
|
||||
person = personService.createPerson(props);
|
||||
|
||||
// Find the authority for the given role
|
||||
|
||||
// Find the authority for the given role
|
||||
Role role = filePlanRoleService.getRole(filePlan, NOTIFICATION_ROLE);
|
||||
assertNotNull("Notification role could not be retrieved", role);
|
||||
String roleGroup = role.getRoleGroupName();
|
||||
assertNotNull("Notification role group can not be null.", roleGroup);
|
||||
|
||||
|
||||
// Add user to notification role group
|
||||
authorityService.addAuthority(roleGroup, userName);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setupTestDataImpl()
|
||||
{
|
||||
super.setupTestDataImpl();
|
||||
|
||||
|
||||
// Create a few test records
|
||||
record = utils.createRecord(rmFolder, "recordOne");
|
||||
NodeRef record2 = utils.createRecord(rmFolder, "recordTwo");
|
||||
NodeRef record3 = utils.createRecord(rmFolder, "recordThree");
|
||||
|
||||
|
||||
records = new ArrayList<NodeRef>(3);
|
||||
records.add(record);
|
||||
records.add(record2);
|
||||
records.add(record3);
|
||||
records.add(record3);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void tearDownImpl()
|
||||
{
|
||||
super.tearDownImpl();
|
||||
|
||||
|
||||
// Delete the person and user
|
||||
personService.deletePerson(person);
|
||||
}
|
||||
|
||||
|
||||
public void testSendDueForReviewNotification()
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
@@ -141,8 +132,8 @@ public class NotificationServiceHelperSystemTest extends BaseRMTestCase
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testSendSupersededNotification()
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
@@ -154,5 +145,5 @@ public class NotificationServiceHelperSystemTest extends BaseRMTestCase
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import java.util.Set;
|
||||
import org.alfresco.model.ContentModel;
|
||||
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.capability.RMPermissionModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService;
|
||||
@@ -38,8 +39,10 @@ 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.record.RecordService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.report.ReportService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
|
||||
@@ -51,6 +54,7 @@ import org.alfresco.repo.site.SiteModel;
|
||||
import org.alfresco.repo.site.SiteServiceImpl;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
@@ -122,12 +126,13 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected FileFolderService fileFolderService;
|
||||
protected PermissionService permissionService;
|
||||
protected TaggingService taggingService;
|
||||
protected ActionService actionService;
|
||||
|
||||
/** RM Services */
|
||||
protected DispositionService dispositionService;
|
||||
protected RecordsManagementEventService eventService;
|
||||
protected RecordsManagementAdminService adminService;
|
||||
protected RecordsManagementActionService actionService;
|
||||
protected RecordsManagementEventService rmEventService;
|
||||
protected RecordsManagementAdminService rmAdminService;
|
||||
protected RecordsManagementActionService rmActionService;
|
||||
protected RecordsManagementSearchService rmSearchService;
|
||||
protected FilePlanRoleService filePlanRoleService;
|
||||
protected FilePlanPermissionService filePlanPermissionService;
|
||||
@@ -139,6 +144,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected FilePlanService filePlanService;
|
||||
protected FilePlanAuthenticationService filePlanAuthenticationService;
|
||||
protected RecordFolderService recordFolderService;
|
||||
protected ExtendedSecurityService extendedSecurityService;
|
||||
protected ReportService reportService;
|
||||
protected RecordsManagementAuditService rmAuditService;
|
||||
|
||||
/** test data */
|
||||
protected String siteId;
|
||||
@@ -356,12 +364,13 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
fileFolderService = (FileFolderService)applicationContext.getBean("FileFolderService");
|
||||
permissionService = (PermissionService)applicationContext.getBean("PermissionService");
|
||||
taggingService = (TaggingService)applicationContext.getBean("TaggingService");
|
||||
actionService = (ActionService)applicationContext.getBean("ActionService");
|
||||
|
||||
// Get RM services
|
||||
dispositionService = (DispositionService)applicationContext.getBean("DispositionService");
|
||||
eventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService");
|
||||
adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService");
|
||||
actionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService");
|
||||
rmEventService = (RecordsManagementEventService)applicationContext.getBean("RecordsManagementEventService");
|
||||
rmAdminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService");
|
||||
rmActionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService");
|
||||
rmSearchService = (RecordsManagementSearchService)this.applicationContext.getBean("RecordsManagementSearchService");
|
||||
filePlanRoleService = (FilePlanRoleService)this.applicationContext.getBean("FilePlanRoleService");
|
||||
filePlanPermissionService = (FilePlanPermissionService)this.applicationContext.getBean("FilePlanPermissionService");
|
||||
@@ -373,6 +382,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
filePlanService = (FilePlanService) applicationContext.getBean("FilePlanService");
|
||||
filePlanAuthenticationService = (FilePlanAuthenticationService) applicationContext.getBean("FilePlanAuthenticationService");
|
||||
recordFolderService = (RecordFolderService) applicationContext.getBean("RecordFolderService");
|
||||
extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService");
|
||||
reportService = (ReportService) applicationContext.getBean("ReportService");
|
||||
rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,6 +27,7 @@ import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction
|
||||
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.caveat.RMCaveatConfigService;
|
||||
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;
|
||||
@@ -108,6 +109,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
protected VitalRecordService vitalRecordService;
|
||||
protected FilePlanService filePlanService;
|
||||
protected RecordFolderService recordFolderService;
|
||||
protected RMCaveatConfigService caveatConfigService;
|
||||
|
||||
/** test data */
|
||||
protected String siteId;
|
||||
@@ -181,6 +183,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService");
|
||||
filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService");
|
||||
recordFolderService = (RecordFolderService)applicationContext.getBean("RecordFolderService");
|
||||
caveatConfigService = (RMCaveatConfigService)applicationContext.getBean("CaveatConfigService");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -45,21 +45,11 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
|
||||
@SuppressWarnings("unused")
|
||||
public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase
|
||||
{
|
||||
private RMCaveatConfigService caveatConfigService;
|
||||
|
||||
protected final static String RM_LIST = "rmc:smListTest";
|
||||
protected final static String RM_LIST_URI_ELEM = "rmc_smListTest";
|
||||
|
||||
private static final String URL_RM_CONSTRAINTS = "/api/rma/admin/rmconstraints";
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
this.caveatConfigService = (RMCaveatConfigService)getServer().getApplicationContext().getBean("CaveatConfigService");
|
||||
}
|
||||
|
||||
public void testGetRMConstraints() throws Exception
|
||||
{
|
||||
{
|
||||
|
@@ -21,7 +21,6 @@ package org.alfresco.module.org_alfresco_module_rm.test.webscript;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.json.JSONObject;
|
||||
@@ -36,21 +35,11 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
|
||||
*/
|
||||
public class RMConstraintScriptTest extends BaseRMWebScriptTestCase
|
||||
{
|
||||
private RMCaveatConfigService caveatConfigService;
|
||||
|
||||
protected final static String RM_LIST = "rmc:smListTest";
|
||||
protected final static String RM_LIST_URI_ELEM = "rmc_smListTest";
|
||||
|
||||
private static final String URL_RM_CONSTRAINTS = "/api/rma/rmconstraints";
|
||||
|
||||
@Override
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
|
||||
this.caveatConfigService = (RMCaveatConfigService)getServer().getApplicationContext().getBean("CaveatConfigService");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws Exception
|
||||
|
Reference in New Issue
Block a user