@Test public void shouldReturnConvertedEventsWhenInternalEvenIsRelatedToTimers() { ActivitiEntityEvent internalEvent = mock(ActivitiEntityEvent.class); given(internalEvent.getProcessDefinitionId()).willReturn("procDefId"); given(internalEvent.getProcessInstanceId()).willReturn("procInstId"); BPMNTimerImpl bpmnTimer = new BPMNTimerImpl("myTimer"); given(bpmnTimerConverter.convertToBPMNTimer(internalEvent)).willReturn(bpmnTimer); given(bpmnTimerConverter.isTimerRelatedEvent(internalEvent)).willReturn(true); BPMNTimerExecutedEvent timerEvent = toTimerConverter.from(internalEvent).orElse(null); assertThat(timerEvent).isNotNull(); assertThat(timerEvent.getProcessInstanceId()).isEqualTo("procInstId"); assertThat(timerEvent.getProcessDefinitionId()).isEqualTo("procDefId"); assertThat(timerEvent.getEntity()).isEqualTo(bpmnTimer); }
@Override public Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent) { BPMNTimerExecutedEventImpl event = null; if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) { event = new BPMNTimerExecutedEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.ofNullable(event); }
ToTimerExecutedConverter implements EventConverter<BPMNTimerExecutedEvent, ActivitiEvent> { @Override public Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent) { BPMNTimerExecutedEventImpl event = null; if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) { event = new BPMNTimerExecutedEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.ofNullable(event); } }
ToTimerExecutedConverter implements EventConverter<BPMNTimerExecutedEvent, ActivitiEvent> { @Override public Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent) { BPMNTimerExecutedEventImpl event = null; if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) { event = new BPMNTimerExecutedEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.ofNullable(event); } ToTimerExecutedConverter(BPMNTimerConverter bpmnTimerConverter); }
ToTimerExecutedConverter implements EventConverter<BPMNTimerExecutedEvent, ActivitiEvent> { @Override public Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent) { BPMNTimerExecutedEventImpl event = null; if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) { event = new BPMNTimerExecutedEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.ofNullable(event); } ToTimerExecutedConverter(BPMNTimerConverter bpmnTimerConverter); @Override Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent); }
ToTimerExecutedConverter implements EventConverter<BPMNTimerExecutedEvent, ActivitiEvent> { @Override public Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent) { BPMNTimerExecutedEventImpl event = null; if (bpmnTimerConverter.isTimerRelatedEvent(internalEvent)) { event = new BPMNTimerExecutedEventImpl(bpmnTimerConverter.convertToBPMNTimer((ActivitiEntityEvent) internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.ofNullable(event); } ToTimerExecutedConverter(BPMNTimerConverter bpmnTimerConverter); @Override Optional<BPMNTimerExecutedEvent> from(ActivitiEvent internalEvent);  }