diff --git a/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/output/process/AbstractStreamingIntegrationDelegate.java b/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/output/process/AbstractStreamingIntegrationDelegate.java index 3764e6f4b9..d9f366e797 100644 --- a/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/output/process/AbstractStreamingIntegrationDelegate.java +++ b/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/output/process/AbstractStreamingIntegrationDelegate.java @@ -21,12 +21,10 @@ public class AbstractStreamingIntegrationDelegate { private final EngineDataMapper engineDataMapper; - private final static VariableFactory MESSAGE_NAME = stringVariable("app_message_name"); private final static VariableFactory TYPE_NAME = stringVariable("app_type_name"); private final static VariableFactory TOPIC_NAME = stringVariable("app_topic_name"); private final static VariableFactory RESPONSELESS = stringVariable("app_responseless"); private final static List filterVariables = List.of( - MESSAGE_NAME.getName(), TYPE_NAME.getName(), TOPIC_NAME.getName(), RESPONSELESS.getName() @@ -44,7 +42,6 @@ protected Message> mapMessage(final DelegateExecution delega .setHeader(STREAM_SEND_TO_DESTINATION, TOPIC_NAME.from(delegateExecution).get()) .setHeader(TYPE, TYPE_NAME.from(delegateExecution).get()) .setHeader(DIGIWF_PROCESS_INSTANCE_ID, delegateExecution.getProcessInstanceId()); - MESSAGE_NAME.from(delegateExecution).getOptional().ifPresent(name -> builder.setHeader(DIGIWF_MESSAGE_NAME, name)); return builder.build(); } diff --git a/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/shared/streaming/StreamingHeaders.java b/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/shared/streaming/StreamingHeaders.java index 933d0ea9e2..ceffeee8a9 100644 --- a/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/shared/streaming/StreamingHeaders.java +++ b/digiwf-engine/digiwf-engine-service/src/main/java/de/muenchen/oss/digiwf/shared/streaming/StreamingHeaders.java @@ -5,6 +5,5 @@ public class StreamingHeaders { public static final String DIGIWF_PROCESS_INSTANCE_ID = "digiwf.processinstanceid"; public static final String STREAM_SEND_TO_DESTINATION = "spring.cloud.stream.sendto.destination"; public static final String TYPE = "type"; - public static final String DIGIWF_MESSAGE_NAME = "digiwf.messagename"; } diff --git a/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/main/java/de/muenchen/oss/digiwf/address/integration/adapter/out/IntegrationOutAdapter.java b/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/main/java/de/muenchen/oss/digiwf/address/integration/adapter/out/IntegrationOutAdapter.java index 8f07e0e084..c4fff888f4 100644 --- a/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/main/java/de/muenchen/oss/digiwf/address/integration/adapter/out/IntegrationOutAdapter.java +++ b/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/main/java/de/muenchen/oss/digiwf/address/integration/adapter/out/IntegrationOutAdapter.java @@ -22,11 +22,10 @@ public class IntegrationOutAdapter implements IntegrationOutPort { @Override public void correlateProcessMessage(@NonNull MessageHeaders headers, Map payload) { final String processInstanceId = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_PROCESS_INSTANCE_ID)).toString(); - final String messageName = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_MESSAGE_NAME)).toString(); if (payload == null) { payload = new HashMap<>(); } - this.processApi.correlateMessage(processInstanceId, messageName, payload); + this.processApi.correlateMessage(processInstanceId, payload); } @Override diff --git a/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/in/streaming/MessageProcessorTest.java b/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/in/streaming/MessageProcessorTest.java index d4b1b25c5a..708685b398 100644 --- a/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/in/streaming/MessageProcessorTest.java +++ b/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/in/streaming/MessageProcessorTest.java @@ -19,7 +19,6 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; @@ -248,7 +247,7 @@ public T getPayload() { @Override public MessageHeaders getHeaders() { - return new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, "exampleProcessInstanceId", DIGIWF_MESSAGE_NAME, "messageName")); + return new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, "exampleProcessInstanceId")); } }; } diff --git a/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/out/IntegrationOutAdapterTest.java b/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/out/IntegrationOutAdapterTest.java index f863874887..08feb2c187 100644 --- a/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/out/IntegrationOutAdapterTest.java +++ b/digiwf-integrations/digiwf-address-integration/digiwf-address-integration-core/src/test/java/integration/adapter/out/IntegrationOutAdapterTest.java @@ -12,7 +12,6 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -26,8 +25,7 @@ class IntegrationOutAdapterTest { private final IntegrationOutPort integrationOutAdapter = new IntegrationOutAdapter(processApi, errorApi); private final MessageHeaders messageHeaders = new MessageHeaders(Map.of( - DIGIWF_PROCESS_INSTANCE_ID, "processInstanceId", - DIGIWF_MESSAGE_NAME, "messageName" + DIGIWF_PROCESS_INSTANCE_ID, "processInstanceId" )); @Test @@ -37,12 +35,10 @@ void testCorrelateProcessMessage() { integrationOutAdapter.correlateProcessMessage(messageHeaders, payload); final ArgumentCaptor processInstanceIdCaptor = ArgumentCaptor.forClass(String.class); - final ArgumentCaptor messageNameCaptor = ArgumentCaptor.forClass(String.class); final ArgumentCaptor> payloadCaptor = ArgumentCaptor.forClass(Map.class); - verify(processApi).correlateMessage(processInstanceIdCaptor.capture(), messageNameCaptor.capture(), payloadCaptor.capture()); + verify(processApi).correlateMessage(processInstanceIdCaptor.capture(), payloadCaptor.capture()); assertThat(processInstanceIdCaptor.getValue()).isEqualTo(messageHeaders.get(DIGIWF_PROCESS_INSTANCE_ID)); - assertThat(messageNameCaptor.getValue()).isEqualTo(messageHeaders.get(DIGIWF_MESSAGE_NAME)); assertThat(payloadCaptor.getValue()).isEqualTo(payload); } diff --git a/digiwf-integrations/digiwf-alw-integration/digiwf-alw-integration-core/src/main/java/de/muenchen/oss/digiwf/alw/integration/adapter/out/integration/IntegrationOutAdapter.java b/digiwf-integrations/digiwf-alw-integration/digiwf-alw-integration-core/src/main/java/de/muenchen/oss/digiwf/alw/integration/adapter/out/integration/IntegrationOutAdapter.java index d970e102ab..0f51e52622 100644 --- a/digiwf-integrations/digiwf-alw-integration/digiwf-alw-integration-core/src/main/java/de/muenchen/oss/digiwf/alw/integration/adapter/out/integration/IntegrationOutAdapter.java +++ b/digiwf-integrations/digiwf-alw-integration/digiwf-alw-integration-core/src/main/java/de/muenchen/oss/digiwf/alw/integration/adapter/out/integration/IntegrationOutAdapter.java @@ -22,11 +22,10 @@ public class IntegrationOutAdapter implements IntegrationOutPort { @Override public void correlateProcessMessage(@NonNull MessageHeaders headers, Map payload) { final String processInstanceId = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_PROCESS_INSTANCE_ID)).toString(); - final String messageName = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_MESSAGE_NAME)).toString(); if (payload == null) { payload = new HashMap<>(); } - this.processApi.correlateMessage(processInstanceId, messageName, payload); + this.processApi.correlateMessage(processInstanceId, payload); } @Override diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessor.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessor.java index fcfdda3359..ff9799a96f 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessor.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessor.java @@ -6,6 +6,7 @@ import de.muenchen.oss.digiwf.message.process.api.ErrorApi; import de.muenchen.oss.digiwf.message.process.api.error.BpmnError; import de.muenchen.oss.digiwf.message.process.api.error.IncidentError; +import jakarta.validation.ValidationException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -13,10 +14,8 @@ import org.springframework.messaging.Message; import org.springframework.stereotype.Component; -import jakarta.validation.ValidationException; import java.util.function.Consumer; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; @Slf4j @@ -43,7 +42,6 @@ public Consumer> cosysIntegration() { log.debug("Generate document request: {}", document); this.documentUseCase.createDocument( message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID, String.class), - message.getHeaders().get(DIGIWF_MESSAGE_NAME, String.class), document); } catch (final BpmnError bpmnError) { this.errorApi.handleBpmnError(message.getHeaders(), bpmnError); diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapter.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapter.java index b9666f4b36..992e99d795 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapter.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapter.java @@ -12,8 +12,8 @@ public class ProcessAdapter implements CorrelateMessagePort { private final ProcessApi processApi; @Override - public void correlateMessage(final String processInstanceId, final String messageName, final Map message) { - this.processApi.correlateMessage(processInstanceId, messageName, message); + public void correlateMessage(final String processInstanceId, final Map message) { + this.processApi.correlateMessage(processInstanceId, message); } } diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/in/CreateDocument.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/in/CreateDocument.java index 892ac79b0c..9a6a8a524a 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/in/CreateDocument.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/in/CreateDocument.java @@ -1,11 +1,10 @@ package de.muenchen.oss.digiwf.cosys.integration.application.port.in; import de.muenchen.oss.digiwf.cosys.integration.model.GenerateDocument; - import jakarta.validation.Valid; public interface CreateDocument { - void createDocument(final String processInstanceIde, final String messageName, @Valid final GenerateDocument generateDocument); + void createDocument(final String processInstanceIde, @Valid final GenerateDocument generateDocument); } diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/out/CorrelateMessagePort.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/out/CorrelateMessagePort.java index 666dc31c5b..e8f1ec3e4c 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/out/CorrelateMessagePort.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/port/out/CorrelateMessagePort.java @@ -4,6 +4,6 @@ public interface CorrelateMessagePort { - void correlateMessage(final String processInstanceId, final String messageName, final Map message); + void correlateMessage(final String processInstanceId, final Map message); } diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/usecase/CreateDocumentUseCase.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/usecase/CreateDocumentUseCase.java index 7427d6bae6..f6b5349e57 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/usecase/CreateDocumentUseCase.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/main/java/de/muenchen/oss/digiwf/cosys/integration/application/usecase/CreateDocumentUseCase.java @@ -1,15 +1,14 @@ package de.muenchen.oss.digiwf.cosys.integration.application.usecase; import de.muenchen.oss.digiwf.cosys.integration.application.port.in.CreateDocument; -import de.muenchen.oss.digiwf.cosys.integration.model.GenerateDocument; import de.muenchen.oss.digiwf.cosys.integration.application.port.out.CorrelateMessagePort; import de.muenchen.oss.digiwf.cosys.integration.application.port.out.GenerateDocumentPort; import de.muenchen.oss.digiwf.cosys.integration.application.port.out.SaveFileToStoragePort; +import de.muenchen.oss.digiwf.cosys.integration.model.GenerateDocument; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import jakarta.validation.Valid; - import java.util.HashMap; import java.util.Map; @@ -29,13 +28,13 @@ public class CreateDocumentUseCase implements CreateDocument { * @param generateDocument Data for generating documents */ @Override - public void createDocument(final String processInstanceIde, final String messageName, @Valid final GenerateDocument generateDocument) { + public void createDocument(final String processInstanceIde, @Valid final GenerateDocument generateDocument) { final byte[] data = this.generateDocumentPort.generateCosysDocument(generateDocument).block(); this.saveFileToStoragePort.saveDocumentInStorage(generateDocument, data); final Map correlatePayload = new HashMap<>(); correlatePayload.put("status", true); - this.correlateMessagePort.correlateMessage(processInstanceIde,messageName,correlatePayload); + this.correlateMessagePort.correlateMessage(processInstanceIde, correlatePayload); } diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessorTest.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessorTest.java index fb459ce1ba..08e6f714e0 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessorTest.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/in/MessageProcessorTest.java @@ -1,24 +1,23 @@ package de.muenchen.oss.digiwf.cosys.integration.adapter.in; import de.muenchen.oss.digiwf.cosys.integration.application.port.in.CreateDocument; -import de.muenchen.oss.digiwf.cosys.integration.model.GenerateDocument; import de.muenchen.oss.digiwf.cosys.integration.model.DocumentStorageUrl; +import de.muenchen.oss.digiwf.cosys.integration.model.GenerateDocument; import de.muenchen.oss.digiwf.message.process.api.ErrorApi; import de.muenchen.oss.digiwf.message.process.api.error.BpmnError; import de.muenchen.oss.digiwf.message.process.api.error.IncidentError; +import jakarta.validation.ValidationException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; -import jakarta.validation.ValidationException; import java.util.List; import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.*; class MessageProcessorTest { @@ -35,7 +34,7 @@ class MessageProcessorTest { private List listOfURls = List.of(documentStorageUrl); private final GenerateDocument generateDocument = new GenerateDocument("Client", "Role", "guid", null, listOfURls); - private final MessageHeaders messageHeaders = new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId, DIGIWF_MESSAGE_NAME, "messageName")); + private final MessageHeaders messageHeaders = new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId)); @BeforeEach void setup() { @@ -56,13 +55,13 @@ public MessageHeaders getHeaders() { @Test void cosysIntegrationCreateDocumentSuccessfully() { messageProcessor.cosysIntegration().accept(this.message); - verify(createDocumentMock).createDocument(processInstanceId,"messageName", generateDocument); + verify(createDocumentMock).createDocument(processInstanceId, generateDocument); verifyNoMoreInteractions(createDocumentMock); } @Test void cosysIntegrationHandlesValidationException() { - doThrow(new ValidationException("ValidationException")).when(createDocumentMock).createDocument(any(),any(),any()); + doThrow(new ValidationException("ValidationException")).when(createDocumentMock).createDocument(any(),any()); messageProcessor.cosysIntegration().accept(this.message); final ArgumentCaptor messageHeaderArgumentCaptor = ArgumentCaptor.forClass(Map.class); verify(errorApiMock).handleBpmnError(messageHeaderArgumentCaptor.capture(), any(BpmnError.class)); @@ -72,7 +71,7 @@ void cosysIntegrationHandlesValidationException() { @Test void cosysIntegrationHandlesBpmnError() { - doThrow(new BpmnError("S3_FILE_SAVE_ERROR","BpmnErrorCode")).when(createDocumentMock).createDocument(any(),any(),any()); + doThrow(new BpmnError("S3_FILE_SAVE_ERROR","BpmnErrorCode")).when(createDocumentMock).createDocument(any(),any()); messageProcessor.cosysIntegration().accept(this.message); final ArgumentCaptor messageHeaderArgumentCaptor = ArgumentCaptor.forClass(Map.class); verify(errorApiMock).handleBpmnError(messageHeaderArgumentCaptor.capture(), any(BpmnError.class)); @@ -82,7 +81,7 @@ void cosysIntegrationHandlesBpmnError() { @Test void cosysIntegrationIncidentError() { - doThrow(new IncidentError("IncidentError")).when(createDocumentMock).createDocument(any(),any(),any()); + doThrow(new IncidentError("IncidentError")).when(createDocumentMock).createDocument(any(),any()); messageProcessor.cosysIntegration().accept(this.message); final ArgumentCaptor messageHeaderArgumentCaptor = ArgumentCaptor.forClass(Map.class); verify(errorApiMock).handleIncident(messageHeaderArgumentCaptor.capture(), any(IncidentError.class)); diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapterTest.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapterTest.java index 99f96a2ef6..568780b6d5 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapterTest.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-core/src/test/java/de/muenchen/oss/digiwf/cosys/integration/adapter/out/ProcessAdapterTest.java @@ -6,9 +6,7 @@ import java.util.HashMap; import java.util.Map; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.*; class ProcessAdapterTest { @@ -20,12 +18,11 @@ void correlateMessage() { final ProcessAdapter processAdapter = new ProcessAdapter(processApi); final String processInstanceId = "processInstanceId"; - final String messageName = "messageName"; final Map message = new HashMap<>(); - processAdapter.correlateMessage(processInstanceId,messageName,message); + processAdapter.correlateMessage(processInstanceId, message); - verify(processApi).correlateMessage(processInstanceId,messageName,message); + verify(processApi).correlateMessage(processInstanceId, message); verifyNoMoreInteractions(processApi); } } diff --git a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-example/src/main/java/de/muenchen/oss/digiwf/cosys/integration/example/api/controller/ExampleController.java b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-example/src/main/java/de/muenchen/oss/digiwf/cosys/integration/example/api/controller/ExampleController.java index d87b7437a6..e24d0538c1 100644 --- a/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-example/src/main/java/de/muenchen/oss/digiwf/cosys/integration/example/api/controller/ExampleController.java +++ b/digiwf-integrations/digiwf-cosys-integration/digiwf-cosys-integration-example/src/main/java/de/muenchen/oss/digiwf/cosys/integration/example/api/controller/ExampleController.java @@ -39,8 +39,7 @@ public ResponseEntity testCreateCosysDocument() { public void testEventBus(final @RequestBody DocumentStorageUrl body) { this.messageApi.sendMessage(body, Map.of( MessageConstants.TYPE, "createDocumentFromEventBus", - MessageConstants.DIGIWF_PROCESS_INSTANCE_ID, "processInstanceId", - MessageConstants.DIGIWF_MESSAGE_NAME, "testCosysIntegration" + MessageConstants.DIGIWF_PROCESS_INSTANCE_ID, "processInstanceId" ), "dwf-cosys-local-01"); } diff --git a/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/main/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessor.java b/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/main/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessor.java index 71989416ff..573ce1bae5 100644 --- a/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/main/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessor.java +++ b/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/main/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessor.java @@ -7,16 +7,15 @@ import de.muenchen.oss.digiwf.message.process.api.ProcessApi; import de.muenchen.oss.digiwf.message.process.api.error.BpmnError; import de.muenchen.oss.digiwf.message.process.api.error.IncidentError; +import jakarta.validation.ValidationException; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.Message; -import jakarta.validation.ValidationException; import java.util.Map; import java.util.Objects; import java.util.function.Consumer; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; @Configuration @@ -45,8 +44,7 @@ public Consumer> createFile() { createFileDto.getUser() ); - this.correlateMessage(Objects.requireNonNull(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID)).toString(), - Objects.requireNonNull(message.getHeaders().get(DIGIWF_MESSAGE_NAME)).toString(), Map.of("fileCOO", file)); + this.correlateMessage(Objects.requireNonNull(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID)).toString(), Map.of("fileCOO", file)); }); }; } @@ -61,8 +59,7 @@ public Consumer> createProcedure() { createProcedureDto.getUser() ); - this.correlateMessage(Objects.requireNonNull(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID)).toString(), - Objects.requireNonNull(message.getHeaders().get(DIGIWF_MESSAGE_NAME)).toString(), Map.of("procedureCOO", vorgang.getCoo())); + this.correlateMessage(Objects.requireNonNull(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID)).toString(), Map.of("procedureCOO", vorgang.getCoo())); }); }; } @@ -76,8 +73,7 @@ public Consumer> depositObject() { depositObjectDto.getUser() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of()); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of()); }); }; } @@ -95,8 +91,7 @@ public Consumer> createDocument() { createDocumentDto.getFileContext() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of("documentCoo", document)); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of("documentCoo", document)); }); }; } @@ -113,8 +108,7 @@ public Consumer> updateDocument() { updateDocumentDto.getFileContext() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of()); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of()); }); }; } @@ -128,8 +122,7 @@ public Consumer> cancelObject() { cancelObjectDto.getUser() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of()); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of()); }); }; } @@ -144,8 +137,7 @@ public Consumer> readContent() { readContentDto.getFilePath(), readContentDto.getFileContext() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of()); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of()); }); }; } @@ -158,8 +150,7 @@ public Consumer> searchFile() { searchObjectDto.getSearchString(), searchObjectDto.getUser() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of("fileCoo", file)); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of("fileCoo", file)); }); }; } @@ -172,8 +163,7 @@ public Consumer> searchSubjectArea() { searchObjectDto.getSearchString(), searchObjectDto.getUser() ); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of("subjectAreaCoo", subjectArea)); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of("subjectAreaCoo", subjectArea)); }); }; } @@ -190,7 +180,7 @@ private void withErrorHandling(final Message message, final Runnable runnable } } - public void correlateMessage(final String processInstanceId, final String messageName, final Map message) { - this.processApi.correlateMessage(processInstanceId, messageName, message); + public void correlateMessage(final String processInstanceId, final Map message) { + this.processApi.correlateMessage(processInstanceId, message); } } diff --git a/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/test/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessorTestBase.java b/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/test/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessorTestBase.java index 71fa234c4c..8a0d5ceefd 100644 --- a/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/test/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessorTestBase.java +++ b/digiwf-integrations/digiwf-dms-integration/digiwf-dms-integration-core/src/test/java/de/muenchen/oss/digiwf/dms/integration/adapter/in/MessageProcessorTestBase.java @@ -8,7 +8,6 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; class MessageProcessorTestBase { @@ -24,7 +23,7 @@ class MessageProcessorTestBase { protected final SearchFileUseCase searchFileUseCase = Mockito.mock(SearchFileUseCase.class); protected final SearchSubjectAreaUseCase searchSubjectAreaUseCase = Mockito.mock(SearchSubjectAreaUseCase.class); protected final String processInstanceId = "exampleProcessInstanceId"; - protected final MessageHeaders messageHeaders = new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId, DIGIWF_MESSAGE_NAME, "messageName")); + protected final MessageHeaders messageHeaders = new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId)); protected MessageProcessor messageProcessor; protected void setupBase() { diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessor.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessor.java index f3c0c829b2..4bd556681c 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessor.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessor.java @@ -12,7 +12,6 @@ import java.util.function.Consumer; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; @RequiredArgsConstructor @@ -27,7 +26,6 @@ public Consumer> emailIntegration() { try { this.mailUseCase.sendMail( message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID, String.class), - message.getHeaders().get(DIGIWF_MESSAGE_NAME, String.class), message.getPayload()); this.monitoringService.sendMailSucceeded(); } catch (final BpmnError bpmnError) { diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapter.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapter.java index f80a24910a..890fe9c989 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapter.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapter.java @@ -12,8 +12,8 @@ public class ProcessAdapter implements CorrelateMessagePort { private final ProcessApi processApi; @Override - public void correlateMessage(final String processInstanceId, final String messageName, final Map message) { - this.processApi.correlateMessage(processInstanceId, messageName, message); + public void correlateMessage(final String processInstanceId, final Map message) { + this.processApi.correlateMessage(processInstanceId, message); } } diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/in/SendMail.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/in/SendMail.java index c06ec47813..12a8b59a88 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/in/SendMail.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/in/SendMail.java @@ -1,11 +1,10 @@ package de.muenchen.oss.digiwf.email.integration.application.port.in; import de.muenchen.oss.digiwf.email.integration.model.Mail; - import jakarta.validation.Valid; public interface SendMail { - void sendMail(final String processInstanceId, final String messageName, @Valid final Mail mail); + void sendMail(final String processInstanceId, @Valid final Mail mail); } diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/out/CorrelateMessagePort.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/out/CorrelateMessagePort.java index a59c8bdd53..ebfb680584 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/out/CorrelateMessagePort.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/port/out/CorrelateMessagePort.java @@ -4,6 +4,6 @@ public interface CorrelateMessagePort { - void correlateMessage(final String processInstanceId, final String messageName, final Map message); + void correlateMessage(final String processInstanceId, final Map message); } diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCase.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCase.java index 0621a057ff..308c05f252 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCase.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/main/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCase.java @@ -35,7 +35,7 @@ public class SendMailUseCase implements SendMail { * @param mail mail that is sent */ @Override - public void sendMail(final String processInstanceIde, final String messageName, @Valid final Mail mail) throws BpmnError { + public void sendMail(final String processInstanceIde, @Valid final Mail mail) throws BpmnError { try { // load Attachments final List attachments = new ArrayList<>(); @@ -59,7 +59,7 @@ public void sendMail(final String processInstanceIde, final String messageName, // correlate message final Map correlatePayload = new HashMap<>(); correlatePayload.put("mailSentStatus", true); - this.correlateMessagePort.correlateMessage(processInstanceIde, messageName, correlatePayload); + this.correlateMessagePort.correlateMessage(processInstanceIde, correlatePayload); } catch (final MessagingException ex) { log.error("Sending mail failed with exception: {}", ex.getMessage()); throw new BpmnError("MAIL_SENDING_FAILED", ex.getMessage()); diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessorTest.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessorTest.java index 2b663d4869..5688c6235c 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessorTest.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/in/MessageProcessorTest.java @@ -16,7 +16,6 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -42,7 +41,7 @@ class MessageProcessorTest { "digiwf@muenchen.de", null ); - private final MessageHeaders messageHeaders = new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId, DIGIWF_MESSAGE_NAME, "messageName")); + private final MessageHeaders messageHeaders = new MessageHeaders(Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId)); @BeforeEach void setup() { @@ -64,12 +63,12 @@ public MessageHeaders getHeaders() { void testEmailIntegrationSendsMailSuccessfully() { messageProcessor.emailIntegration().accept(this.message); verify(monitoringServiceMock, times(1)).sendMailSucceeded(); - verify(sendMailMock, times(1)).sendMail(processInstanceId, "messageName", mail); + verify(sendMailMock, times(1)).sendMail(processInstanceId, mail); } @Test void testEmailIntegrationHandlesValidationException() { - Mockito.doThrow(new ValidationException("Test ValidationException")).when(sendMailMock).sendMail(any(), any(), any()); + Mockito.doThrow(new ValidationException("Test ValidationException")).when(sendMailMock).sendMail(any(), any()); messageProcessor.emailIntegration().accept(this.message); verify(monitoringServiceMock, times(1)).sendMailFailed(); final ArgumentCaptor messageHeaderArgumentCaptor = ArgumentCaptor.forClass(Map.class); @@ -79,7 +78,7 @@ void testEmailIntegrationHandlesValidationException() { @Test void testEmailIntegrationHandlesBpmnError() { - Mockito.doThrow(new BpmnError("errorCode", "errorMessage")).when(sendMailMock).sendMail(any(), any(), any()); + Mockito.doThrow(new BpmnError("errorCode", "errorMessage")).when(sendMailMock).sendMail(any(), any()); messageProcessor.emailIntegration().accept(this.message); verify(monitoringServiceMock, times(1)).sendMailFailed(); final ArgumentCaptor messageHeaderArgumentCaptor = ArgumentCaptor.forClass(Map.class); @@ -89,7 +88,7 @@ void testEmailIntegrationHandlesBpmnError() { @Test void testEmailIntegrationHandlesIncidentError() { - Mockito.doThrow(new IncidentError("Error Message")).when(sendMailMock).sendMail(any(), any(), any()); + Mockito.doThrow(new IncidentError("Error Message")).when(sendMailMock).sendMail(any(), any()); messageProcessor.emailIntegration().accept(this.message); verify(monitoringServiceMock, times(1)).sendMailFailed(); final ArgumentCaptor messageHeaderArgumentCaptor = ArgumentCaptor.forClass(Map.class); diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapterTest.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapterTest.java index ee49b0226c..9c21453294 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapterTest.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/adapter/out/ProcessAdapterTest.java @@ -19,11 +19,10 @@ public void testCorrelateMessage() { final ProcessAdapter processAdapter = new ProcessAdapter(processApiMock); final String processInstanceId = "exampleProcessInstanceId"; - final String messageName = "exampleMessageName"; final Map message = new HashMap<>(); - processAdapter.correlateMessage(processInstanceId, messageName, message); + processAdapter.correlateMessage(processInstanceId, message); - verify(processApiMock, times(1)).correlateMessage(processInstanceId, messageName, message); + verify(processApiMock, times(1)).correlateMessage(processInstanceId, message); } } diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCaseTest.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCaseTest.java index c95fd98e21..be76c85a77 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCaseTest.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-core/src/test/java/de/muenchen/oss/digiwf/email/integration/application/usecase/SendMailUseCaseTest.java @@ -46,7 +46,7 @@ void setUp() { @Test void sendMail() throws MessagingException { - sendMail.sendMail(processInstanceId, messageName, mail); + sendMail.sendMail(processInstanceId, mail); final de.muenchen.oss.digiwf.email.model.Mail mailOutModel = de.muenchen.oss.digiwf.email.model.Mail.builder() .receivers(mail.getReceivers()) .subject(mail.getSubject()) @@ -57,7 +57,7 @@ void sendMail() throws MessagingException { .attachments(List.of()) .build(); verify(mailPort).sendMail(mailOutModel); - verify(correlateMessagePort).correlateMessage(processInstanceId, messageName, Map.of("mailSentStatus", true)); + verify(correlateMessagePort).correlateMessage(processInstanceId, Map.of("mailSentStatus", true)); } @Test @@ -68,7 +68,7 @@ void sendMailWithAttachments() throws MessagingException { final FileAttachment fileAttachment = new FileAttachment("test.txt", new ByteArrayDataSource("Anhang Inhalt".getBytes(), "text/plain")); when(loadMailAttachmentPort.loadAttachment(presignedUrl)).thenReturn(fileAttachment); - sendMail.sendMail(processInstanceId, messageName, mail); + sendMail.sendMail(processInstanceId, mail); final de.muenchen.oss.digiwf.email.model.Mail mailOutModel = de.muenchen.oss.digiwf.email.model.Mail.builder() .receivers(mail.getReceivers()) .subject(mail.getSubject()) @@ -79,12 +79,12 @@ void sendMailWithAttachments() throws MessagingException { .attachments(List.of(fileAttachment)) .build(); verify(mailPort).sendMail(mailOutModel); - verify(correlateMessagePort).correlateMessage(processInstanceId, messageName, Map.of("mailSentStatus", true)); + verify(correlateMessagePort).correlateMessage(processInstanceId, Map.of("mailSentStatus", true)); } @Test void sendMailThrowsBpmnError() throws MessagingException { doThrow(new MessagingException("Test Exception")).when(mailPort).sendMail(any()); - assertThatThrownBy(() -> sendMail.sendMail(processInstanceId, messageName, mail)).isInstanceOf(BpmnError.class); + assertThatThrownBy(() -> sendMail.sendMail(processInstanceId, mail)).isInstanceOf(BpmnError.class); } } diff --git a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-example/src/main/java/de/muenchen/oss/digiwf/email/integration/api/controller/ExampleController.java b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-example/src/main/java/de/muenchen/oss/digiwf/email/integration/api/controller/ExampleController.java index 218f090f42..4c94c259cd 100644 --- a/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-example/src/main/java/de/muenchen/oss/digiwf/email/integration/api/controller/ExampleController.java +++ b/digiwf-integrations/digiwf-email-integration/digiwf-email-integration-example/src/main/java/de/muenchen/oss/digiwf/email/integration/api/controller/ExampleController.java @@ -28,8 +28,7 @@ public class ExampleController { public void testEventBus(@RequestBody final Mail mail) { this.messageApi.sendMessage(mail, Map.of( MessageConstants.TYPE, "sendMailFromEventBus", - MessageConstants.DIGIWF_PROCESS_INSTANCE_ID, "processInstanceId", - MessageConstants.DIGIWF_MESSAGE_NAME, "testEmailIntegration" + MessageConstants.DIGIWF_PROCESS_INSTANCE_ID, "processInstanceId" ), "dwf-email-local-01"); } diff --git a/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/adapter/MessageProcessor.java b/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/adapter/MessageProcessor.java index bb5375fe27..fd38a09513 100644 --- a/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/adapter/MessageProcessor.java +++ b/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/adapter/MessageProcessor.java @@ -1,7 +1,7 @@ package de.muenchen.oss.digiwf.example.integration.core.adapter; -import de.muenchen.oss.digiwf.example.integration.core.application.out.CorrelateMessagePort; import de.muenchen.oss.digiwf.example.integration.core.application.in.ExampleUseCase; +import de.muenchen.oss.digiwf.example.integration.core.application.out.CorrelateMessagePort; import de.muenchen.oss.digiwf.message.process.api.ErrorApi; import de.muenchen.oss.digiwf.message.process.api.ProcessApi; import de.muenchen.oss.digiwf.message.process.api.error.BpmnError; @@ -14,7 +14,6 @@ import java.util.Map; import java.util.function.Consumer; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_MESSAGE_NAME; import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; @Configuration @@ -33,8 +32,7 @@ public Consumer> exampleIntegration() { final ExampleDto exampleDto = message.getPayload(); this.exampleUseCase.processExampleData(this.exampleMapper.toModel(exampleDto)); - this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - message.getHeaders().get(DIGIWF_MESSAGE_NAME).toString(), Map.of("someData", exampleDto.getSomeData())); + this.correlateMessage(message.getHeaders().get(DIGIWF_PROCESS_INSTANCE_ID).toString(), Map.of("someData", exampleDto.getSomeData())); } catch (final BpmnError bpmnError) { this.errorApi.handleBpmnError(message.getHeaders(), bpmnError); } catch (final IncidentError incidentError) { @@ -44,8 +42,8 @@ public Consumer> exampleIntegration() { } @Override - public void correlateMessage(final String processInstanceId, final String messageName, final Map message) { - this.processApi.correlateMessage(processInstanceId, messageName, message); + public void correlateMessage(final String processInstanceId, final Map message) { + this.processApi.correlateMessage(processInstanceId, message); } } diff --git a/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/application/out/CorrelateMessagePort.java b/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/application/out/CorrelateMessagePort.java index b3d71afeb6..781e0979bb 100644 --- a/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/application/out/CorrelateMessagePort.java +++ b/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-core/src/main/java/de/muenchen/oss/digiwf/example/integration/core/application/out/CorrelateMessagePort.java @@ -4,6 +4,6 @@ public interface CorrelateMessagePort { - void correlateMessage(final String processInstanceId, final String messageName, final Map message); + void correlateMessage(final String processInstanceId, final Map message); } diff --git a/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-example/src/main/java/de/muenchen/oss/digiwf/example/integration/api/HelperController.java b/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-example/src/main/java/de/muenchen/oss/digiwf/example/integration/api/HelperController.java index d05673d92f..9b9b57861d 100644 --- a/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-example/src/main/java/de/muenchen/oss/digiwf/example/integration/api/HelperController.java +++ b/digiwf-integrations/digiwf-example-integration/digiwf-example-integration-example/src/main/java/de/muenchen/oss/digiwf/example/integration/api/HelperController.java @@ -22,8 +22,7 @@ public void test() { final Map headers = new HashMap<>(Map.of( MessageConstants.TYPE, "exampleIntegration", - MessageConstants.DIGIWF_PROCESS_INSTANCE_ID, "123456789", - MessageConstants.DIGIWF_MESSAGE_NAME, "test" + MessageConstants.DIGIWF_PROCESS_INSTANCE_ID, "123456789" )); this.messageApi.sendMessage( diff --git a/digiwf-integrations/digiwf-okewo-integration/digiwf-okewo-integration-core/src/main/java/de/muenchen/oss/digiwf/okewo/integration/adapter/out/IntegrationOutAdapter.java b/digiwf-integrations/digiwf-okewo-integration/digiwf-okewo-integration-core/src/main/java/de/muenchen/oss/digiwf/okewo/integration/adapter/out/IntegrationOutAdapter.java index 1a67a31ff7..e642355a4e 100644 --- a/digiwf-integrations/digiwf-okewo-integration/digiwf-okewo-integration-core/src/main/java/de/muenchen/oss/digiwf/okewo/integration/adapter/out/IntegrationOutAdapter.java +++ b/digiwf-integrations/digiwf-okewo-integration/digiwf-okewo-integration-core/src/main/java/de/muenchen/oss/digiwf/okewo/integration/adapter/out/IntegrationOutAdapter.java @@ -24,11 +24,10 @@ public class IntegrationOutAdapter implements IntegrationOutPort { @Override public void correlateProcessMessage(@NonNull MessageHeaders headers, Map payload) { final String processInstanceId = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_PROCESS_INSTANCE_ID)).toString(); - final String messageName = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_MESSAGE_NAME)).toString(); if (payload == null) { payload = new HashMap<>(); } - this.processApi.correlateMessage(processInstanceId, messageName, payload); + this.processApi.correlateMessage(processInstanceId, payload); } @Override diff --git a/digiwf-integrations/digiwf-s3-integration/digiwf-s3-integration-core/src/main/java/de/muenchen/oss/digiwf/s3/integration/adapter/out/integration/IntegrationOutAdapter.java b/digiwf-integrations/digiwf-s3-integration/digiwf-s3-integration-core/src/main/java/de/muenchen/oss/digiwf/s3/integration/adapter/out/integration/IntegrationOutAdapter.java index 90ec5bb6a5..604fa8651c 100644 --- a/digiwf-integrations/digiwf-s3-integration/digiwf-s3-integration-core/src/main/java/de/muenchen/oss/digiwf/s3/integration/adapter/out/integration/IntegrationOutAdapter.java +++ b/digiwf-integrations/digiwf-s3-integration/digiwf-s3-integration-core/src/main/java/de/muenchen/oss/digiwf/s3/integration/adapter/out/integration/IntegrationOutAdapter.java @@ -22,11 +22,10 @@ public class IntegrationOutAdapter implements IntegrationOutPort { @Override public void correlateProcessMessage(@NonNull MessageHeaders headers, Map payload) { final String processInstanceId = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_PROCESS_INSTANCE_ID)).toString(); - final String messageName = Objects.requireNonNull(headers.get(MessageConstants.DIGIWF_MESSAGE_NAME)).toString(); if (payload == null) { payload = new HashMap<>(); } - this.processApi.correlateMessage(processInstanceId, messageName, payload); + this.processApi.correlateMessage(processInstanceId, payload); } @Override diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/common/MessageConstants.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/common/MessageConstants.java index 39b7a652bb..348c161e80 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/common/MessageConstants.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/common/MessageConstants.java @@ -5,6 +5,5 @@ */ public final class MessageConstants { public static final String TYPE = "type"; - public static final String DIGIWF_MESSAGE_NAME = "digiwf.messagename"; public static final String DIGIWF_PROCESS_INSTANCE_ID = "digiwf.processinstanceid"; } diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ErrorApi.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ErrorApi.java index 9137b31059..5016d4eed3 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ErrorApi.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ErrorApi.java @@ -10,11 +10,10 @@ public interface ErrorApi { /** * Handles an incident with the specified process instance ID, origin message name, and error message. * @param processInstanceId The ID of the process instance associated with the incident. - * @param originMessageName The name of the message that caused the incident. * @param errorMessage The error message associated with the incident. * @return true if the incident was successfully handled, false otherwise. */ - boolean handleIncident(String processInstanceId, String originMessageName, String errorMessage); + boolean handleIncident(String processInstanceId, String errorMessage); /** * Handles a bpmn error with the specified process instance ID, error code, and error message. diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ProcessApi.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ProcessApi.java index 79e011343b..75ba60e2c8 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ProcessApi.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/api/ProcessApi.java @@ -27,11 +27,10 @@ public interface ProcessApi { /** * Correlates a message with the specified process instance ID and payload variables. * @param processInstanceId The ID of the process instance to correlate the message with. - * @param messageName The name of the message to be correlated. * @param payloadVariables The payload variables to be included in the message correlation. * @return true if the message was successfully correlated, false otherwise. */ - boolean correlateMessage(String processInstanceId, String messageName, Map payloadVariables); + boolean correlateMessage(String processInstanceId, Map payloadVariables); } diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImpl.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImpl.java index d4c42e549c..840880a48c 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImpl.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImpl.java @@ -10,7 +10,8 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.*; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.TYPE; @Slf4j @RequiredArgsConstructor @@ -27,17 +28,15 @@ public class ErrorApiImpl implements ErrorApi { * The incident message contains the process instance id, message name and error message. * * @param processInstanceId The process instance id of the process to be correlated. - * @param messageName The message name to be correlated. * @param errorMessage The error message to be passed to the process. * @return */ @Override - public boolean handleIncident(final String processInstanceId, final String messageName, final String errorMessage) { + public boolean handleIncident(final String processInstanceId, final String errorMessage) { log.error("Incident occured for process {} with error message {}", processInstanceId, errorMessage); final Map headers = Map.of( TYPE, this.incidentDestination, - DIGIWF_PROCESS_INSTANCE_ID, processInstanceId, - DIGIWF_MESSAGE_NAME, messageName + DIGIWF_PROCESS_INSTANCE_ID, processInstanceId ); return this.messageApi.sendMessage(errorMessage, headers, this.incidentDestination); } @@ -58,12 +57,10 @@ public boolean handleBpmnError(final String processInstanceId, final String erro .processInstanceId(processInstanceId) .errorCode(errorCode) .errorMessage(errorMessage) - .messageName(BPMN_ERROR_MESSAGE_NAME) .build(); final Map headers = Map.of( TYPE, BPMN_ERROR_MESSAGE_TYPE, - DIGIWF_PROCESS_INSTANCE_ID, processInstanceId, - DIGIWF_MESSAGE_NAME, BPMN_ERROR_MESSAGE_NAME + DIGIWF_PROCESS_INSTANCE_ID, processInstanceId ); return this.messageApi.sendMessage(payload, headers, this.bpmnErrorDestination); } @@ -82,11 +79,7 @@ public boolean handleIncident(final Map originMessageHeaders, fi if (!originMessageHeaders.containsKey(DIGIWF_PROCESS_INSTANCE_ID)) { throw new RuntimeException("The origin message headers do not contain a process instance id."); } - if (!originMessageHeaders.containsKey(DIGIWF_MESSAGE_NAME)) { - throw new RuntimeException("The origin message headers do not contain a message name."); - } - return this.handleIncident(originMessageHeaders.get(DIGIWF_PROCESS_INSTANCE_ID).toString(), - originMessageHeaders.get(DIGIWF_MESSAGE_NAME).toString(), incidentError.getErrorMessage()); + return this.handleIncident(originMessageHeaders.get(DIGIWF_PROCESS_INSTANCE_ID).toString(), incidentError.getErrorMessage()); } } diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImpl.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImpl.java index e53818792d..e3819bc8d4 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImpl.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImpl.java @@ -9,7 +9,8 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.*; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.TYPE; /** * Default implementation of {@link ProcessApi}. @@ -59,21 +60,18 @@ public boolean startProcess(final String processKey, final Map v * The correlate message contains the process instance id, message name and variables. * * @param processInstanceId The process instance id of the process to be correlated. - * @param messageName The message name to be correlated. * @param payloadVariables The variables to be passed to the process. * @return */ @Override - public boolean correlateMessage(final String processInstanceId, final String messageName, final Map payloadVariables) { + public boolean correlateMessage(final String processInstanceId, final Map payloadVariables) { final CorrelateMessageDto payload = CorrelateMessageDto.builder() .processInstanceId(processInstanceId) - .messageName(messageName) .payloadVariables(payloadVariables) .build(); final Map headers = Map.of( TYPE, CORRELATEMESSAGEV_01, - DIGIWF_PROCESS_INSTANCE_ID, processInstanceId, - DIGIWF_MESSAGE_NAME, messageName + DIGIWF_PROCESS_INSTANCE_ID, processInstanceId ); return this.messageApi.sendMessage(payload, headers, this.correlateMessageDestination); } diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/dto/CorrelateMessageDto.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/dto/CorrelateMessageDto.java index 42259ca088..275447c35a 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/dto/CorrelateMessageDto.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/main/java/de/muenchen/oss/digiwf/message/process/impl/dto/CorrelateMessageDto.java @@ -11,7 +11,6 @@ @NoArgsConstructor public class CorrelateMessageDto { private String processInstanceId; - private String messageName; private String businessKey; private Map payloadVariables; private Map payloadVariablesLocal; diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImplTest.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImplTest.java index 458ed117a2..41aaef1ad1 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImplTest.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ErrorApiImplTest.java @@ -13,7 +13,8 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.*; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.TYPE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.*; @@ -34,9 +35,8 @@ class ErrorApiImplTest { private final String processInstanceId = "processInstanceId-123"; private final String incidentDestination = "incidentMessageDestination"; private final String bpmnErrorDestination = "bpmnErrorMessageDestination"; - private final String messageName = "someMessageName"; - private final Map messageHeaders = Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId, - DIGIWF_MESSAGE_NAME, this.messageName); + + private final Map messageHeaders = Map.of(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId); @BeforeEach @@ -46,9 +46,9 @@ void setUp() { @Test void testHandleIncident() { - final boolean success = this.errorApi.handleIncident(this.processInstanceId, this.messageName, "someErrorMessage"); + final boolean success = this.errorApi.handleIncident(this.processInstanceId, "someErrorMessage"); assertThat(success).isTrue(); - this.verifyIncidentMessageApiCall("someErrorMessage", this.incidentDestination, this.messageName, this.incidentDestination); + this.verifyIncidentMessageApiCall("someErrorMessage", this.incidentDestination, this.incidentDestination); } @Test @@ -71,7 +71,7 @@ void testHandleBpmnErrorWithException() { @Test void testHandleBpmnErrorWithExceptionRaisesRuntimeExceptionOnMissingProcessInstance() { final BpmnError bpmnError = new BpmnError("400", "someErrorMessage"); - assertThatThrownBy(() -> this.errorApi.handleBpmnError(Map.of(DIGIWF_MESSAGE_NAME, "someMessage"), bpmnError)) + assertThatThrownBy(() -> this.errorApi.handleBpmnError(Map.of(), bpmnError)) .isInstanceOf(RuntimeException.class); } @@ -80,13 +80,13 @@ void testHandleIncidentWithException() { final IncidentError incidentError = new IncidentError("someErrorMessage"); final boolean success = this.errorApi.handleIncident(this.messageHeaders, incidentError); assertThat(success).isTrue(); - this.verifyIncidentMessageApiCall("someErrorMessage", this.incidentDestination, this.messageName, this.incidentDestination); + this.verifyIncidentMessageApiCall("someErrorMessage", this.incidentDestination, this.incidentDestination); } @Test void testHandleIncidentWithExceptionRaisesRuntimeExceptionOnMissingProcessInstance() { final IncidentError incidentError = new IncidentError("someErrorMessage"); - assertThatThrownBy(() -> this.errorApi.handleIncident(Map.of(DIGIWF_MESSAGE_NAME, "someMessage"), incidentError)) + assertThatThrownBy(() -> this.errorApi.handleIncident(Map.of(), incidentError)) .isInstanceOf(RuntimeException.class); } @@ -107,11 +107,10 @@ private void verifyBpmnErrorMessageApiCall(final BpmnError payload, final String Assertions.assertEquals(payload.getErrorCode(), payloadCaptor.getValue().getErrorCode()); Assertions.assertEquals(this.processInstanceId, payloadCaptor.getValue().getProcessInstanceId()); Assertions.assertEquals(destination, destinationCaptor.getValue()); - Assertions.assertEquals("bpmnError", headersCaptor.getValue().get(DIGIWF_MESSAGE_NAME), "Message name should be bpmnError"); Assertions.assertEquals("bpmnerror", headersCaptor.getValue().get(TYPE), "Message type should be bpmnerror"); } - private void verifyIncidentMessageApiCall(final String payload, final String typeHeader, final String messageNameHeader, final String destination) { + private void verifyIncidentMessageApiCall(final String payload, final String typeHeader, final String destination) { final ArgumentCaptor payloadCaptor = ArgumentCaptor.forClass(String.class); final ArgumentCaptor> headersCaptor = ArgumentCaptor.forClass(Map.class); final ArgumentCaptor destinationCaptor = ArgumentCaptor.forClass(String.class); @@ -122,8 +121,7 @@ private void verifyIncidentMessageApiCall(final String payload, final String typ assertThat(headersCaptor.getValue()) .hasSize(3) .containsEntry(TYPE, typeHeader) - .containsEntry(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId) - .containsEntry(DIGIWF_MESSAGE_NAME, messageNameHeader); + .containsEntry(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId); assertThat(destinationCaptor.getValue()).isEqualTo(destination); } diff --git a/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImplTest.java b/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImplTest.java index c769f81200..73a7fab56d 100644 --- a/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImplTest.java +++ b/digiwf-libs/digiwf-message/digiwf-message-core/src/test/java/de/muenchen/oss/digiwf/message/process/impl/ProcessApiImplTest.java @@ -10,7 +10,8 @@ import java.util.Map; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.*; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.TYPE; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; @@ -55,8 +56,7 @@ void testStartProcessWithFileContext() { @Test void testCorrelateMessage() { - final String messageName = "correlateMessage"; - final boolean success = this.processApi.correlateMessage(this.processInstanceId, messageName, this.variables); + final boolean success = this.processApi.correlateMessage(this.processInstanceId, this.variables); assertThat(success).isTrue(); final ArgumentCaptor payloadCaptor = ArgumentCaptor.forClass(CorrelateMessageDto.class); @@ -68,14 +68,12 @@ void testCorrelateMessage() { final Map headers = headersCaptor.getValue(); assertThat(payload.getProcessInstanceId()).isEqualTo(this.processInstanceId); - assertThat(payload.getMessageName()).isEqualTo(messageName); assertThat(payload.getPayloadVariables()).isEqualTo(this.variables); assertThat(headers) .hasSize(3) .containsEntry(TYPE, "correlatemessagev01") - .containsEntry(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId) - .containsEntry(DIGIWF_MESSAGE_NAME, messageName); + .containsEntry(DIGIWF_PROCESS_INSTANCE_ID, this.processInstanceId); assertThat(destinationCaptor.getValue()).isEqualTo("correlateMessageDestination"); } diff --git a/digiwf-libs/digiwf-testing/digiwf-e2e-test-core/src/main/java/de/muenchen/oss/digiwf/integration/e2e/test/DigiwfIntegrationE2eTestUtility.java b/digiwf-libs/digiwf-testing/digiwf-e2e-test-core/src/main/java/de/muenchen/oss/digiwf/integration/e2e/test/DigiwfIntegrationE2eTestUtility.java index c6421b904f..244b29a24f 100644 --- a/digiwf-libs/digiwf-testing/digiwf-e2e-test-core/src/main/java/de/muenchen/oss/digiwf/integration/e2e/test/DigiwfIntegrationE2eTestUtility.java +++ b/digiwf-libs/digiwf-testing/digiwf-e2e-test-core/src/main/java/de/muenchen/oss/digiwf/integration/e2e/test/DigiwfIntegrationE2eTestUtility.java @@ -8,7 +8,8 @@ import java.util.Map; import java.util.concurrent.TimeUnit; -import static de.muenchen.oss.digiwf.message.common.MessageConstants.*; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.DIGIWF_PROCESS_INSTANCE_ID; +import static de.muenchen.oss.digiwf.message.common.MessageConstants.TYPE; import static org.awaitility.Awaitility.await; @Component @@ -36,7 +37,7 @@ public Map runIntegration(final Object payload, final String pro } private void sendMessage(final Object payload, final String processInstanceId, final String messageType) { - final Map headers = Map.of(DIGIWF_PROCESS_INSTANCE_ID, processInstanceId, DIGIWF_MESSAGE_NAME, "messageName", TYPE, messageType); + final Map headers = Map.of(DIGIWF_PROCESS_INSTANCE_ID, processInstanceId, TYPE, messageType); messageApi.sendMessage(payload, headers, messageTopic); }