Search in sources :

Example 1 with MockTimestampExtractor

use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.

the class KStreamBuilderTest method shouldAddTimestampExtractorToTableWithKeyValSerdePerSource.

@Test
public void shouldAddTimestampExtractorToTableWithKeyValSerdePerSource() {
    builder.table(null, new MockTimestampExtractor(), null, null, "topic", "store");
    final ProcessorTopology processorTopology = builder.build(null);
    assertThat(processorTopology.source("topic").getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
Also used : ProcessorTopology(org.apache.kafka.streams.processor.internals.ProcessorTopology) MockTimestampExtractor(org.apache.kafka.test.MockTimestampExtractor) Test(org.junit.Test)

Example 2 with MockTimestampExtractor

use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.

the class KStreamBuilderTest method shouldAddTimestampExtractorToStreamWithKeyValSerdePerSource.

@Test
public void shouldAddTimestampExtractorToStreamWithKeyValSerdePerSource() {
    builder.stream(new MockTimestampExtractor(), null, null, "topic");
    final ProcessorTopology processorTopology = builder.build(null);
    for (final SourceNode sourceNode : processorTopology.sources()) {
        assertThat(sourceNode.getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
    }
}
Also used : ProcessorTopology(org.apache.kafka.streams.processor.internals.ProcessorTopology) SourceNode(org.apache.kafka.streams.processor.internals.SourceNode) MockTimestampExtractor(org.apache.kafka.test.MockTimestampExtractor) Test(org.junit.Test)

Example 3 with MockTimestampExtractor

use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.

the class InternalTopologyBuilderTest method shouldAddTimestampExtractorPerSource.

@SuppressWarnings("unchecked")
@Test
public void shouldAddTimestampExtractorPerSource() throws Exception {
    builder.addSource(null, "source", new MockTimestampExtractor(), null, null, "topic");
    final ProcessorTopology processorTopology = builder.build(null);
    assertThat(processorTopology.source("topic").getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
Also used : MockTimestampExtractor(org.apache.kafka.test.MockTimestampExtractor) Test(org.junit.Test)

Example 4 with MockTimestampExtractor

use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.

the class TopologyBuilderTest method shouldAddTimestampExtractorWithOffsetResetAndPatternPerSource.

@Test
public void shouldAddTimestampExtractorWithOffsetResetAndPatternPerSource() {
    final TopologyBuilder builder = new TopologyBuilder();
    final Pattern pattern = Pattern.compile("t.*");
    builder.addSource(null, new MockTimestampExtractor(), "source", pattern);
    final ProcessorTopology processorTopology = builder.build(null);
    assertThat(processorTopology.source(pattern.pattern()).getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
Also used : Pattern(java.util.regex.Pattern) ProcessorTopology(org.apache.kafka.streams.processor.internals.ProcessorTopology) MockTimestampExtractor(org.apache.kafka.test.MockTimestampExtractor) Test(org.junit.Test)

Example 5 with MockTimestampExtractor

use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.

the class TopologyBuilderTest method shouldAddTimestampExtractorWithOffsetResetAndKeyValSerdesPerSource.

@Test
public void shouldAddTimestampExtractorWithOffsetResetAndKeyValSerdesPerSource() {
    final TopologyBuilder builder = new TopologyBuilder();
    builder.addSource(null, "source", new MockTimestampExtractor(), null, null, "topic");
    final ProcessorTopology processorTopology = builder.build(null);
    assertThat(processorTopology.source("topic").getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
Also used : ProcessorTopology(org.apache.kafka.streams.processor.internals.ProcessorTopology) MockTimestampExtractor(org.apache.kafka.test.MockTimestampExtractor) Test(org.junit.Test)

Aggregations

MockTimestampExtractor (org.apache.kafka.test.MockTimestampExtractor)17 Test (org.junit.Test)17 ProcessorTopology (org.apache.kafka.streams.processor.internals.ProcessorTopology)13 Pattern (java.util.regex.Pattern)5 StreamsConfig (org.apache.kafka.streams.StreamsConfig)4 SourceNode (org.apache.kafka.streams.processor.internals.SourceNode)1