NEU
authorKai Moritz <kai@juplo.de>
Thu, 20 Apr 2023 08:40:02 +0000 (10:40 +0200)
committerKai Moritz <kai@juplo.de>
Thu, 20 Apr 2023 08:40:02 +0000 (10:40 +0200)
pom.xml
src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java
src/test/java/de/juplo/kafka/chat/backend/KafkaConfigurationIT.java [new file with mode: 0644]

diff --git a/pom.xml b/pom.xml
index 3e3251c..23fcec3 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       <artifactId>awaitility</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.springframework.kafka</groupId>
+      <artifactId>spring-kafka-test</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
index 4d8f18d..73fa719 100644 (file)
@@ -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 (file)
index 0000000..e633cb9
--- /dev/null
@@ -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";
+}