From b371cfcf33f8b6d8e474d6fc0ef6f506f0d8009f Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 27 Feb 2024 11:40:01 +0100 Subject: [PATCH] WIP:test: HandoverIT-POC - splitted up code into smaller classes -- ALIGN --- .../de/juplo/kafka/chat/backend/HandoverIT.java | 15 +++++---------- .../kafka/chat/backend/HandoverITContainers.java | 4 ++-- .../chat/backend/KafkaHandoverITContainers.java | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/HandoverIT.java b/src/test/java/de/juplo/kafka/chat/backend/HandoverIT.java index 3e662c5a..914f7036 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/HandoverIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/HandoverIT.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/HandoverITContainers.java b/src/test/java/de/juplo/kafka/chat/backend/HandoverITContainers.java index 96f521fd..876d117c 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/HandoverITContainers.java +++ b/src/test/java/de/juplo/kafka/chat/backend/HandoverITContainers.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; -- 2.20.1