</parent>
<groupId>de.juplo.kafka.wordcount</groupId>
<artifactId>counter</artifactId>
- <version>1.2.10</version>
+ <version>1.2.11</version>
<name>Wordcount-Counter</name>
<description>Word-counting stream-processor of the multi-user wordcount-example</description>
<properties>
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.stream.Collectors;
import static de.juplo.kafka.wordcount.counter.CounterApplicationIT.*;
+import static de.juplo.kafka.wordcount.counter.TestData.convertToMap;
import static org.awaitility.Awaitility.*;
@Bean
ProducerFactory<?, ?> producerFactory(Properties streamProcessorProperties)
{
- Map<String, Object> propertyMap = streamProcessorProperties
- .entrySet()
- .stream()
- .collect(
- Collectors.toMap(
- entry -> (String)entry.getKey(),
- entry -> entry.getValue()
- ));
+ Map<String, Object> propertyMap = convertToMap(streamProcessorProperties);
propertyMap.put(
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(
Properties streamProcessorProperties)
{
- Map<String, Object> propertyMap = streamProcessorProperties
- .entrySet()
- .stream()
- .collect(
- Collectors.toMap(
- entry -> (String)entry.getKey(),
- entry -> entry.getValue()
- ));
+ Map<String, Object> propertyMap = convertToMap(streamProcessorProperties);
propertyMap.put(
ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.stream.Collectors;
+
+import static de.juplo.kafka.wordcount.counter.TestData.convertToMap;
public class CounterStreamProcessorTopologyTest
new CounterApplicationConfiguriation();
Properties streamProcessorProperties =
applicationConfiguriation.streamProcessorProperties(new CounterApplicationProperties());
+ Map<String, Object> propertyMap = convertToMap(streamProcessorProperties);
- Map<String, ?> propertyMap = streamProcessorProperties
- .entrySet()
- .stream()
- .collect(
- Collectors.toMap(
- entry -> (String)entry.getKey(),
- entry -> entry.getValue()
- ));
JsonSerde<?> keySerde = new JsonSerde<>();
keySerde.configure(propertyMap, true);
JsonSerde<?> valueSerde = new JsonSerde<>();
import org.apache.kafka.streams.KeyValue;
import java.util.List;
+import java.util.Map;
+import java.util.Properties;
import java.util.function.BiConsumer;
+import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
Word.of("klaus","s"),
WordCount.of("klaus","s",3)),
};
+
+ static Map<String, Object> convertToMap(Properties properties)
+ {
+ return properties
+ .entrySet()
+ .stream()
+ .collect(
+ Collectors.toMap(
+ entry -> (String)entry.getKey(),
+ entry -> entry.getValue()
+ ));
+ }
}