From: Kai Moritz Date: Sun, 20 Aug 2023 08:42:26 +0000 (+0200) Subject: WIP X-Git-Tag: rebase--2023-08-20~8 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=2d98f8939cf92346bb20115d5961a22c20c45bd9;p=demos%2Fkafka%2Fchat WIP --- 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) {