From 921732a83b42d21cdd69d38c402eb2f8f57c1622 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 29 Aug 2023 18:55:59 +0200 Subject: [PATCH] WIP:KafkaChatHomeTest git commit -a -mWIP:KafkaChatHomeTest --- .../persistence/kafka/KafkaChatHomeTest.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) 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 58bcaa69..5e694e62 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 @@ -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 CONSUMER_JOB; - @TestConfiguration - @Import({ - KafkaServicesConfiguration.class, - KafkaAutoConfiguration.class, - TaskExecutionAutoConfiguration.class, - }) - @EnableConfigurationProperties(ChatBackendProperties.class) - static class Configuration - { - } @BeforeAll public static void sendAndLoadStoredData( @Autowired KafkaTemplate messageTemplate, -- 2.20.1