当前位置: 首页>>代码示例>>Java>>正文


Java TestPersonManager类代码示例

本文整理汇总了Java中org.alfresco.repo.security.person.TestPersonManager的典型用法代码示例。如果您正苦于以下问题:Java TestPersonManager类的具体用法?Java TestPersonManager怎么用?Java TestPersonManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TestPersonManager类属于org.alfresco.repo.security.person包,在下文中一共展示了TestPersonManager类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSetUpInTransaction

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
	 ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
     this.workflowService = registry.getWorkflowService();
     this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
     this.nodeService = registry.getNodeService();
     
     this.transactionHelper = (RetryingTransactionHelper) this.applicationContext
     	.getBean("retryingTransactionHelper");
     
     this.activitiProcessEngine = (ProcessEngine) this.applicationContext.getBean("activitiProcessEngine");
     
     MutableAuthenticationService authenticationService = registry.getAuthenticationService();
     PersonService personService = registry.getPersonService();

     this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
     
     authenticationComponent.setSystemUserAsCurrentUser();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ActivitiTimerExecutionTest.java

示例2: onSetUp

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@Override
@Before
public void onSetUp() throws Exception
{
    super.onSetUp();
    serviceRegistry = (ServiceRegistry) getApplicationContext().getBean(ServiceRegistry.SERVICE_REGISTRY);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
    SiteService siteService = serviceRegistry.getSiteService();
    FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
    PermissionService permissionService = serviceRegistry.getPermissionService();
    this.nodeService = serviceRegistry.getNodeService();
    ChannelService channelService = (ChannelService) getApplicationContext().getBean(ChannelServiceImpl.NAME);
    PublishingService publishingService = (PublishingService) getApplicationContext().getBean(PublishServiceImpl.NAME);
    MutableAuthenticationService authenticationService= (MutableAuthenticationService) getApplicationContext().getBean(ServiceRegistry.AUTHENTICATION_SERVICE.getLocalName());
    PersonService personService= (PersonService) getApplicationContext().getBean(ServiceRegistry.PERSON_SERVICE.getLocalName());
    
    this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
    this.testHelper = new PublishingTestHelper(channelService, publishingService, siteService, fileFolderService, permissionService);
    
    this.username = GUID.generate();
    personManager.createPerson(username);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:AbstractPublishingIntegrationTest.java

示例3: setUp

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@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();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:39,代码来源:ReplicationRestApiTest.java

示例4: setUp

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@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();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:42,代码来源:AbstractWorkflowRestApiTest.java

示例5: setUp

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    ApplicationContext ctx = getServer().getApplicationContext();
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    SiteService siteService = serviceRegistry.getSiteService();
    FileFolderService fileFolderService = serviceRegistry.getFileFolderService();
    this.nodeService = serviceRegistry.getNodeService();
    this.permissionService= serviceRegistry.getPermissionService();
    this.channelService = (ChannelService) ctx.getBean(ChannelServiceImpl.NAME);
    this.publishingService= (PublishingService) ctx.getBean(PublishServiceImpl.NAME);
    this.channelHelper = (ChannelHelper) ctx.getBean(ChannelHelper.NAME);
    this.testHelper = new PublishingTestHelper(channelService, publishingService, siteService, fileFolderService, permissionService);
    
    MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
    PersonService personService = serviceRegistry.getPersonService();
    this.personManager = new TestPersonManager(authenticationService, personService, nodeService);

    personManager.createPerson(userName);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

    ChannelType publishAny = testHelper.mockChannelType(publishAnyType);
    when(publishAny.canPublish()).thenReturn(true);
    when(publishAny.canUnpublish()).thenReturn(true);
    
    ChannelType publishPdf= testHelper.mockChannelType(publishPdfType);
    when(publishPdf.canPublish()).thenReturn(true);
    when(publishPdf.getSupportedMimeTypes()).thenReturn(Collections.singleton(MimetypeMap.MIMETYPE_PDF));
    
    ChannelType statusUpdate= testHelper.mockChannelType(statusUpdateType);
    when(statusUpdate.canPublishStatusUpdates()).thenReturn(true);
    when(statusUpdate.getMaximumStatusLength()).thenReturn(maxStatusLength);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:35,代码来源:PublishingRestApiTest.java

示例6: onSetUpInTransaction

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
    super.onSetUpInTransaction();
    serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    this.workflowService = serviceRegistry.getWorkflowService();
    this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    this.nodeService = serviceRegistry.getNodeService();
    this.historyService = (HistoryService) applicationContext.getBean("activitiHistoryService");
    Repository repositoryHelper = (Repository) applicationContext.getBean("repositoryHelper");
    this.companyHome = repositoryHelper.getCompanyHome();
    try
    {
        this.transactionService = (TransactionServiceImpl) serviceRegistry.getTransactionService();
    }
    catch (ClassCastException e)
    {
        throw new AlfrescoRuntimeException("The AbstractWorkflowServiceIntegrationTest needs direct access to the TransactionServiceImpl");
    }

    MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
    AuthorityService authorityService = serviceRegistry.getAuthorityService();
    PersonService personService = serviceRegistry.getPersonService();

    authenticationComponent.setSystemUserAsCurrentUser();

    WorkflowAdminServiceImpl workflowAdminService = (WorkflowAdminServiceImpl) applicationContext.getBean(WorkflowAdminServiceImpl.NAME);
    this.wfTestHelper = new WorkflowTestHelper(workflowAdminService, getEngine(), true);
    
    // create test users
    this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
    this.groupManager = new TestGroupManager(authorityService);
    
    personManager.createPerson(USER1);
    personManager.createPerson(USER2);
    personManager.createPerson(USER3);
    personManager.createPerson(USER4);

    // create test groups
    groupManager.addGroupToParent(GROUP, SUB_GROUP);
    
    // add users to groups
    groupManager.addUserToGroup(GROUP, USER1);
    groupManager.addUserToGroup(SUB_GROUP, USER2);
    
    personManager.setUser(USER1);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:AbstractWorkflowServiceIntegrationTest.java

示例7: setUp

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@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();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:42,代码来源:RunningActionRestApiTest.java

示例8: setUp

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@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, searchService);

    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();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:42,代码来源:AbstractWorkflowRestApiTest.java

