From: Kai Moritz Date: Thu, 20 Apr 2023 08:40:02 +0000 (+0200) Subject: NEU X-Git-Tag: kafkadata~7 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=c38bc4da9875d78aea1418e70c08652357eeac88;p=demos%2Fkafka%2Fchat NEU --- diff --git a/pom.xml b/pom.xml index 3e3251cf..23fcec3f 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,11 @@ awaitility test + + org.springframework.kafka + spring-kafka-test + test + diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java index 4d8f18d5..73fa719e 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java @@ -40,7 +40,7 @@ public class ChatBackendProperties private int numPartitions = 2; } - public enum ServiceType { inmemory } + public enum ServiceType { inmemory, kafka } public enum StorageStrategyType { files, mongodb } public enum ShardingStrategyType { none, kafkalike } } diff --git a/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java b/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java new file mode 100644 index 00000000..e633cb92 --- /dev/null +++ b/src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java @@ -0,0 +1,21 @@ +package de.juplo.kafka.chat.backend; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.kafka.test.context.EmbeddedKafka; + +import static de.juplo.kafka.chat.backend.KafkaConfigurationIT.TOPIC; + + +@SpringBootTest( + webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, + properties = { + "chat.backend.services=kafka", + "chat.backend.kafka.client-id=TEST", + "chat.backend.kafka.bootstrap-servers=${spring.embedded.kafka.brokers}", + "chat.backend.kafka.topic=" + TOPIC, + "chat.backend.kafka.num-partitions=3" }) +@EmbeddedKafka(topics = TOPIC, partitions = 3) +class KafkaConfigurationIT extends AbstractConfigurationIT +{ + final static String TOPIC = "TEST"; +}