From 2d98f8939cf92346bb20115d5961a22c20c45bd9 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 20 Aug 2023 10:42:26 +0200 Subject: [PATCH] WIP --- .../chat/backend/KafkaConfigurationIT.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java b/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java index d1427602..7b2df45a 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java @@ -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 messageTemplate) { -- 2.20.1