|
26 | 26 | import org.jbpm.bpmn2.handler.SignallingTaskHandlerDecorator;
|
27 | 27 | import org.jbpm.bpmn2.objects.ExceptionOnPurposeHandler;
|
28 | 28 | import org.jbpm.bpmn2.objects.MyError;
|
| 29 | +import org.jbpm.bpmn2.objects.Person; |
29 | 30 | import org.jbpm.bpmn2.objects.TestWorkItemHandler;
|
| 31 | +import org.jbpm.process.instance.event.listeners.RuleAwareProcessEventLister; |
30 | 32 | import org.jbpm.process.instance.impl.demo.DoNothingWorkItemHandler;
|
31 | 33 | import org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler;
|
32 | 34 | import org.jbpm.workflow.instance.WorkflowProcessInstance;
|
@@ -295,6 +297,47 @@ public void testErrorBoundaryEventOnServiceTask() throws Exception {
|
295 | 297 | assertProcessInstanceFinished(processInstance, ksession);
|
296 | 298 | assertNodeTriggered(processInstance.getId(), "start", "split", "User Task", "Service task error attached", "end0",
|
297 | 299 | "Script Task", "error2");
|
| 300 | + |
| 301 | + assertNotNodeTriggered(processInstance.getId(), "end"); |
| 302 | + } |
| 303 | + |
| 304 | + @Test |
| 305 | + public void testErrorBoundaryEventOnBusinessRuleTask() throws Exception { |
| 306 | + KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-ErrorBoundaryEventOnBusinessRuleTask.bpmn2", |
| 307 | + "BPMN2-ErrorBoundaryEventOnBusinessRuleTask.drl"); |
| 308 | + ksession = createKnowledgeSession(kbase); |
| 309 | + ksession.addEventListener(new RuleAwareProcessEventLister()); |
| 310 | + ProcessInstance processInstance = ksession.startProcess("BPMN2-ErrorBoundaryEventOnBusinessRuleTask"); |
| 311 | + |
| 312 | + assertProcessInstanceFinished(processInstance, ksession); |
| 313 | + assertNodeTriggered(processInstance.getId(), "start", "business rule task error attached", "error1"); |
| 314 | + } |
| 315 | + |
| 316 | + @Test |
| 317 | + public void testMultiErrorBoundaryEventsOnBusinessRuleTask() throws Exception { |
| 318 | + KieBase kbase = createKnowledgeBaseWithoutDumper("BPMN2-MultiErrorBoundaryEventsOnBusinessRuleTask.bpmn2", |
| 319 | + "BPMN2-MultiErrorBoundaryEventsOnBusinessRuleTask.drl"); |
| 320 | + ksession = createKnowledgeSession(kbase); |
| 321 | + ksession.addEventListener(new RuleAwareProcessEventLister()); |
| 322 | + |
| 323 | + Map<String, Object> params = new HashMap<String, Object>(); |
| 324 | + params.put("person", new Person()); |
| 325 | + ProcessInstance processInstance = ksession.startProcess("BPMN2-MultiErrorBoundaryEventeOnBusinessRuleTask", params); |
| 326 | + |
| 327 | + assertProcessInstanceFinished(processInstance, ksession); |
| 328 | + assertNodeTriggered(processInstance.getId(), "start", "business rule task error attached", |
| 329 | + "NPE Script Task", "error1"); |
| 330 | + |
| 331 | + ksession.dispose(); |
| 332 | + |
| 333 | + ksession = createKnowledgeSession(kbase); |
| 334 | + ksession.addEventListener(new RuleAwareProcessEventLister()); |
| 335 | + params = new HashMap<String, Object>(); |
| 336 | + params.put("person", new Person("unsupported")); |
| 337 | + ProcessInstance processInstance2 = ksession.startProcess("BPMN2-MultiErrorBoundaryEventeOnBusinessRuleTask", params); |
| 338 | + assertProcessInstanceFinished(processInstance2, ksession); |
| 339 | + assertNodeTriggered(processInstance2.getId(), "start", "business rule task error attached", |
| 340 | + "UOE Script Task", "error2"); |
298 | 341 | }
|
299 | 342 |
|
300 | 343 | @Test
|
|
0 commit comments