counter: 1.2.13 - The tests print out the type-mapping headers
[demos/kafka/wordcount] / src / test / java / de / juplo / kafka / wordcount / counter / CounterApplicationIT.java
index e0f4672..78d103c 100644 (file)
@@ -30,7 +30,10 @@ import java.util.Properties;
 
 import static de.juplo.kafka.wordcount.counter.CounterApplicationIT.*;
 import static de.juplo.kafka.wordcount.counter.TestData.convertToMap;
-import static org.awaitility.Awaitility.*;
+import static de.juplo.kafka.wordcount.counter.TestData.parseHeader;
+import static org.awaitility.Awaitility.await;
+import static org.springframework.kafka.support.mapping.AbstractJavaTypeMapper.*;
+import static org.springframework.kafka.support.mapping.AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME;
 
 
 @SpringBootTest(
@@ -76,16 +79,21 @@ public class CounterApplicationIT
        @RequiredArgsConstructor
        static class Consumer
        {
-               private final List<KeyValue<Word, WordCount>> received = new LinkedList<>();
+               private final List<KeyValue<Word, WordCounter>> received = new LinkedList<>();
 
                @KafkaListener(groupId = "TEST", topics = TOPIC_OUT)
-               public synchronized void receive(ConsumerRecord<Word, WordCount> record)
+               public synchronized void receive(ConsumerRecord<Word, WordCounter> record)
                {
-                       log.debug("Received message: {}", record);
+                       log.debug(
+                                       "Received message: {} -> {}, key: {}, value: {}",
+                                       record.key(),
+                                       record.value(),
+                                       parseHeader(record.headers(), KEY_DEFAULT_CLASSID_FIELD_NAME),
+                                       parseHeader(record.headers(), DEFAULT_CLASSID_FIELD_NAME));
                        received.add(KeyValue.pair(record.key(),record.value()));
                }
 
-               synchronized List<KeyValue<Word, WordCount>> getReceivedMessages()
+               synchronized List<KeyValue<Word, WordCounter>> getReceivedMessages()
                {
                        return received;
                }