WIP:KafkaChatHomeTest
authorKai Moritz <kai@juplo.de>
Tue, 29 Aug 2023 16:55:59 +0000 (18:55 +0200)
committerKai Moritz <kai@juplo.de>
Tue, 29 Aug 2023 16:55:59 +0000 (18:55 +0200)
git commit -a -mWIP:KafkaChatHomeTest

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

index 58bcaa6..5e694e6 100644 (file)
@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
 import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.TestConfiguration;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Import;
@@ -28,7 +29,13 @@ import static de.juplo.kafka.chat.backend.domain.ChatHomeWithShardsTestBase.NUM_
 import static de.juplo.kafka.chat.backend.persistence.kafka.KafkaChatHomeTest.TOPIC;
 
 
-@PropertySource({
+@SpringBootTest(
+    classes = {
+        KafkaServicesConfiguration.class,
+        KafkaAutoConfiguration.class,
+        TaskExecutionAutoConfiguration.class,
+    },
+    properties = {
     "chat.backend.services=kafka",
     "chat.backend.kafka.client-id-PREFIX=TEST",
     "chat.backend.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}",
@@ -36,6 +43,7 @@ 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
@@ -45,16 +53,6 @@ public class KafkaChatHomeTest extends ChatHomeWithShardsTestBase
   static CompletableFuture<Void> CONSUMER_JOB;
 
 
-  @TestConfiguration
-  @Import({
-      KafkaServicesConfiguration.class,
-      KafkaAutoConfiguration.class,
-      TaskExecutionAutoConfiguration.class,
-  })
-  @EnableConfigurationProperties(ChatBackendProperties.class)
-  static class Configuration
-  {
-  }
   @BeforeAll
   public static void sendAndLoadStoredData(
       @Autowired KafkaTemplate<String, String> messageTemplate,