From: Kai Moritz Date: Wed, 13 Sep 2023 22:15:22 +0000 (+0200) Subject: WIP X-Git-Tag: rebase--2023-09-14--22-59 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=7754fb2f645afad06134c74d3674af45fdc362f6;p=demos%2Fkafka%2Fchat WIP --- diff --git a/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java b/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java index 33b41442..781781b1 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java +++ b/src/test/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeServiceTest.java @@ -18,9 +18,12 @@ import org.springframework.context.annotation.Import; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.support.SendResult; import org.springframework.kafka.test.context.EmbeddedKafka; +import org.testcontainers.shaded.org.awaitility.Awaitility; import java.time.Clock; +import java.time.Duration; import java.util.List; +import java.util.UUID; import static de.juplo.kafka.chat.backend.domain.ChatHomeServiceWithShardsTest.NUM_SHARDS; import static de.juplo.kafka.chat.backend.implementation.kafka.KafkaChatHomeServiceTest.DATA_TOPIC; @@ -59,10 +62,19 @@ public class KafkaChatHomeServiceTest extends ChatHomeServiceWithShardsTest static class KafkaChatHomeTestConfiguration { @Bean - KafkaServicesApplicationRunner.WorkAssignor workAssignor(DataChannel dataChannel) + KafkaServicesApplicationRunner.WorkAssignor workAssignor( + InfoChannel infoChannel, + DataChannel dataChannel) { return consumer -> { + // TODO: Darauf warten, dass der Chat-Room erzeugt wurde! + Awaitility + .await() + .atMost(Duration.ofSeconds(10)) + .until(() -> infoChannel + .getChatRoomInfo(UUID.fromString("5c73531c-6fc4-426c-adcb-afc5c140a0f7")) + .block() != null); List assignedPartitions = List.of(new TopicPartition(DATA_TOPIC, 2)); consumer.assign(assignedPartitions);