Skip to content
Snippets Groups Projects
Commit e2dc6a9d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4461 rename executeProcessor -> processVorgang

parent 124b0e09
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,9 @@ class ProcessorEventListener { ...@@ -33,9 +33,9 @@ class ProcessorEventListener {
private final ResultService resultService; private final ResultService resultService;
private final ApplicationEventPublisher publisher; private final ApplicationEventPublisher publisher;
static final String EXECUTE_PROCESS_ORDER = "EXECUTE_PROCESSOR"; static final String PROCESS_VORGANG_ORDER = "PROCESS_VORGANG";
private static final String IS_EXECUTE_PROCESSOR = "{T(de.ozgcloud.processor.processor.ProcessorEventListener).IS_EXECUTE_PROCESSOR_EVENT.test(event.getSource())}"; 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_EXECUTE_PROCESSOR_EVENT = command -> command.getOrder().equals(EXECUTE_PROCESS_ORDER); public static final Predicate<Command> IS_PROCESS_VORGANG_EVENT = command -> command.getOrder().equals(PROCESS_VORGANG_ORDER);
static final String COMMAND_PROCESSOR_NAMES_KEY = "processorNames"; static final String COMMAND_PROCESSOR_NAMES_KEY = "processorNames";
...@@ -52,8 +52,8 @@ class ProcessorEventListener { ...@@ -52,8 +52,8 @@ class ProcessorEventListener {
} }
} }
@EventListener(condition = IS_EXECUTE_PROCESSOR) @EventListener(condition = IS_PROCESS_VORGANG)
public void onCommandExecuteProcessor(CommandCreatedEvent event) { public void onCommandProcessVorgang(CommandCreatedEvent event) {
try { try {
var vorgang = getVorgang(event.getSource().getVorgangId()); var vorgang = getVorgang(event.getSource().getVorgangId());
processorService.processVorgang(vorgang, getProcessorNames(event.getSource())) processorService.processVorgang(vorgang, getProcessorNames(event.getSource()))
......
...@@ -50,7 +50,7 @@ class ProcessorEventListenerITCase { ...@@ -50,7 +50,7 @@ class ProcessorEventListenerITCase {
@Test @Test
void shouldTriggerForExecuteProcessor() { 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)); publisher.publishEvent(new CommandCreatedEvent(command));
......
...@@ -118,9 +118,9 @@ class ProcessorEventListenerTest { ...@@ -118,9 +118,9 @@ class ProcessorEventListenerTest {
} }
} }
@DisplayName("On command executeProcessor") @DisplayName("On command processVorgang")
@Nested @Nested
class TestOnCommandExecuteProcessor { class TestOnCommandProcessVorgang {
@Mock @Mock
private Throwable exception; private Throwable exception;
...@@ -149,28 +149,28 @@ class ProcessorEventListenerTest { ...@@ -149,28 +149,28 @@ class ProcessorEventListenerTest {
@Test @Test
void shouldGetVorgang() { void shouldGetVorgang() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(vorgangService).getVorgang(VorgangId.from(CommandTestFactory.VORGANG_ID)); verify(vorgangService).getVorgang(VorgangId.from(CommandTestFactory.VORGANG_ID));
} }
@Test @Test
void shouldCallService() { void shouldCallService() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(processorService).processVorgang(vorgang, processorNames); verify(processorService).processVorgang(vorgang, processorNames);
} }
@Test @Test
void shouldProcessResult() { void shouldProcessResult() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(vorgangEventListener).processResult(any(), eq(CommandTestFactory.VORGANG_ID)); verify(vorgangEventListener).processResult(any(), eq(CommandTestFactory.VORGANG_ID));
} }
@Test @Test
void shouldPublishCommandProcessedEvent() { void shouldPublishCommandProcessedEvent() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(vorgangEventListener).publishCommandProcessedEvent(event.getSource()); verify(vorgangEventListener).publishCommandProcessedEvent(event.getSource());
} }
...@@ -187,7 +187,7 @@ class ProcessorEventListenerTest { ...@@ -187,7 +187,7 @@ class ProcessorEventListenerTest {
@Test @Test
void shouldPublishEventBeClassOf() { void shouldPublishEventBeClassOf() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(publisher).publishEvent(commandSuccessEventCaptor.capture()); verify(publisher).publishEvent(commandSuccessEventCaptor.capture());
assertThat(commandSuccessEventCaptor.getValue().getClass()).isEqualTo(VorgangProcessedEvent.class); assertThat(commandSuccessEventCaptor.getValue().getClass()).isEqualTo(VorgangProcessedEvent.class);
...@@ -195,7 +195,7 @@ class ProcessorEventListenerTest { ...@@ -195,7 +195,7 @@ class ProcessorEventListenerTest {
@Test @Test
void shouldPublishEventHasCommanIdAsSource() { void shouldPublishEventHasCommanIdAsSource() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(publisher).publishEvent(commandSuccessEventCaptor.capture()); verify(publisher).publishEvent(commandSuccessEventCaptor.capture());
assertThat(commandSuccessEventCaptor.getValue().getSource()).isEqualTo(CommandTestFactory.ID); assertThat(commandSuccessEventCaptor.getValue().getSource()).isEqualTo(CommandTestFactory.ID);
...@@ -203,7 +203,7 @@ class ProcessorEventListenerTest { ...@@ -203,7 +203,7 @@ class ProcessorEventListenerTest {
@Test @Test
void shouldPublishEventHasCommand() { void shouldPublishEventHasCommand() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(publisher).publishEvent(commandSuccessEventCaptor.capture()); verify(publisher).publishEvent(commandSuccessEventCaptor.capture());
assertThat(commandSuccessEventCaptor.getValue().getCommand()).isEqualTo(command); assertThat(commandSuccessEventCaptor.getValue().getCommand()).isEqualTo(command);
...@@ -228,14 +228,14 @@ class ProcessorEventListenerTest { ...@@ -228,14 +228,14 @@ class ProcessorEventListenerTest {
@Test @Test
void shouldProcessError() { void shouldProcessError() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(resultService).processError(any(), eq(CommandTestFactory.VORGANG_ID)); verify(resultService).processError(any(), eq(CommandTestFactory.VORGANG_ID));
} }
@Test @Test
void shouldPublishEventOnConstraintException() { void shouldPublishEventOnConstraintException() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(vorgangEventListener).publishCommandFailedEvent(any(), any()); verify(vorgangEventListener).publishCommandFailedEvent(any(), any());
} }
...@@ -252,14 +252,14 @@ class ProcessorEventListenerTest { ...@@ -252,14 +252,14 @@ class ProcessorEventListenerTest {
@Test @Test
void shouldProcessError() { void shouldProcessError() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(vorgangEventListener).publishCommandFailedEvent(any(), any()); verify(vorgangEventListener).publishCommandFailedEvent(any(), any());
} }
@Test @Test
void shouldPublishCommandFailedEvent() { void shouldPublishCommandFailedEvent() {
vorgangEventListener.onCommandExecuteProcessor(event); vorgangEventListener.onCommandProcessVorgang(event);
verify(resultService).processError(any(), eq(CommandTestFactory.VORGANG_ID)); verify(resultService).processError(any(), eq(CommandTestFactory.VORGANG_ID));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment