use of org.alfresco.repo.security.person.TestPersonManager in project alfresco-remote-api by Alfresco.
the class AbstractWorkflowRestApiTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationContext appContext = getServer().getApplicationContext();
namespaceService = (NamespaceService) appContext.getBean("NamespaceService");
workflowService = (WorkflowService) appContext.getBean("WorkflowService");
MutableAuthenticationService authenticationService = (MutableAuthenticationService) appContext.getBean("AuthenticationService");
PersonService personService = (PersonService) appContext.getBean("PersonService");
SearchService searchService = (SearchService) appContext.getBean("SearchService");
FileFolderService fileFolderService = (FileFolderService) appContext.getBean("FileFolderService");
nodeService = (NodeService) appContext.getBean("NodeService");
// for the purposes of the tests make sure workflow engine is enabled/visible.
WorkflowAdminServiceImpl workflowAdminService = (WorkflowAdminServiceImpl) appContext.getBean("workflowAdminService");
this.wfTestHelper = new WorkflowTestHelper(workflowAdminService, getEngine(), true);
AuthorityService authorityService = (AuthorityService) appContext.getBean("AuthorityService");
personManager = new TestPersonManager(authenticationService, personService, nodeService);
groupManager = new TestGroupManager(authorityService);
authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
dictionaryService = (DictionaryService) appContext.getBean("dictionaryService");
personManager.createPerson(USER1);
personManager.createPerson(USER2);
personManager.createPerson(USER3);
authenticationComponent.setSystemUserAsCurrentUser();
groupManager.addUserToGroup(GROUP, USER2);
packageRef = workflowService.createPackage(null);
NodeRef companyHome = searchService.selectNodes(nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), COMPANY_HOME, null, namespaceService, false).get(0);
contentNodeRef = fileFolderService.create(companyHome, TEST_CONTENT + System.currentTimeMillis(), ContentModel.TYPE_CONTENT).getNodeRef();
authenticationComponent.clearCurrentSecurityContext();
}
use of org.alfresco.repo.security.person.TestPersonManager in project alfresco-remote-api by Alfresco.
the class ReplicationRestApiTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationContext appContext = getServer().getApplicationContext();
nodeService = (NodeService) appContext.getBean("NodeService");
replicationService = (ReplicationService) appContext.getBean("ReplicationService");
actionTrackingService = (ActionTrackingService) appContext.getBean("actionTrackingService");
repositoryHelper = (Repository) appContext.getBean("repositoryHelper");
transactionService = (TransactionService) appContext.getBean("transactionService");
MutableAuthenticationService authenticationService = (MutableAuthenticationService) appContext.getBean("AuthenticationService");
PersonService personService = (PersonService) appContext.getBean("PersonService");
personManager = new TestPersonManager(authenticationService, personService, nodeService);
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
personManager.createPerson(USER_NORMAL);
// Ensure we start with no replication definitions
// (eg another test left them behind)
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for (ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
replicationService.deleteReplicationDefinition(rd);
}
txn.commit();
// Grab a reference to the data dictionary
dataDictionary = nodeService.getChildByName(repositoryHelper.getCompanyHome(), ContentModel.ASSOC_CONTAINS, "Data Dictionary");
AuthenticationUtil.clearCurrentSecurityContext();
}
use of org.alfresco.repo.security.person.TestPersonManager in project alfresco-remote-api by Alfresco.
the class RunningActionRestApiTest method setUp.
@SuppressWarnings("unchecked")
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationContext appContext = getServer().getApplicationContext();
nodeService = (NodeService) appContext.getBean("NodeService");
replicationService = (ReplicationService) appContext.getBean("ReplicationService");
actionTrackingService = (ActionTrackingService) appContext.getBean("actionTrackingService");
repositoryHelper = (Repository) appContext.getBean("repositoryHelper");
transactionService = (TransactionService) appContext.getBean("transactionService");
executingActionsCache = (SimpleCache<String, ExecutionDetails>) appContext.getBean("executingActionsCache");
MutableAuthenticationService authenticationService = (MutableAuthenticationService) appContext.getBean("AuthenticationService");
PersonService personService = (PersonService) appContext.getBean("PersonService");
personManager = new TestPersonManager(authenticationService, personService, nodeService);
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
personManager.createPerson(USER_NORMAL);
// Ensure we start with no replication definitions
// (eg another test left them behind)
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for (ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
replicationService.deleteReplicationDefinition(rd);
}
txn.commit();
// Grab a reference to the data dictionary
dataDictionary = nodeService.getChildByName(repositoryHelper.getCompanyHome(), ContentModel.ASSOC_CONTAINS, "Data Dictionary");
AuthenticationUtil.clearCurrentSecurityContext();
}
Aggregations