From 5cdd57e5487b5f8006aa2099cd59910ab017c48c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 29 Aug 2023 18:59:06 +0200 Subject: [PATCH] WIP:KafkaChatHomeTes t --- .../persistence/kafka/KafkaChatHomeTest.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHomeTest.java b/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHomeTest.java index 5e694e62..637f1453 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHomeTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHomeTest.java @@ -22,6 +22,7 @@ import org.springframework.kafka.support.SendResult; import org.springframework.kafka.test.context.EmbeddedKafka; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import java.time.Clock; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -31,6 +32,7 @@ import static de.juplo.kafka.chat.backend.persistence.kafka.KafkaChatHomeTest.TO @SpringBootTest( classes = { + KafkaChatHomeTest.KafkaChatHomeTestConfiguration.class, KafkaServicesConfiguration.class, KafkaAutoConfiguration.class, TaskExecutionAutoConfiguration.class, @@ -43,7 +45,6 @@ import static de.juplo.kafka.chat.backend.persistence.kafka.KafkaChatHomeTest.TO "chat.backend.kafka.chatroom-channel-topic=" + TOPIC, "chat.backend.kafka.num-partitions=" + NUM_SHARDS, }) -@EnableConfigurationProperties(ChatBackendProperties.class) @EmbeddedKafka(topics = { TOPIC }, partitions = 10) @Slf4j public class KafkaChatHomeTest extends ChatHomeWithShardsTestBase @@ -53,6 +54,18 @@ public class KafkaChatHomeTest extends ChatHomeWithShardsTestBase static CompletableFuture CONSUMER_JOB; + @TestConfiguration + @EnableConfigurationProperties(ChatBackendProperties.class) + static class KafkaChatHomeTestConfiguration + { + @Bean + Clock clock() + { + return Clock.systemDefaultZone(); + } + } + + @BeforeAll public static void sendAndLoadStoredData( @Autowired KafkaTemplate messageTemplate, -- 2.20.1