@Test public void executeShouldStoreTheIntegrationContextAndPublishASpringEvent() { ServiceTask serviceTask = new ServiceTask(); serviceTask.setImplementation(CONNECTOR_TYPE); DelegateExecution execution = anExecution() .withId(EXECUTION_ID) .withProcessInstanceId(PROC_INST_ID) .withProcessDefinitionId(PROC_DEF_ID) .withServiceTask(serviceTask) .withFlowNodeId(FLOW_NODE_ID) .build(); given(runtimeBundleProperties.getServiceFullName()).willReturn(APP_NAME); IntegrationContextEntityImpl entity = new IntegrationContextEntityImpl(); entity.setId(INTEGRATION_CONTEXT_ID); given(integrationContextManager.create()).willReturn(entity); given(applicationContext.containsBean(CONNECTOR_TYPE)).willReturn(false); IntegrationContext integrationContext = mock(IntegrationContext.class); given(integrationContextBuilder.from(entity, execution)).willReturn(integrationContext); behavior.execute(execution); assertThat(entity) .hasExecutionId(EXECUTION_ID) .hasProcessDefinitionId(PROC_DEF_ID) .hasProcessInstanceId(PROC_INST_ID); verify(eventPublisher).publishEvent(integrationRequestCaptor.capture()); IntegrationRequestImpl integrationRequest = integrationRequestCaptor.getValue(); assertThat(integrationRequest.getIntegrationContext()) .isEqualTo(integrationContext); verify(runtimeBundleInfoAppender).appendRuntimeBundleInfoTo(integrationRequest); }
@Override public void execute(DelegateExecution execution) { if (defaultServiceTaskBehavior.hasConnectorBean(execution)) { defaultServiceTaskBehavior.execute(execution); } else { IntegrationContextEntity integrationContext = storeIntegrationContext(execution); publishSpringEvent(execution, integrationContext); } }
MQServiceTaskBehavior extends AbstractBpmnActivityBehavior implements TriggerableActivityBehavior { @Override public void execute(DelegateExecution execution) { if (defaultServiceTaskBehavior.hasConnectorBean(execution)) { defaultServiceTaskBehavior.execute(execution); } else { IntegrationContextEntity integrationContext = storeIntegrationContext(execution); publishSpringEvent(execution, integrationContext); } } }
MQServiceTaskBehavior extends AbstractBpmnActivityBehavior implements TriggerableActivityBehavior { @Override public void execute(DelegateExecution execution) { if (defaultServiceTaskBehavior.hasConnectorBean(execution)) { defaultServiceTaskBehavior.execute(execution); } else { IntegrationContextEntity integrationContext = storeIntegrationContext(execution); publishSpringEvent(execution, integrationContext); } } MQServiceTaskBehavior(IntegrationContextManager integrationContextManager,
                                 ApplicationEventPublisher eventPublisher,
                                 IntegrationContextBuilder integrationContextBuilder,
                                 RuntimeBundleInfoAppender runtimeBundleInfoAppender,
                                 DefaultServiceTaskBehavior defaultServiceTaskBehavior); }
MQServiceTaskBehavior extends AbstractBpmnActivityBehavior implements TriggerableActivityBehavior { @Override public void execute(DelegateExecution execution) { if (defaultServiceTaskBehavior.hasConnectorBean(execution)) { defaultServiceTaskBehavior.execute(execution); } else { IntegrationContextEntity integrationContext = storeIntegrationContext(execution); publishSpringEvent(execution, integrationContext); } } MQServiceTaskBehavior(IntegrationContextManager integrationContextManager,
                                 ApplicationEventPublisher eventPublisher,
                                 IntegrationContextBuilder integrationContextBuilder,
                                 RuntimeBundleInfoAppender runtimeBundleInfoAppender,
                                 DefaultServiceTaskBehavior defaultServiceTaskBehavior); @Override void execute(DelegateExecution execution); @Override void trigger(DelegateExecution execution,
                        String signalEvent,
                        Object signalData); }
MQServiceTaskBehavior extends AbstractBpmnActivityBehavior implements TriggerableActivityBehavior { @Override public void execute(DelegateExecution execution) { if (defaultServiceTaskBehavior.hasConnectorBean(execution)) { defaultServiceTaskBehavior.execute(execution); } else { IntegrationContextEntity integrationContext = storeIntegrationContext(execution); publishSpringEvent(execution, integrationContext); } } MQServiceTaskBehavior(IntegrationContextManager integrationContextManager,
                                 ApplicationEventPublisher eventPublisher,
                                 IntegrationContextBuilder integrationContextBuilder,
                                 RuntimeBundleInfoAppender runtimeBundleInfoAppender,
                                 DefaultServiceTaskBehavior defaultServiceTaskBehavior); @Override void execute(DelegateExecution execution); @Override void trigger(DelegateExecution execution,
                        String signalEvent,
                        Object signalData);  }