top10: 1.2.1 - Removed logging of type-headers in tests
authorKai Moritz <kai@juplo.de>
Mon, 3 Jun 2024 08:00:33 +0000 (10:00 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 8 Jun 2024 11:15:05 +0000 (13:15 +0200)
src/test/java/de/juplo/kafka/wordcount/top10/TestData.java
src/test/java/de/juplo/kafka/wordcount/top10/Top10StreamProcessorTopologyTest.java

index f4e557c..e0c53df 100644 (file)
@@ -2,8 +2,6 @@ package de.juplo.kafka.wordcount.top10;
 
 import de.juplo.kafka.wordcount.counter.TestCounter;
 import de.juplo.kafka.wordcount.counter.TestWord;
-import org.apache.kafka.common.header.Header;
-import org.apache.kafka.common.header.Headers;
 import org.apache.kafka.streams.KeyValue;
 import org.apache.kafka.streams.state.ReadOnlyKeyValueStore;
 import org.springframework.util.LinkedMultiValueMap;
@@ -174,17 +172,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());
-               }
-       }
 }
index f2a9eca..84cfb1e 100644 (file)
@@ -20,10 +20,7 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.stream.Stream;
 
-import static de.juplo.kafka.wordcount.top10.TestData.parseHeader;
 import static de.juplo.kafka.wordcount.top10.Top10ApplicationConfiguration.serializationConfig;
-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
@@ -84,16 +81,7 @@ public class Top10StreamProcessorTopologyTest
     MultiValueMap<User, Ranking> 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);