From 3d405f33a0cfa4351f15a45cb07fceab595e87f9 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 30 Jun 2022 17:29:26 +0200 Subject: [PATCH] WIP --- pom.xml | 5 ++++ .../wordcount/splitter/ApplicationTests.java | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/pom.xml b/pom.xml index f413864..7e84360 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,11 @@ spring-boot-starter-test test + + org.springframework.kafka + spring-kafka + test + org.springframework.kafka spring-kafka-test diff --git a/src/test/java/de/juplo/kafka/wordcount/splitter/ApplicationTests.java b/src/test/java/de/juplo/kafka/wordcount/splitter/ApplicationTests.java index f02762b..274efa9 100644 --- a/src/test/java/de/juplo/kafka/wordcount/splitter/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/wordcount/splitter/ApplicationTests.java @@ -3,7 +3,14 @@ package de.juplo.kafka.wordcount.splitter; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.kafka.test.EmbeddedKafkaBroker; import org.springframework.kafka.test.context.EmbeddedKafka; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; import static de.juplo.kafka.wordcount.splitter.ApplicationTests.TOPIC_IN; import static de.juplo.kafka.wordcount.splitter.ApplicationTests.TOPIC_OUT; @@ -28,10 +35,27 @@ class ApplicationTests @Autowired SplitterStreamProcessor splitter; + @Autowired + EmbeddedKafkaBroker embeddedKafkaBroker; + @Autowired + KafkaTemplate kafkaTemplate; @Test void contextLoads() { splitter.stop(); } + + @Test + void split() + { + kafkaTemplate.send(TOPIC_IN, "Hello World!"); + } + + + @DynamicPropertySource + static void registerProperties(DynamicPropertyRegistry registry) + { + registry.add("") + } } -- 2.20.1