Search in sources :

Example 1 with DoubleSerializer

use of org.apache.kafka.common.serialization.DoubleSerializer in project kafka by apache.

the class KGroupedTableImplTest method assertReduced.

private void assertReduced(final Map<String, ValueAndTimestamp<Integer>> reducedResults, final String topic, final TopologyTestDriver driver) {
    final TestInputTopic<String, Double> inputTopic = driver.createInputTopic(topic, new StringSerializer(), new DoubleSerializer());
    inputTopic.pipeInput("A", 1.1, 10);
    inputTopic.pipeInput("B", 2.2, 11);
    assertEquals(ValueAndTimestamp.make(1, 10L), reducedResults.get("A"));
    assertEquals(ValueAndTimestamp.make(2, 11L), reducedResults.get("B"));
    inputTopic.pipeInput("A", 2.6, 30);
    inputTopic.pipeInput("B", 1.3, 30);
    inputTopic.pipeInput("A", 5.7, 50);
    inputTopic.pipeInput("B", 6.2, 20);
    assertEquals(ValueAndTimestamp.make(5, 50L), reducedResults.get("A"));
    assertEquals(ValueAndTimestamp.make(6, 30L), reducedResults.get("B"));
}
Also used : DoubleSerializer(org.apache.kafka.common.serialization.DoubleSerializer) StringSerializer(org.apache.kafka.common.serialization.StringSerializer)

Aggregations

DoubleSerializer (org.apache.kafka.common.serialization.DoubleSerializer)1 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)1