11-18-2016 05:09 AM
<definitions xmlns="http:…">
<process id="test_process_2" isClosed="false" isExecutable="true" processType="None">
<startEvent id="start" name="StartEvent"/>
<userTask activiti:async="false" activiti:exclusive="true" id="input_data" name="enter initial data"></userTask>
<serviceTask activiti:async="false" activiti:class="ShortRunningTasks"
activiti:exclusive="true" id="feedback_service" name="giving imediate feedback"/>
<userTask activiti:async="false" activiti:exclusive="true" id="feedback" name="giving feedback"></userTask>
<serviceTask activiti:async="true" activiti:class="LongRunningTasks"
activiti:exclusive="true" id="longrunning" name="a lot of small tasks that in sum take a relatively long time"/>
<userTask activiti:async="false" activiti:exclusive="true" id="final_approval" name="review and end process"></userTask>
<endEvent id="end" name="EndEvent"/>
<sequenceFlow id="flow1" sourceRef="start" targetRef="input_data"/>
<sequenceFlow id="flow2" sourceRef="input_data" targetRef="feedback_service"/>
<sequenceFlow id="flow3" sourceRef="feedback_service" targetRef="feedback"/>
<sequenceFlow id="flow3" sourceRef="feedback" targetRef="longrunning"/>
<sequenceFlow id="flow4" sourceRef="longrunning" targetRef="final_approval"/>
<sequenceFlow id="flow5" sourceRef="final_approval" targetRef="end"/>
</process>
</definitions>
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
<property name="jdbcDriver" value="org.h2.Driver" />
<property name="jdbcUsername" value="sa" />
<property name="jdbcPassword" value="" />
<property name="jobExecutorActivate" value="false" />
<property name="asyncExecutor" ref="asyncExecutor" />
<property name="asyncExecutorEnabled" value="true" />
<property name="asyncExecutorActivate" value="false" />
<property name="defaultFailedJobWaitTime" value="1" />
<property name="asyncFailedJobWaitTime" value="1" />
</bean>
<bean id="asyncExecutor" class="org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor">
<property name="defaultAsyncJobAcquireWaitTimeInMillis" value="500" />
<property name="defaultTimerJobAcquireWaitTimeInMillis" value="500" />
</bean>
@Rule
public ActivitiRule activitiRule = new ActivitiRule();
// also tried activitiRule instead of ProcessEngines.getDefaultprocessEngine()
@Test
@Deployment(resources = {"test_process_2.bpmn"})
public void test() throws InterruptedException {
ProcessInstance processInstance = activitiRule.getRuntimeService().startProcessInstanceByKey("test_process_2");
Task task = ProcessEngines.getDefaultProcessEngine().getTaskService().createTaskQuery().singleResult();
ProcessEngines.getDefaultProcessEngine().getFormService().submitTaskFormData(task.getId(), new SimpleInitMap<String, String>("text", "blahblah"));
Boolean b =true;
while(b) {
List<Execution> executions = ProcessEngines.getDefaultProcessEngine().getRuntimeService().createExecutionQuery().processInstanceId(processInstance.getProcessInstanceId()).list();
b = executions.get(0).getActivityId().equals("longrunning");
System.out.println(executions.size() + " execution(s) online, waiting…");
Thread.sleep(1000);
}
}
11-18-2016 08:05 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.