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);
}
Aggregations