WIP:KafkaChatHomeTes
authorKai Moritz <kai@juplo.de>
Tue, 29 Aug 2023 16:59:06 +0000 (18:59 +0200)
committerKai Moritz <kai@juplo.de>
Tue, 29 Aug 2023 16:59:06 +0000 (18:59 +0200)
t

src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaChatHomeTest.java

index 5e694e6..637f145 100644 (file)
@@ -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<Void> CONSUMER_JOB;
 
 
+  @TestConfiguration
+  @EnableConfigurationProperties(ChatBackendProperties.class)
+  static class KafkaChatHomeTestConfiguration
+  {
+    @Bean
+    Clock clock()
+    {
+      return Clock.systemDefaultZone();
+    }
+  }
+
+
   @BeforeAll
   public static void sendAndLoadStoredData(
       @Autowired KafkaTemplate<String, String> messageTemplate,