Search in sources :

Example 1 with WorkflowBuilder

use of org.alfresco.repo.workflow.WorkflowBuilder in project alfresco-repository by Alfresco.

the class ActivitiWorkflowServiceIntegrationTest method testBuildWorkflowWithNoUserTasks.

@Test
public void testBuildWorkflowWithNoUserTasks() throws Exception {
    // Deploy a definition containing only a service task
    WorkflowDefinition testDefinition = deployDefinition("activiti/testWorkflowNoUserTasks.bpmn20.xml");
    WorkflowBuilder builder = new WorkflowBuilder(testDefinition, workflowService, nodeService, null);
    // Build a workflow
    WorkflowInstance builtInstance = builder.build();
    assertNotNull(builtInstance);
    // Check that there is no active workflow for the deployed definition(it should have finished already due to absence of user tasks)
    List<WorkflowInstance> activeInstances = workflowService.getActiveWorkflows(testDefinition.getId());
    assertNotNull(activeInstances);
    assertEquals(0, activeInstances.size());
    // Check that there's a historic record of our 'only service task' workflow being run.
    HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finishedAfter(builtInstance.getStartDate()).singleResult();
    assertNotNull(historicProcessInstance);
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) WorkflowBuilder(org.alfresco.repo.workflow.WorkflowBuilder) WorkflowDefinition(org.alfresco.service.cmr.workflow.WorkflowDefinition) WorkflowInstance(org.alfresco.service.cmr.workflow.WorkflowInstance) AbstractWorkflowServiceIntegrationTest(org.alfresco.repo.workflow.AbstractWorkflowServiceIntegrationTest) Test(org.junit.Test)

Aggregations

HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1 AbstractWorkflowServiceIntegrationTest (org.alfresco.repo.workflow.AbstractWorkflowServiceIntegrationTest)1 WorkflowBuilder (org.alfresco.repo.workflow.WorkflowBuilder)1 WorkflowDefinition (org.alfresco.service.cmr.workflow.WorkflowDefinition)1 WorkflowInstance (org.alfresco.service.cmr.workflow.WorkflowInstance)1 Test (org.junit.Test)1