From: Kai Moritz Date: Tue, 29 Aug 2023 16:59:06 +0000 (+0200) Subject: WIP:KafkaChatHomeTes X-Git-Tag: rebase--2023-08-29--19-04~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=5cdd57e5487b5f8006aa2099cd59910ab017c48c;p=demos%2Fkafka%2Fchat WIP:KafkaChatHomeTes t --- 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,