mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +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:
@@ -34,16 +34,11 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.OwnableService;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
/**
|
||||
* Records managment entry voter.
|
||||
@@ -51,7 +46,7 @@ import org.springframework.context.ApplicationContextAware;
|
||||
* @author Roy Wetherall, Andy Hind
|
||||
*/
|
||||
public class RMEntryVoter extends RMSecurityCommon
|
||||
implements AccessDecisionVoter, InitializingBean, ApplicationContextAware, PolicyRegister
|
||||
implements AccessDecisionVoter, InitializingBean, PolicyRegister
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(RMEntryVoter.class);
|
||||
@@ -59,30 +54,12 @@ public class RMEntryVoter extends RMSecurityCommon
|
||||
/** Namespace resolver */
|
||||
private NamespacePrefixResolver nspr;
|
||||
|
||||
/** Search service */
|
||||
private SearchService searchService;
|
||||
|
||||
/** Ownable service */
|
||||
private OwnableService ownableService;
|
||||
|
||||
/** Capability Service */
|
||||
private CapabilityService capabilityService;
|
||||
|
||||
/** Policy map */
|
||||
private HashMap<String, Policy> policies = new HashMap<String, Policy>();
|
||||
|
||||
/** Application context */
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
|
||||
{
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param capabilityService capability service
|
||||
*/
|
||||
@@ -91,30 +68,6 @@ public class RMEntryVoter extends RMSecurityCommon
|
||||
this.capabilityService = capabilityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return search service
|
||||
*/
|
||||
public SearchService getSearchService()
|
||||
{
|
||||
if (searchService == null)
|
||||
{
|
||||
searchService = (SearchService)applicationContext.getBean("SearchService");
|
||||
}
|
||||
return searchService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ownable service
|
||||
*/
|
||||
public OwnableService getOwnableService()
|
||||
{
|
||||
if (ownableService == null)
|
||||
{
|
||||
ownableService = (OwnableService)applicationContext.getBean("ownableService");
|
||||
}
|
||||
return ownableService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nspr namespace prefix resolver
|
||||
*/
|
||||
|
@@ -22,9 +22,7 @@ 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.
|
||||
@@ -33,19 +31,6 @@ import org.alfresco.service.cmr.security.PermissionService;
|
||||
*/
|
||||
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()
|
||||
{
|
||||
@@ -64,13 +49,13 @@ public class CreateRecordActionTest extends BaseRMTestCase
|
||||
{
|
||||
public Void run()
|
||||
{
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
Action action = dmActionService.createAction(CreateRecordAction.NAME);
|
||||
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;
|
||||
}
|
||||
@@ -79,8 +64,8 @@ public class CreateRecordActionTest extends BaseRMTestCase
|
||||
{
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, dmPermissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||
};
|
||||
},
|
||||
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));
|
||||
@@ -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,18 +31,15 @@ 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;
|
||||
|
||||
@@ -55,26 +52,6 @@ import org.alfresco.util.GUID;
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -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
|
||||
@@ -328,7 +305,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
|
||||
permissionReport();
|
||||
|
||||
assertEquals(AccessStatus.ALLOWED, dmPermissionService.hasPermission(filePlan,
|
||||
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(filePlan,
|
||||
RMPermissionModel.VIEW_RECORDS));
|
||||
|
||||
checkPermissions(FILING, AccessStatus.DENIED, // file plan
|
||||
@@ -426,9 +403,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
|
||||
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))
|
||||
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -60,8 +60,6 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
private NodeRef recordFive;
|
||||
private NodeRef recordSix;
|
||||
|
||||
private MutableAuthenticationService authenticationService;
|
||||
|
||||
private int numberOfReports;
|
||||
|
||||
/**
|
||||
@@ -72,8 +70,6 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
super.setupTestData();
|
||||
|
||||
authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
|
@@ -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;
|
||||
@@ -42,24 +40,12 @@ import org.alfresco.service.namespace.QName;
|
||||
*/
|
||||
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
|
||||
{
|
||||
doTestInTransaction(new Test<Void>()
|
||||
@@ -128,10 +114,10 @@ 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,9 +28,6 @@ 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;
|
||||
|
||||
@@ -47,9 +44,6 @@ public class NotificationServiceHelperSystemTest extends BaseRMTestCase
|
||||
|
||||
/** Services */
|
||||
private RecordsManagementNotificationHelper notificationHelper;
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private PersonService personService;
|
||||
private AuthorityService authorityService;
|
||||
|
||||
/** Test data */
|
||||
private NodeRef record;
|
||||
@@ -64,9 +58,6 @@ public class NotificationServiceHelperSystemTest extends BaseRMTestCase
|
||||
|
||||
// Get the notification helper
|
||||
notificationHelper = (RecordsManagementNotificationHelper)applicationContext.getBean("recordsManagementNotificationHelper");
|
||||
authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
|
||||
authorityService = (AuthorityService)applicationContext.getBean("AuthorityService");
|
||||
personService = (PersonService)applicationContext.getBean("PersonService");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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