From 999932e328b3beeb986aae2055c2f3c901c3a34e Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 15 Jun 2024 23:22:38 +0200 Subject: [PATCH] popular: 1.0.0 - Renamed packages and classes -- ALIGN --- .../wordcount/popular/PopularApplication.java | 6 ++--- .../PopularApplicationConfiguriation.java | 16 ++++++------- .../popular/PopularApplicationProperties.java | 10 ++++---- .../popular/PopularStreamProcessor.java | 10 ++++---- .../juplo/kafka/wordcount/popular/User.java | 2 +- .../juplo/kafka/wordcount/popular/Word.java | 2 +- .../kafka/wordcount/popular/WordCounter.java | 2 +- .../popular/PopularApplicationIT.java | 24 +++++++++---------- .../PopularStreamProcessorTopologyTest.java | 12 +++++----- .../kafka/wordcount/popular/TestData.java | 6 ++--- .../wordcount/topwords/TestOutputWord.java | 2 +- .../topwords/TestOutputWordCounter.java | 2 +- src/test/resources/logback-test.xml | 2 +- 13 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplication.java b/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplication.java index e6d3b1f..602f3f6 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplication.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplication.java @@ -1,14 +1,14 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class CounterApplication +public class PopularApplication { public static void main(String[] args) { - SpringApplication.run(CounterApplication.class, args); + SpringApplication.run(PopularApplication.class, args); } } diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationConfiguriation.java b/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationConfiguriation.java index 484b8de..73ea920 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationConfiguriation.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationConfiguriation.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerConfig; @@ -16,18 +16,18 @@ import org.springframework.kafka.support.serializer.JsonSerde; import java.util.Properties; import java.util.concurrent.CompletableFuture; -import static de.juplo.kafka.wordcount.counter.CounterStreamProcessor.STORE_NAME; +import static de.juplo.kafka.wordcount.popular.PopularStreamProcessor.STORE_NAME; import static org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.SHUTDOWN_CLIENT; @Configuration -@EnableConfigurationProperties(CounterApplicationProperties.class) +@EnableConfigurationProperties(PopularApplicationProperties.class) @Slf4j -public class CounterApplicationConfiguriation +public class PopularApplicationConfiguriation { @Bean public Properties streamProcessorProperties( - CounterApplicationProperties counterProperties) + PopularApplicationProperties counterProperties) { Properties propertyMap = serializationConfig(); @@ -62,13 +62,13 @@ public class CounterApplicationConfiguriation } @Bean(initMethod = "start", destroyMethod = "stop") - public CounterStreamProcessor streamProcessor( - CounterApplicationProperties applicationProperties, + public PopularStreamProcessor streamProcessor( + PopularApplicationProperties applicationProperties, Properties streamProcessorProperties, KeyValueBytesStoreSupplier storeSupplier, ConfigurableApplicationContext context) { - CounterStreamProcessor streamProcessor = new CounterStreamProcessor( + PopularStreamProcessor streamProcessor = new PopularStreamProcessor( applicationProperties.getInputTopic(), applicationProperties.getOutputTopic(), streamProcessorProperties, diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationProperties.java b/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationProperties.java index c3ada17..12f55f5 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationProperties.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/PopularApplicationProperties.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import lombok.Getter; @@ -7,16 +7,16 @@ import lombok.ToString; import org.springframework.boot.context.properties.ConfigurationProperties; -@ConfigurationProperties("juplo.wordcount.counter") +@ConfigurationProperties("juplo.wordcount.popular") @Getter @Setter @ToString -public class CounterApplicationProperties +public class PopularApplicationProperties { private String bootstrapServer = "localhost:9092"; - private String applicationId = "counter"; + private String applicationId = "popular"; private String inputTopic = "words"; - private String outputTopic = "countings"; + private String outputTopic = "popular"; private Integer commitInterval; private Integer cacheMaxBytes; } diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessor.java b/src/main/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessor.java index 64bd619..e6fd846 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessor.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessor.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.streams.*; @@ -13,21 +13,21 @@ import java.util.Properties; @Slf4j -public class CounterStreamProcessor +public class PopularStreamProcessor { - public static final String STORE_NAME = "counter"; + public static final String STORE_NAME = "popular"; public final KafkaStreams streams; - public CounterStreamProcessor( + public PopularStreamProcessor( String inputTopic, String outputTopic, Properties properties, KeyValueBytesStoreSupplier storeSupplier) { - Topology topology = CounterStreamProcessor.buildTopology( + Topology topology = PopularStreamProcessor.buildTopology( inputTopic, outputTopic, storeSupplier); diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/User.java b/src/main/java/de/juplo/kafka/wordcount/popular/User.java index e38bcba..6dbe261 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/User.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/User.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/Word.java b/src/main/java/de/juplo/kafka/wordcount/popular/Word.java index 77287d5..92c1d6d 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/Word.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/Word.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; diff --git a/src/main/java/de/juplo/kafka/wordcount/popular/WordCounter.java b/src/main/java/de/juplo/kafka/wordcount/popular/WordCounter.java index f1fce71..39eebf0 100644 --- a/src/main/java/de/juplo/kafka/wordcount/popular/WordCounter.java +++ b/src/main/java/de/juplo/kafka/wordcount/popular/WordCounter.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/src/test/java/de/juplo/kafka/wordcount/popular/PopularApplicationIT.java b/src/test/java/de/juplo/kafka/wordcount/popular/PopularApplicationIT.java index 334cd05..1322b52 100644 --- a/src/test/java/de/juplo/kafka/wordcount/popular/PopularApplicationIT.java +++ b/src/test/java/de/juplo/kafka/wordcount/popular/PopularApplicationIT.java @@ -1,9 +1,9 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import de.juplo.kafka.wordcount.splitter.TestInputUser; import de.juplo.kafka.wordcount.splitter.TestInputWord; -import de.juplo.kafka.wordcount.top10.TestOutputWord; -import de.juplo.kafka.wordcount.top10.TestOutputWordCounter; +import de.juplo.kafka.wordcount.topwords.TestOutputWord; +import de.juplo.kafka.wordcount.topwords.TestOutputWordCounter; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.streams.state.KeyValueBytesStoreSupplier; import org.apache.kafka.streams.state.Stores; @@ -27,9 +27,9 @@ import org.springframework.util.MultiValueMap; import java.time.Duration; -import static de.juplo.kafka.wordcount.counter.CounterApplicationIT.TOPIC_IN; -import static de.juplo.kafka.wordcount.counter.CounterApplicationIT.TOPIC_OUT; -import static de.juplo.kafka.wordcount.counter.CounterStreamProcessor.STORE_NAME; +import static de.juplo.kafka.wordcount.popular.PopularApplicationIT.TOPIC_IN; +import static de.juplo.kafka.wordcount.popular.PopularApplicationIT.TOPIC_OUT; +import static de.juplo.kafka.wordcount.popular.PopularStreamProcessor.STORE_NAME; import static org.awaitility.Awaitility.await; @@ -44,13 +44,13 @@ import static org.awaitility.Awaitility.await; "spring.kafka.consumer.properties.spring.json.type.mapping=word:de.juplo.kafka.wordcount.top10.TestOutputWord,counter:de.juplo.kafka.wordcount.top10.TestOutputWordCounter", "logging.level.root=WARN", "logging.level.de.juplo=DEBUG", - "juplo.wordcount.counter.bootstrap-server=${spring.embedded.kafka.brokers}", - "juplo.wordcount.counter.commit-interval=0", - "juplo.wordcount.counter.input-topic=" + TOPIC_IN, - "juplo.wordcount.counter.output-topic=" + TOPIC_OUT }) + "juplo.wordcount.popular.bootstrap-server=${spring.embedded.kafka.brokers}", + "juplo.wordcount.popular.commit-interval=0", + "juplo.wordcount.popular.input-topic=" + TOPIC_IN, + "juplo.wordcount.popular.output-topic=" + TOPIC_OUT }) @EmbeddedKafka(topics = { TOPIC_IN, TOPIC_OUT }) @Slf4j -public class CounterApplicationIT +public class PopularApplicationIT { public static final String TOPIC_IN = "in"; public static final String TOPIC_OUT = "out"; @@ -58,7 +58,7 @@ public class CounterApplicationIT @Autowired Consumer consumer; @Autowired - CounterStreamProcessor streamProcessor; + PopularStreamProcessor streamProcessor; @BeforeAll diff --git a/src/test/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessorTopologyTest.java b/src/test/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessorTopologyTest.java index 0ffd516..cb8b485 100644 --- a/src/test/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessorTopologyTest.java +++ b/src/test/java/de/juplo/kafka/wordcount/popular/PopularStreamProcessorTopologyTest.java @@ -1,9 +1,9 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import de.juplo.kafka.wordcount.splitter.TestInputUser; import de.juplo.kafka.wordcount.splitter.TestInputWord; -import de.juplo.kafka.wordcount.top10.TestOutputWord; -import de.juplo.kafka.wordcount.top10.TestOutputWordCounter; +import de.juplo.kafka.wordcount.topwords.TestOutputWord; +import de.juplo.kafka.wordcount.topwords.TestOutputWordCounter; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.streams.TestInputTopic; import org.apache.kafka.streams.TestOutputTopic; @@ -19,11 +19,11 @@ import org.springframework.kafka.support.serializer.JsonSerializer; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; -import static de.juplo.kafka.wordcount.counter.CounterApplicationConfiguriation.serializationConfig; +import static de.juplo.kafka.wordcount.popular.PopularApplicationConfiguriation.serializationConfig; @Slf4j -public class CounterStreamProcessorTopologyTest +public class PopularStreamProcessorTopologyTest { public static final String IN = "TEST-IN"; public static final String OUT = "TEST-OUT"; @@ -38,7 +38,7 @@ public class CounterStreamProcessorTopologyTest @BeforeEach public void setUpTestDriver() { - Topology topology = CounterStreamProcessor.buildTopology( + Topology topology = PopularStreamProcessor.buildTopology( IN, OUT, Stores.inMemoryKeyValueStore(STORE_NAME)); diff --git a/src/test/java/de/juplo/kafka/wordcount/popular/TestData.java b/src/test/java/de/juplo/kafka/wordcount/popular/TestData.java index 1ecfdbd..2cfd219 100644 --- a/src/test/java/de/juplo/kafka/wordcount/popular/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/popular/TestData.java @@ -1,9 +1,9 @@ -package de.juplo.kafka.wordcount.counter; +package de.juplo.kafka.wordcount.popular; import de.juplo.kafka.wordcount.splitter.TestInputUser; import de.juplo.kafka.wordcount.splitter.TestInputWord; -import de.juplo.kafka.wordcount.top10.TestOutputWord; -import de.juplo.kafka.wordcount.top10.TestOutputWordCounter; +import de.juplo.kafka.wordcount.topwords.TestOutputWord; +import de.juplo.kafka.wordcount.topwords.TestOutputWordCounter; import org.apache.kafka.streams.KeyValue; import org.apache.kafka.streams.state.ReadOnlyKeyValueStore; import org.springframework.util.LinkedMultiValueMap; diff --git a/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWord.java b/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWord.java index cfc2cae..9fd4d08 100644 --- a/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWord.java +++ b/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWord.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.top10; +package de.juplo.kafka.wordcount.topwords; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWordCounter.java b/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWordCounter.java index 1b59387..c73f3bc 100644 --- a/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWordCounter.java +++ b/src/test/java/de/juplo/kafka/wordcount/topwords/TestOutputWordCounter.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.top10; +package de.juplo.kafka.wordcount.topwords; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index 171bf63..0d0c912 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -1,5 +1,5 @@ - + -- 2.20.1