@Test public void closedShouldDoNothingWhenRegisteredEventsIsNull() { given(commandContext.getGenericAttribute(MessageProducerCommandContextCloseListener.PROCESS_ENGINE_EVENTS)) .willReturn(null); closeListener.closed(commandContext); verify(auditChannel, never()).send(any()); }
@Override public void closed(CommandContext commandContext) { List<CloudRuntimeEvent<?, ?>> events = commandContext.getGenericAttribute(PROCESS_ENGINE_EVENTS); if (events != null && !events.isEmpty()) { CloudRuntimeEvent<?, ?>[] payload = events.stream() .filter(CloudRuntimeEventImpl.class::isInstance) .map(CloudRuntimeEventImpl.class::cast) .map(runtimeBundleInfoAppender::appendRuntimeBundleInfoTo) .toArray(CloudRuntimeEvent<?, ?>[]::new); Message<CloudRuntimeEvent<?, ?>[]> message = messageBuilderChainFactory.create(null) .withPayload(payload) .build(); producer.auditProducer().send(message); } }
MessageProducerCommandContextCloseListener implements CommandContextCloseListener { @Override public void closed(CommandContext commandContext) { List<CloudRuntimeEvent<?, ?>> events = commandContext.getGenericAttribute(PROCESS_ENGINE_EVENTS); if (events != null && !events.isEmpty()) { CloudRuntimeEvent<?, ?>[] payload = events.stream() .filter(CloudRuntimeEventImpl.class::isInstance) .map(CloudRuntimeEventImpl.class::cast) .map(runtimeBundleInfoAppender::appendRuntimeBundleInfoTo) .toArray(CloudRuntimeEvent<?, ?>[]::new); Message<CloudRuntimeEvent<?, ?>[]> message = messageBuilderChainFactory.create(null) .withPayload(payload) .build(); producer.auditProducer().send(message); } } }
MessageProducerCommandContextCloseListener implements CommandContextCloseListener { @Override public void closed(CommandContext commandContext) { List<CloudRuntimeEvent<?, ?>> events = commandContext.getGenericAttribute(PROCESS_ENGINE_EVENTS); if (events != null && !events.isEmpty()) { CloudRuntimeEvent<?, ?>[] payload = events.stream() .filter(CloudRuntimeEventImpl.class::isInstance) .map(CloudRuntimeEventImpl.class::cast) .map(runtimeBundleInfoAppender::appendRuntimeBundleInfoTo) .toArray(CloudRuntimeEvent<?, ?>[]::new); Message<CloudRuntimeEvent<?, ?>[]> message = messageBuilderChainFactory.create(null) .withPayload(payload) .build(); producer.auditProducer().send(message); } } MessageProducerCommandContextCloseListener(ProcessEngineChannels producer,
            MessageBuilderChainFactory<ExecutionContext> messageBuilderChainFactory,
            RuntimeBundleInfoAppender runtimeBundleInfoAppender ); }
MessageProducerCommandContextCloseListener implements CommandContextCloseListener { @Override public void closed(CommandContext commandContext) { List<CloudRuntimeEvent<?, ?>> events = commandContext.getGenericAttribute(PROCESS_ENGINE_EVENTS); if (events != null && !events.isEmpty()) { CloudRuntimeEvent<?, ?>[] payload = events.stream() .filter(CloudRuntimeEventImpl.class::isInstance) .map(CloudRuntimeEventImpl.class::cast) .map(runtimeBundleInfoAppender::appendRuntimeBundleInfoTo) .toArray(CloudRuntimeEvent<?, ?>[]::new); Message<CloudRuntimeEvent<?, ?>[]> message = messageBuilderChainFactory.create(null) .withPayload(payload) .build(); producer.auditProducer().send(message); } } MessageProducerCommandContextCloseListener(ProcessEngineChannels producer,
            MessageBuilderChainFactory<ExecutionContext> messageBuilderChainFactory,
            RuntimeBundleInfoAppender runtimeBundleInfoAppender ); @Override void closed(CommandContext commandContext); @Override void closing(CommandContext commandContext); @Override void afterSessionsFlush(CommandContext commandContext); @Override void closeFailure(CommandContext commandContext); }
MessageProducerCommandContextCloseListener implements CommandContextCloseListener { @Override public void closed(CommandContext commandContext) { List<CloudRuntimeEvent<?, ?>> events = commandContext.getGenericAttribute(PROCESS_ENGINE_EVENTS); if (events != null && !events.isEmpty()) { CloudRuntimeEvent<?, ?>[] payload = events.stream() .filter(CloudRuntimeEventImpl.class::isInstance) .map(CloudRuntimeEventImpl.class::cast) .map(runtimeBundleInfoAppender::appendRuntimeBundleInfoTo) .toArray(CloudRuntimeEvent<?, ?>[]::new); Message<CloudRuntimeEvent<?, ?>[]> message = messageBuilderChainFactory.create(null) .withPayload(payload) .build(); producer.auditProducer().send(message); } } MessageProducerCommandContextCloseListener(ProcessEngineChannels producer,
            MessageBuilderChainFactory<ExecutionContext> messageBuilderChainFactory,
            RuntimeBundleInfoAppender runtimeBundleInfoAppender ); @Override void closed(CommandContext commandContext); @Override void closing(CommandContext commandContext); @Override void afterSessionsFlush(CommandContext commandContext); @Override void closeFailure(CommandContext commandContext); static final String PROCESS_ENGINE_EVENTS; }