示例9: onSetUpInTransaction

import org.alfresco.repo.security.person.TestPersonManager; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
    super.onSetUpInTransaction();
    serviceRegistry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    this.workflowService = serviceRegistry.getWorkflowService();
    this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
    this.nodeService = serviceRegistry.getNodeService();
    this.historyService = (HistoryService) applicationContext.getBean("activitiHistoryService");
    Repository repositoryHelper = (Repository) applicationContext.getBean("repositoryHelper");
    this.companyHome = repositoryHelper.getCompanyHome();
    try
    {
        this.transactionService = (TransactionServiceImpl) serviceRegistry.getTransactionService();
    }
    catch (ClassCastException e)
    {
        throw new AlfrescoRuntimeException("The AbstractWorkflowServiceIntegrationTest needs direct access to the TransactionServiceImpl");
    }

    MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
    AuthorityService authorityService = serviceRegistry.getAuthorityService();
    PersonService personService = serviceRegistry.getPersonService();
    SearchService searchService = serviceRegistry.getSearchService();

    authenticationComponent.setSystemUserAsCurrentUser();

    WorkflowAdminServiceImpl workflowAdminService = (WorkflowAdminServiceImpl) applicationContext.getBean(WorkflowAdminServiceImpl.NAME);
    this.wfTestHelper = new WorkflowTestHelper(workflowAdminService, getEngine(), true);
    
    // create test users
    this.personManager = new TestPersonManager(authenticationService, personService, nodeService);
    this.groupManager = new TestGroupManager(authorityService, searchService);
    
    personManager.createPerson(USER1);
    personManager.createPerson(USER2);
    personManager.createPerson(USER3);
    personManager.createPerson(USER4);

    // create test groups
    groupManager.addGroupToParent(GROUP, SUB_GROUP);
    
    // add users to groups
    groupManager.addUserToGroup(GROUP, USER1);
    groupManager.addUserToGroup(SUB_GROUP, USER2);
    
    personManager.setUser(USER1);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:50,代码来源:AbstractWorkflowServiceIntegrationTest.java


注:本文中的org.alfresco.repo.security.person.TestPersonManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。