use of org.kie.api.event.process.SignalEvent in project kogito-runtimes by kiegroup.
the class KogitoProcessEventSupportImpl method fireOnSignal.
@Override
public void fireOnSignal(final KogitoProcessInstance instance, KogitoNodeInstance nodeInstance, KieRuntime kruntime, String signalName, Object signalObject) {
if (hasListeners()) {
final SignalEvent event = new SignalEventImpl(instance, kruntime, nodeInstance, signalName, signalObject);
notifyAllListeners(event, ProcessEventListener::onSignal);
}
}
use of org.kie.api.event.process.SignalEvent in project drools by kiegroup.
the class ProcessEventSupport method fireOnSignal.
public void fireOnSignal(final ProcessInstance instance, NodeInstance nodeInstance, KieRuntime kruntime, String signalName, Object signalObject) {
if (hasListeners()) {
final SignalEvent event = new SignalEventImpl(instance, kruntime, nodeInstance, signalName, signalObject);
notifyAllListeners(event, ProcessEventListener::onSignal);
}
}
use of org.kie.api.event.process.SignalEvent in project kogito-runtimes by kiegroup.
the class SignalEventIT method testIntermediateEndSignal.
@Test
public void testIntermediateEndSignal() throws Exception {
Application app = generateCode(Collections.singletonMap(TYPE.PROCESS, Collections.singletonList("signalevent/EndEventSignalWithData.bpmn2")));
KogitoProcessEventListener listener = mock(KogitoProcessEventListener.class);
app.config().get(ProcessConfig.class).processEventListeners().listeners().add(listener);
assertThat(app).isNotNull();
Process<? extends Model> p = app.get(Processes.class).processById("src.simpleEndSignal");
ProcessInstance<?> processInstance = p.createInstance(p.createModel());
processInstance.start();
assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
ArgumentCaptor<SignalEvent> signalEvent = ArgumentCaptor.forClass(SignalEvent.class);
verify(listener).onSignal(signalEvent.capture());
assertThat(signalEvent.getValue().getSignalName()).isEqualTo("Signal1");
assertThat(signalEvent.getValue().getSignal()).isEqualTo("Some value");
}
use of org.kie.api.event.process.SignalEvent in project kogito-runtimes by kiegroup.
the class SignalEventIT method testIntermediateThrowSignal.
@Test
public void testIntermediateThrowSignal() throws Exception {
Application app = generateCode(Collections.singletonMap(TYPE.PROCESS, Collections.singletonList("signalevent/IntermediateThrowEventSignal.bpmn2")));
KogitoProcessEventListener listener = mock(KogitoProcessEventListener.class);
app.config().get(ProcessConfig.class).processEventListeners().listeners().add(listener);
assertThat(app).isNotNull();
Process<? extends Model> p = app.get(Processes.class).processById("IntermediateThrowEventSignal");
Model m = p.createModel();
m.update(Collections.singletonMap("x", "Javierito"));
ProcessInstance<?> processInstance = p.createInstance(m);
processInstance.start();
assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
ArgumentCaptor<SignalEvent> signalEvent = ArgumentCaptor.forClass(SignalEvent.class);
verify(listener).onSignal(signalEvent.capture());
assertThat(signalEvent.getValue().getSignalName()).isEqualTo("MySignal");
assertThat(signalEvent.getValue().getSignal()).isEqualTo("Javierito");
}
Aggregations