WIP
authorKai Moritz <kai@juplo.de>
Sun, 20 Aug 2023 08:42:26 +0000 (10:42 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 20 Aug 2023 08:51:57 +0000 (10:51 +0200)
src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java

index d142760..7b2df45 100644 (file)
@@ -1,13 +1,18 @@
 package de.juplo.kafka.chat.backend;
 
 import de.juplo.kafka.chat.backend.domain.ShardingStrategy;
+import de.juplo.kafka.chat.backend.persistence.kafka.KafkaServicesApplicationRunner;
+import org.apache.kafka.clients.consumer.Consumer;
 import org.apache.kafka.clients.producer.ProducerRecord;
+import org.apache.kafka.common.TopicPartition;
 import org.junit.jupiter.api.BeforeAll;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
 import org.springframework.kafka.core.KafkaTemplate;
 import org.springframework.kafka.test.context.EmbeddedKafka;
 
+import java.util.List;
 import java.util.UUID;
 
 import static de.juplo.kafka.chat.backend.KafkaConfigurationIT.TOPIC;
@@ -28,8 +33,19 @@ class KafkaConfigurationIT extends AbstractConfigurationWithShardingIT
 {
   final static String TOPIC = "TEST_CHATROOM_CHANNEL";
 
+  @MockBean
+  KafkaServicesApplicationRunner kafkaServicesApplicationRunner;
+
+
+  @BeforeAll
+  public static void prepareChatRoomChannelConsumer(
+      @Autowired Consumer chatRoomChannelConsumer)
+  {
+    chatRoomChannelConsumer.assign(List.of(new TopicPartition(TOPIC, 6)));
+  }
+
   @BeforeAll
-  public static void test(
+  public static void sendStoredData(
       @Autowired ShardingStrategy shardingStrategy,
       @Autowired KafkaTemplate<String, String> messageTemplate)
   {