use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.
the class InternalStreamsBuilderTest method ktableShouldUseProvidedTimestampExtractor.
@Test
public void ktableShouldUseProvidedTimestampExtractor() throws Exception {
final ConsumedInternal<String, String> consumed = new ConsumedInternal<>(Consumed.<String, String>with(new MockTimestampExtractor()));
builder.table("topic", consumed, materialized);
final ProcessorTopology processorTopology = builder.internalTopologyBuilder.build(null);
assertThat(processorTopology.source("topic").getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.
the class InternalTopologyBuilderTest method shouldAddTimestampExtractorWithPatternPerSource.
@SuppressWarnings("unchecked")
@Test
public void shouldAddTimestampExtractorWithPatternPerSource() throws Exception {
final Pattern pattern = Pattern.compile("t.*");
builder.addSource(null, "source", new MockTimestampExtractor(), null, null, pattern);
final ProcessorTopology processorTopology = builder.build(null);
assertThat(processorTopology.source(pattern.pattern()).getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.
the class TopologyBuilderTest method shouldAddTimestampExtractorPerSource.
@Test
public void shouldAddTimestampExtractorPerSource() {
final TopologyBuilder builder = new TopologyBuilder();
builder.addSource(new MockTimestampExtractor(), "source", "topic");
final ProcessorTopology processorTopology = builder.build(null);
assertThat(processorTopology.source("topic").getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
use of org.apache.kafka.test.MockTimestampExtractor in project apache-kafka-on-k8s by banzaicloud.
the class TopologyBuilderTest method shouldAddTimestampExtractorWithPatternPerSource.
@Test
public void shouldAddTimestampExtractorWithPatternPerSource() {
final TopologyBuilder builder = new TopologyBuilder();
final Pattern pattern = Pattern.compile("t.*");
builder.addSource(new MockTimestampExtractor(), "source", pattern);
final ProcessorTopology processorTopology = builder.build(null);
assertThat(processorTopology.source(pattern.pattern()).getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
use of org.apache.kafka.test.MockTimestampExtractor in project kafka by apache.
the class InternalStreamsBuilderTest method shouldUseProvidedTimestampExtractor.
@Test
public void shouldUseProvidedTimestampExtractor() {
final ConsumedInternal<String, String> consumed = new ConsumedInternal<>(Consumed.with(new MockTimestampExtractor()));
builder.stream(Collections.singleton("topic"), consumed);
builder.buildAndOptimizeTopology();
final ProcessorTopology processorTopology = builder.internalTopologyBuilder.rewriteTopology(new StreamsConfig(StreamsTestUtils.getStreamsConfig(APP_ID))).buildTopology();
assertThat(processorTopology.source("topic").getTimestampExtractor(), instanceOf(MockTimestampExtractor.class));
}
Aggregations