09-15-2011 07:28 AM
09-15-2011 09:47 AM
09-15-2011 10:51 AM
09-15-2011 01:19 PM
09-15-2011 04:19 PM
09-15-2011 06:43 PM
About the test case, is a little bit hard to test this situation with the job executor activated. To test this scenario, I have to setup some infra-structure…I never have the jobexecutor activated in unit tests… The unittest explicitly executes the jobs… See the unit tests for examples
I put a service task in the diagram (duplicate.jpg), when the 'Register' completes, it creates a new 'Inspect' task (a new record on act_ru_task and act_ru_job is created)… and so on in a recursive way. I was wondering how can I provide this feature without create a new task (for shure setting cancelActivity=true), but then I got: org.activiti.engine.ActivitiException: this activity doesn't accept signals.Uhhmmm do not loop back to the user task? Or do I mis something…
If I remove the service task (not_duplicate.jpg) the job executes and task remains OK.What is the definition of OK? No duplicate because you do not loop back to it
About the event listeners ok, better show up… solving the problem above, the work is done. There is another way to send, for exemple, an e-mail when times out?Have you read the documentation? http://www.activiti.org/userguide/index.html#bpmnEmailTask
09-15-2011 07:26 PM
09-15-2011 08:02 PM
09-16-2011 07:43 AM
@Deployment(resources={
"org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml",
"org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml"
})
public void testOrderProcessWithCallActivity() {
// After the process has started, the 'verify credit history' task should be active
ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
TaskQuery taskQuery = taskService.createTaskQuery();
Task verifyCreditTask = taskQuery.singleResult();
assertEquals("Verify credit history", verifyCreditTask.getName());
// Verify with Query API
ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
assertNotNull(subProcessInstance);
assertEquals(pi.getId(), runtimeService.createProcessInstanceQuery().subProcessInstanceId(subProcessInstance.getId()).singleResult().getId());
// Completing the task with approval, will end the subprocess and continue the original process
//alemser: commented to teste timer due date
//taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
//alemser: wait 10 seconds here to timer due date
System.out.println("put a break point here and wait 10 seconds!");
Task prepareAndShipTask = taskQuery.singleResult();
assertEquals("Prepare and Ship", prepareAndShipTask.getName());
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns:activiti="http://activiti.org/bpmn"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:smileysurprised:mgdi="http://www.omg.org/spec/DD/20100524/DI"
xmlns:smileysurprised:mgdc="http://www.omg.org/spec/DD/20100524/DC"
targetNamespace="Examples">
<process id="orderProcess" name="Order process with call activity">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="receiveOrder" />
<manualTask id="receiveOrder" name="Receive Order" />
<sequenceFlow id="flow2" sourceRef="receiveOrder" targetRef="callCheckCreditProcess" />
<callActivity id="callCheckCreditProcess" name="Check credit" calledElement="checkCreditProcess" />
<sequenceFlow id="flow3" sourceRef="callCheckCreditProcess" targetRef="prepareAndShipTask" />
<userTask id="prepareAndShipTask" name="Prepare and Ship" />
<!– alemser: new service task –>
<serviceTask completionQuantity="1" id="_service_task" implementation="webService" isForCompensation="false" name="Registry"
startQuantity="1" activiti:class="org.activiti.examples.bpmn.callactivity.MyJavaDelegate">
<incoming>flowFromTimer</incoming>
<outgoing>flowFromService</outgoing>
</serviceTask>
<!– alemser: new boundary timer –>
<boundaryEvent attachedToRef="callCheckCreditProcess" cancelActivity="true" id="_timer_boundary" name="" parallelMultiple="false">
<outgoing>flowFromTimer</outgoing>
<timerEventDefinition id="_theTimer">
<timeDuration id="_theTimerDuration" xsi:type="tFormalExpression">PT10S</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<!– alemser: new sequence flows –>
<sequenceFlow id="flowFromTimer" sourceRef="_timer_boundary" targetRef="_service_task" />
<sequenceFlow id="flowFromService" sourceRef="_service_task" targetRef="prepareAndShipTask" />
<sequenceFlow id="flow4" sourceRef="prepareAndShipTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
4. finally create the java delegate to get work done
public class MyJavaDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
System.out.println("[MyJavaDelegate] java delegate test");
}
}
09-16-2011 10:39 AM
modifications:
1. set attribute jobExecutorActivate to true
2. modify the file CallActivityTest.java (is not so straightforward test with timers)
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.