Search in sources :

Example 1 with WorkflowTestHelper

use of org.alfresco.repo.workflow.WorkflowTestHelper 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();
}
Also used : TestPersonManager(org.alfresco.repo.security.person.TestPersonManager) NodeRef(org.alfresco.service.cmr.repository.NodeRef) ApplicationContext(org.springframework.context.ApplicationContext) PersonService(org.alfresco.service.cmr.security.PersonService) SearchService(org.alfresco.service.cmr.search.SearchService) AuthorityService(org.alfresco.service.cmr.security.AuthorityService) WorkflowAdminServiceImpl(org.alfresco.repo.workflow.WorkflowAdminServiceImpl) FileFolderService(org.alfresco.service.cmr.model.FileFolderService) MutableAuthenticationService(org.alfresco.service.cmr.security.MutableAuthenticationService) WorkflowTestHelper(org.alfresco.repo.workflow.WorkflowTestHelper) TestGroupManager(org.alfresco.repo.security.person.TestGroupManager)

Aggregations

TestGroupManager (org.alfresco.repo.security.person.TestGroupManager)1 TestPersonManager (org.alfresco.repo.security.person.TestPersonManager)1 WorkflowAdminServiceImpl (org.alfresco.repo.workflow.WorkflowAdminServiceImpl)1 WorkflowTestHelper (org.alfresco.repo.workflow.WorkflowTestHelper)1 FileFolderService (org.alfresco.service.cmr.model.FileFolderService)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 SearchService (org.alfresco.service.cmr.search.SearchService)1 AuthorityService (org.alfresco.service.cmr.security.AuthorityService)1 MutableAuthenticationService (org.alfresco.service.cmr.security.MutableAuthenticationService)1 PersonService (org.alfresco.service.cmr.security.PersonService)1 ApplicationContext (org.springframework.context.ApplicationContext)1