use of org.apache.kafka.streams.state.internals.KeyValueStoreBuilder in project apache-kafka-on-k8s by banzaicloud.
the class TopologyTest method addGlobalStoreToTopologyAndExpectedDescription.
private void addGlobalStoreToTopologyAndExpectedDescription(final String globalStoreName, final String sourceName, final String globalTopicName, final String processorName, final int id) {
final KeyValueStoreBuilder globalStoreBuilder = EasyMock.createNiceMock(KeyValueStoreBuilder.class);
EasyMock.expect(globalStoreBuilder.name()).andReturn(globalStoreName).anyTimes();
EasyMock.replay(globalStoreBuilder);
topology.addGlobalStore(globalStoreBuilder, sourceName, null, null, null, globalTopicName, processorName, new MockProcessorSupplier());
final TopologyDescription.GlobalStore expectedGlobalStore = new InternalTopologyBuilder.GlobalStore(sourceName, processorName, globalStoreName, globalTopicName, id);
expectedDescription.addGlobalStore(expectedGlobalStore);
}
use of org.apache.kafka.streams.state.internals.KeyValueStoreBuilder in project apache-kafka-on-k8s by banzaicloud.
the class TopologyTestDriverTest method shouldReturnAllStores.
@Test
public void shouldReturnAllStores() {
final Topology topology = setupSourceSinkTopology();
topology.addStateStore(new KeyValueStoreBuilder<>(Stores.inMemoryKeyValueStore("store"), Serdes.ByteArray(), Serdes.ByteArray(), new SystemTime()).withLoggingDisabled());
topology.addGlobalStore(new KeyValueStoreBuilder<>(Stores.inMemoryKeyValueStore("globalStore"), Serdes.ByteArray(), Serdes.ByteArray(), new SystemTime()).withLoggingDisabled(), "sourceProcessorName", Serdes.ByteArray().deserializer(), Serdes.ByteArray().deserializer(), "globalTopicName", "globalProcessorName", new ProcessorSupplier() {
@Override
public Processor get() {
return null;
}
});
testDriver = new TopologyTestDriver(topology, config);
final Set<String> expectedStoreNames = new HashSet<>();
expectedStoreNames.add("store");
expectedStoreNames.add("globalStore");
assertThat(testDriver.getAllStateStores().keySet(), equalTo(expectedStoreNames));
}
Aggregations