use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project apache-kafka-on-k8s by banzaicloud.
the class InternalStreamsBuilderTest method shouldBuildSimpleGlobalTableTopology.
@Test
public void shouldBuildSimpleGlobalTableTopology() throws Exception {
builder.globalTable("table", consumed, new MaterializedInternal<>(Materialized.<String, String, KeyValueStore<Bytes, byte[]>>as("globalTable"), builder, storePrefix));
final ProcessorTopology topology = builder.internalTopologyBuilder.buildGlobalStateTopology();
final List<StateStore> stateStores = topology.globalStateStores();
assertEquals(1, stateStores.size());
assertEquals("globalTable", stateStores.get(0).name());
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology 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));
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project apache-kafka-on-k8s by banzaicloud.
the class KStreamBuilderTest method kStreamTimestampExtractorShouldBeNull.
@Test
public void kStreamTimestampExtractorShouldBeNull() {
builder.stream("topic");
final ProcessorTopology processorTopology = builder.build(null);
assertNull(processorTopology.source("topic").getTimestampExtractor());
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology in project apache-kafka-on-k8s by banzaicloud.
the class KStreamBuilderTest method shouldStillMaterializeSourceKTableIfStateNameNotSpecified.
@Test
public void shouldStillMaterializeSourceKTableIfStateNameNotSpecified() {
KTable table1 = builder.table("topic1", "table1");
KTable table2 = builder.table("topic2", (String) null);
final ProcessorTopology topology = builder.build(null);
assertEquals(2, topology.stateStores().size());
assertEquals("table1", topology.stateStores().get(0).name());
final String internalStoreName = topology.stateStores().get(1).name();
assertTrue(internalStoreName.contains(KTableImpl.STATE_STORE_NAME));
assertEquals(2, topology.storeToChangelogTopic().size());
assertEquals("topic1", topology.storeToChangelogTopic().get("table1"));
assertEquals("topic2", topology.storeToChangelogTopic().get(internalStoreName));
assertEquals(table1.queryableStoreName(), "table1");
assertNull(table2.queryableStoreName());
}
use of org.apache.kafka.streams.processor.internals.ProcessorTopology 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));
}
}
Aggregations