From 7efbc8c73e3f2bb1f553a61325b8576886bab254 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 5 Jun 2024 20:29:37 +0200 Subject: [PATCH] counter: 1.2.15 - Removed logging of type-headers in tests --- .../counter/CounterApplicationConfiguriation.java | 1 - .../CounterStreamProcessorTopologyTest.java | 14 +------------- .../juplo/kafka/wordcount/counter/TestData.java | 15 --------------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationConfiguriation.java b/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationConfiguriation.java index e38a0f8..3878dba 100644 --- a/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationConfiguriation.java +++ b/src/main/java/de/juplo/kafka/wordcount/counter/CounterApplicationConfiguriation.java @@ -53,7 +53,6 @@ public class CounterApplicationConfiguriation JsonDeserializer.TYPE_MAPPINGS, "word:" + Word.class.getName() + "," + "counter:" + WordCounter.class.getName()); - propertyMap.put(JsonDeserializer.REMOVE_TYPE_INFO_HEADERS, Boolean.FALSE); return propertyMap; } diff --git a/src/test/java/de/juplo/kafka/wordcount/counter/CounterStreamProcessorTopologyTest.java b/src/test/java/de/juplo/kafka/wordcount/counter/CounterStreamProcessorTopologyTest.java index e5964dc..955d7a0 100644 --- a/src/test/java/de/juplo/kafka/wordcount/counter/CounterStreamProcessorTopologyTest.java +++ b/src/test/java/de/juplo/kafka/wordcount/counter/CounterStreamProcessorTopologyTest.java @@ -19,9 +19,6 @@ 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.counter.TestData.parseHeader; -import static org.springframework.kafka.support.mapping.AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME; -import static org.springframework.kafka.support.mapping.AbstractJavaTypeMapper.KEY_DEFAULT_CLASSID_FIELD_NAME; @Slf4j @@ -72,16 +69,7 @@ public class CounterStreamProcessorTopologyTest MultiValueMap receivedMessages = new LinkedMultiValueMap<>(); out .readRecordsToList() - .forEach(record -> - { - log.debug( - "OUT: {} -> {}, {}, {}", - record.key(), - record.value(), - parseHeader(record.headers(), KEY_DEFAULT_CLASSID_FIELD_NAME), - parseHeader(record.headers(), DEFAULT_CLASSID_FIELD_NAME)); - receivedMessages.add(record.key(), record.value()); - }); + .forEach(record -> receivedMessages.add(record.key(), record.value())); TestData.assertExpectedMessages(receivedMessages); } diff --git a/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java b/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java index 6419059..40ef09e 100644 --- a/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java +++ b/src/test/java/de/juplo/kafka/wordcount/counter/TestData.java @@ -3,8 +3,6 @@ package de.juplo.kafka.wordcount.counter; import de.juplo.kafka.wordcount.splitter.TestInputWord; import de.juplo.kafka.wordcount.top10.TestOutputWord; import de.juplo.kafka.wordcount.top10.TestOutputWordCounter; -import org.apache.kafka.common.header.Header; -import org.apache.kafka.common.header.Headers; import org.apache.kafka.streams.KeyValue; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -89,17 +87,4 @@ class TestData .forEach(keyValue -> expectedMessages.add(keyValue.key, keyValue.value)); return expectedMessages; } - - static String parseHeader(Headers headers, String key) - { - Header header = headers.lastHeader(key); - if (header == null) - { - return key + "=null"; - } - else - { - return key + "=" + new String(header.value()); - } - } } -- 2.20.1