mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-2130 (Check classification after method execution, filtering results where appropriate)
- Fixed failing integration tests +review RM-94 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/ENFORCE@107274 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,55 +24,34 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies;
|
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution;
|
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution;
|
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction;
|
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction2;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.TestAction2;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Records management action service implementation test
|
* Records management action service implementation test
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class RecordsManagementActionServiceImplTest extends TestCase
|
public class RecordsManagementActionServiceImplTest extends BaseRMTestCase
|
||||||
implements RecordsManagementModel,
|
implements BeforeRMActionExecution,
|
||||||
BeforeRMActionExecution,
|
|
||||||
OnRMActionExecution
|
OnRMActionExecution
|
||||||
{
|
{
|
||||||
private static final String[] CONFIG_LOCATIONS = new String[] {
|
|
||||||
"classpath:alfresco/application-context.xml",
|
|
||||||
"classpath:test-context.xml"};
|
|
||||||
|
|
||||||
private ApplicationContext ctx;
|
|
||||||
|
|
||||||
private ServiceRegistry serviceRegistry;
|
|
||||||
private TransactionService transactionService;
|
|
||||||
private RetryingTransactionHelper txnHelper;
|
private RetryingTransactionHelper txnHelper;
|
||||||
private NodeService nodeService;
|
|
||||||
private RecordsManagementActionService rmActionService;
|
|
||||||
private PolicyComponent policyComponent;
|
|
||||||
|
|
||||||
private NodeRef nodeRef;
|
private NodeRef nodeRef;
|
||||||
private List<NodeRef> nodeRefs;
|
private List<NodeRef> nodeRefs;
|
||||||
@@ -84,18 +63,12 @@ public class RecordsManagementActionServiceImplTest extends TestCase
|
|||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception
|
protected void setUp() throws Exception
|
||||||
{
|
{
|
||||||
ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);
|
super.setUp();
|
||||||
|
|
||||||
this.serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
|
||||||
this.transactionService = serviceRegistry.getTransactionService();
|
|
||||||
this.txnHelper = transactionService.getRetryingTransactionHelper();
|
this.txnHelper = transactionService.getRetryingTransactionHelper();
|
||||||
this.nodeService = serviceRegistry.getNodeService();
|
|
||||||
|
|
||||||
this.rmActionService = (RecordsManagementActionService)ctx.getBean("RecordsManagementActionService");
|
// Set the current security context as system
|
||||||
this.policyComponent = (PolicyComponent)ctx.getBean("policyComponent");
|
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||||
|
|
||||||
// Set the current security context as admin
|
|
||||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
|
||||||
|
|
||||||
RetryingTransactionCallback<Void> setUpCallback = new RetryingTransactionCallback<Void>()
|
RetryingTransactionCallback<Void> setUpCallback = new RetryingTransactionCallback<Void>()
|
||||||
{
|
{
|
||||||
|
@@ -47,7 +47,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
private static final String SEARCH3 = "search3";
|
private static final String SEARCH3 = "search3";
|
||||||
private static final String SEARCH4 = "search4";
|
private static final String SEARCH4 = "search4";
|
||||||
|
|
||||||
private static final String USER1 = generate();
|
private String user;
|
||||||
|
|
||||||
private NodeRef folderLevelRecordFolder;
|
private NodeRef folderLevelRecordFolder;
|
||||||
private NodeRef recordLevelRecordFolder;
|
private NodeRef recordLevelRecordFolder;
|
||||||
@@ -72,7 +72,8 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
assertNotNull(searches);
|
assertNotNull(searches);
|
||||||
numberOfReports = searches.size();
|
numberOfReports = searches.size();
|
||||||
|
|
||||||
createPerson(USER1);
|
user = generate();
|
||||||
|
createPerson(user);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}, USER1);
|
}, user);
|
||||||
|
|
||||||
// Get searches (as admin user)
|
// Get searches (as admin user)
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
@@ -222,7 +223,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}, USER1);
|
}, user);
|
||||||
|
|
||||||
// Update search (as admin user)
|
// Update search (as admin user)
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
|
Reference in New Issue
Block a user