Search in sources :

Example 6 with TopicsInfo

use of org.apache.kafka.streams.processor.TopologyBuilder.TopicsInfo 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());
}
Also used : MockProcessorSupplier(org.apache.kafka.test.MockProcessorSupplier) MockStateStoreSupplier(org.apache.kafka.test.MockStateStoreSupplier) InternalTopicConfig(org.apache.kafka.streams.processor.internals.InternalTopicConfig) TopicsInfo(org.apache.kafka.streams.processor.TopologyBuilder.TopicsInfo) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

TopicsInfo (org.apache.kafka.streams.processor.TopologyBuilder.TopicsInfo)6 Test (org.junit.Test)6 InternalTopicConfig (org.apache.kafka.streams.processor.internals.InternalTopicConfig)5 MockProcessorSupplier (org.apache.kafka.test.MockProcessorSupplier)4 Properties (java.util.Properties)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Utils.mkSet (org.apache.kafka.common.utils.Utils.mkSet)2 MockStateStoreSupplier (org.apache.kafka.test.MockStateStoreSupplier)2 Field (java.lang.reflect.Field)1 StreamPartitionAssignor (org.apache.kafka.streams.processor.internals.StreamPartitionAssignor)1 RocksDBWindowStoreSupplier (org.apache.kafka.streams.state.internals.RocksDBWindowStoreSupplier)1