From: Kai Moritz Date: Tue, 27 Feb 2024 10:40:01 +0000 (+0100) Subject: WIP:test: HandoverIT-POC - splitted up code into smaller classes -- ALIGN X-Git-Tag: rebase--2024-02-27--11-55~5 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=592ed5963557567cfc25303fde8890b93ea5616b;p=demos%2Fkafka%2Fchat WIP:test: HandoverIT-POC - splitted up code into smaller classes -- ALIGN --- diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java index 3e662c5a..914f7036 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java @@ -1,7 +1,6 @@ package de.juplo.kafka.chat.backend; import de.juplo.kafka.chat.backend.api.ChatRoomInfoTo; -import de.juplo.kafka.chat.backend.api.MessageTo; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -13,10 +12,6 @@ import org.springframework.web.reactive.function.client.WebClient; import org.testcontainers.junit.jupiter.Testcontainers; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.util.retry.Retry; - -import java.time.Duration; -import java.util.stream.IntStream; @Testcontainers @@ -26,12 +21,12 @@ public abstract class AbstractHandoverIT static final ParameterizedTypeReference> SSE_TYPE = new ParameterizedTypeReference<>() {}; - private final AbstractContainerTemplates containerTemplates; + private final HandoverITContainers containers; - AbstractHandoverIT(AbstractContainerTemplates containerTemplates) + AbstractHandoverIT(HandoverITContainers containers) { - this.containerTemplates = containerTemplates; + this.containers = containers; } @@ -86,9 +81,9 @@ public abstract class AbstractHandoverIT @BeforeEach void setUp() throws Exception { - containerTemplates.setUp(); + containers.setUp(); - Integer port = containerTemplates.haproxy.getMappedPort(8400); + Integer port = containers.haproxy.getMappedPort(8400); webClient = WebClient.create("http://localhost:" + port); } } diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverITContainers.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverITContainers.java index 96f521fd..876d117c 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverITContainers.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverITContainers.java @@ -18,7 +18,7 @@ import java.util.Arrays; @Slf4j -public abstract class AbstractContainerTemplates +public abstract class HandoverITContainers { static final ImagePullPolicy NEVER_PULL = imageName -> false; @@ -27,7 +27,7 @@ public abstract class AbstractContainerTemplates final GenericContainer haproxy, backend1, backend2, backend3; - AbstractContainerTemplates() + HandoverITContainers() { haproxy = createHaproxyContainer(); backend1 = createBackendContainer("1"); diff --git a/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverITContainers.java b/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverITContainers.java index 42380b23..6c2d9886 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverITContainers.java +++ b/src/test/java/de/juplo/kafka/chat/backend/KafkaHandoverITContainers.java @@ -11,7 +11,7 @@ import java.io.IOException; @Slf4j -class KafkaContainerTemplates extends AbstractContainerTemplates +class KafkaContainerTemplates extends HandoverITContainers { private final KafkaContainer kafka;