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

OZG-4461 rename executeProcessor -> processVorgang

parent 124b0e09
Branches
Tags
No related merge requests found
......@@ -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()))
......
......@@ -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));
......
......@@ -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));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment