use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener in project kogito-runtimes by kiegroup.
the class ErrorEventTest method testErrorBoundaryEventOnBusinessRuleTask.
@Test
public void testErrorBoundaryEventOnBusinessRuleTask() throws Exception {
kruntime = createKogitoProcessRuntime("BPMN2-ErrorBoundaryEventOnBusinessRuleTask.bpmn2", "BPMN2-ErrorBoundaryEventOnBusinessRuleTask.drl");
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
KogitoProcessInstance processInstance = kruntime.startProcess("BPMN2-ErrorBoundaryEventOnBusinessRuleTask");
assertProcessInstanceFinished(processInstance, kruntime);
assertNodeTriggered(processInstance.getStringId(), "start", "business rule task error attached", "error1");
}
use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener in project kogito-runtimes by kiegroup.
the class ActivityTest method testBusinessRuleTaskWithPersistence.
@Test
@RequirePersistence(true)
public void testBusinessRuleTaskWithPersistence() throws Exception {
kruntime = createKogitoProcessRuntime("BPMN2-BusinessRuleTask.bpmn2", "BPMN2-BusinessRuleTask.drl");
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
KogitoProcessInstance processInstance = kruntime.startProcess("BPMN2-BusinessRuleTask");
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
assertProcessInstanceFinished(processInstance, kruntime);
}
use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener in project kogito-runtimes by kiegroup.
the class ActivityTest method testBusinessRuleTaskDynamic.
@Test
public void testBusinessRuleTaskDynamic() throws Exception {
kruntime = createKogitoProcessRuntime("BPMN2-BusinessRuleTaskDynamic.bpmn2", "BPMN2-BusinessRuleTask.drl");
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
Map<String, Object> params = new HashMap<>();
params.put("dynamicrule", "MyRuleFlow");
KogitoProcessInstance processInstance = kruntime.startProcess("BPMN2-BusinessRuleTask", params);
assertProcessInstanceFinished(processInstance, kruntime);
}
use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener in project kogito-runtimes by kiegroup.
the class ActivityTest method testBusinessRuleTask.
@Test
@RequirePersistence(false)
public void testBusinessRuleTask() throws Exception {
kruntime = createKogitoProcessRuntime("BPMN2-BusinessRuleTask.bpmn2", "BPMN2-BusinessRuleTask.drl");
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
KogitoProcessInstance processInstance = kruntime.startProcess("BPMN2-BusinessRuleTask");
assertProcessInstanceFinished(processInstance, kruntime);
}
use of org.jbpm.process.instance.event.listeners.RuleAwareProcessEventListener in project kogito-runtimes by kiegroup.
the class IntermediateEventTest method testIntermediateCatchEventConditionSetVariableAfter.
@Test
public void testIntermediateCatchEventConditionSetVariableAfter() throws Exception {
kruntime = createKogitoProcessRuntime("BPMN2-IntermediateCatchEventConditionSetVariableAfter.bpmn2");
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
KogitoProcessInstance processInstance = kruntime.startProcess("IntermediateCatchEvent");
assertProcessInstanceActive(processInstance);
kruntime.getProcessEventManager().addEventListener(new RuleAwareProcessEventListener());
Collection<? extends Object> processInstances = kruntime.getKieSession().getObjects(object -> {
if (object instanceof KogitoProcessInstance) {
return true;
}
return false;
});
assertThat(processInstances).isNotNull();
assertThat(processInstances.size()).isEqualTo(1);
// now activate condition
Person person = new Person();
person.setName("Jack");
kruntime.getKieSession().insert(person);
assertProcessInstanceFinished(processInstance, kruntime);
processInstances = kruntime.getKieSession().getObjects(object -> {
if (object instanceof KogitoProcessInstance) {
return true;
}
return false;
});
assertThat(processInstances).isNotNull();
assertThat(processInstances.size()).isEqualTo(0);
}
Aggregations