From e2dc6a9d5613bbf95e93febd9e9e86add0cb79de Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 8 Nov 2023 11:32:32 +0100 Subject: [PATCH] OZG-4461 rename executeProcessor -> processVorgang --- .../processor/ProcessorEventListener.java | 10 +++---- .../ProcessorEventListenerITCase.java | 2 +- .../processor/ProcessorEventListenerTest.java | 26 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/de/ozgcloud/processor/processor/ProcessorEventListener.java b/src/main/java/de/ozgcloud/processor/processor/ProcessorEventListener.java index a4e761b..8dccef2 100644 --- a/src/main/java/de/ozgcloud/processor/processor/ProcessorEventListener.java +++ b/src/main/java/de/ozgcloud/processor/processor/ProcessorEventListener.java @@ -33,9 +33,9 @@ class ProcessorEventListener { private final ResultService resultService; private final ApplicationEventPublisher publisher; - static final String EXECUTE_PROCESS_ORDER = "EXECUTE_PROCESSOR"; - private static final String IS_EXECUTE_PROCESSOR = "{T(de.ozgcloud.processor.processor.ProcessorEventListener).IS_EXECUTE_PROCESSOR_EVENT.test(event.getSource())}"; - public static final Predicate<Command> IS_EXECUTE_PROCESSOR_EVENT = command -> command.getOrder().equals(EXECUTE_PROCESS_ORDER); + static final String PROCESS_VORGANG_ORDER = "PROCESS_VORGANG"; + private static final String IS_PROCESS_VORGANG = "{T(de.ozgcloud.processor.processor.ProcessorEventListener).IS_PROCESS_VORGANG_EVENT.test(event.getSource())}"; + public static final Predicate<Command> IS_PROCESS_VORGANG_EVENT = command -> command.getOrder().equals(PROCESS_VORGANG_ORDER); static final String COMMAND_PROCESSOR_NAMES_KEY = "processorNames"; @@ -52,8 +52,8 @@ class ProcessorEventListener { } } - @EventListener(condition = IS_EXECUTE_PROCESSOR) - public void onCommandExecuteProcessor(CommandCreatedEvent event) { + @EventListener(condition = IS_PROCESS_VORGANG) + public void onCommandProcessVorgang(CommandCreatedEvent event) { try { var vorgang = getVorgang(event.getSource().getVorgangId()); processorService.processVorgang(vorgang, getProcessorNames(event.getSource())) diff --git a/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerITCase.java b/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerITCase.java index 16e8239..4653353 100644 --- a/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerITCase.java +++ b/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerITCase.java @@ -50,7 +50,7 @@ class ProcessorEventListenerITCase { @Test void shouldTriggerForExecuteProcessor() { - var command = CommandTestFactory.createBuilder().order(ProcessorEventListener.EXECUTE_PROCESS_ORDER).build(); + var command = CommandTestFactory.createBuilder().order(ProcessorEventListener.PROCESS_VORGANG_ORDER).build(); publisher.publishEvent(new CommandCreatedEvent(command)); diff --git a/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerTest.java b/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerTest.java index f67fee6..125d0c0 100644 --- a/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerTest.java +++ b/src/test/java/de/ozgcloud/processor/processor/ProcessorEventListenerTest.java @@ -118,9 +118,9 @@ class ProcessorEventListenerTest { } } - @DisplayName("On command executeProcessor") + @DisplayName("On command processVorgang") @Nested - class TestOnCommandExecuteProcessor { + class TestOnCommandProcessVorgang { @Mock private Throwable exception; @@ -149,28 +149,28 @@ class ProcessorEventListenerTest { @Test void shouldGetVorgang() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(vorgangService).getVorgang(VorgangId.from(CommandTestFactory.VORGANG_ID)); } @Test void shouldCallService() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(processorService).processVorgang(vorgang, processorNames); } @Test void shouldProcessResult() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(vorgangEventListener).processResult(any(), eq(CommandTestFactory.VORGANG_ID)); } @Test void shouldPublishCommandProcessedEvent() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(vorgangEventListener).publishCommandProcessedEvent(event.getSource()); } @@ -187,7 +187,7 @@ class ProcessorEventListenerTest { @Test void shouldPublishEventBeClassOf() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(publisher).publishEvent(commandSuccessEventCaptor.capture()); assertThat(commandSuccessEventCaptor.getValue().getClass()).isEqualTo(VorgangProcessedEvent.class); @@ -195,7 +195,7 @@ class ProcessorEventListenerTest { @Test void shouldPublishEventHasCommanIdAsSource() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(publisher).publishEvent(commandSuccessEventCaptor.capture()); assertThat(commandSuccessEventCaptor.getValue().getSource()).isEqualTo(CommandTestFactory.ID); @@ -203,7 +203,7 @@ class ProcessorEventListenerTest { @Test void shouldPublishEventHasCommand() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(publisher).publishEvent(commandSuccessEventCaptor.capture()); assertThat(commandSuccessEventCaptor.getValue().getCommand()).isEqualTo(command); @@ -228,14 +228,14 @@ class ProcessorEventListenerTest { @Test void shouldProcessError() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(resultService).processError(any(), eq(CommandTestFactory.VORGANG_ID)); } @Test void shouldPublishEventOnConstraintException() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(vorgangEventListener).publishCommandFailedEvent(any(), any()); } @@ -252,14 +252,14 @@ class ProcessorEventListenerTest { @Test void shouldProcessError() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(vorgangEventListener).publishCommandFailedEvent(any(), any()); } @Test void shouldPublishCommandFailedEvent() { - vorgangEventListener.onCommandExecuteProcessor(event); + vorgangEventListener.onCommandProcessVorgang(event); verify(resultService).processError(any(), eq(CommandTestFactory.VORGANG_ID)); } -- GitLab