use of org.apache.kafka.test.MockProcessorSupplier in project kafka by apache.
the class TopologyBuilderTest method testAddStateStore.
@Test
public void testAddStateStore() {
final TopologyBuilder builder = new TopologyBuilder();
StateStoreSupplier supplier = new MockStateStoreSupplier("store-1", false);
builder.addStateStore(supplier);
builder.setApplicationId("X");
builder.addSource("source-1", "topic-1");
builder.addProcessor("processor-1", new MockProcessorSupplier(), "source-1");
assertEquals(0, builder.build(null).stateStores().size());
builder.connectProcessorAndStateStores("processor-1", "store-1");
List<StateStore> suppliers = builder.build(null).stateStores();
assertEquals(1, suppliers.size());
assertEquals(supplier.name(), suppliers.get(0).name());
}
use of org.apache.kafka.test.MockProcessorSupplier in project kafka by apache.
the class TopologyBuilderTest method shouldAddInternalTopicConfigWithCompactForNonWindowStores.
@SuppressWarnings("unchecked")
@Test
public void shouldAddInternalTopicConfigWithCompactForNonWindowStores() throws Exception {
final TopologyBuilder builder = new TopologyBuilder();
builder.setApplicationId("appId");
builder.addSource("source", "topic");
builder.addProcessor("processor", new MockProcessorSupplier(), "source");
builder.addStateStore(new MockStateStoreSupplier("name", true), "processor");
final Map<Integer, TopicsInfo> topicGroups = builder.topicGroups();
final TopicsInfo topicsInfo = topicGroups.values().iterator().next();
final InternalTopicConfig topicConfig = topicsInfo.stateChangelogTopics.get("appId-name-changelog");
final Properties properties = topicConfig.toProperties(0);
assertEquals("appId-name-changelog", topicConfig.name());
assertEquals("compact", properties.getProperty(InternalTopicManager.CLEANUP_POLICY_PROP));
assertEquals(1, properties.size());
}
Aggregations