KafkaOperations implements AutoCloseable { public TopicConfig getTopicConfig(final String topic) { final ConfigResource configResource = new ConfigResource(ConfigResource.Type.TOPIC, topic); return new TopicConfig(describeResource(configResource)); } KafkaOperations(final AdminClient adminClient, final KafkaConsumer<String, String> consumerClient); TopicList getAvailableTopics(); NodeList getClusterNodes(); Map<String, TopicDetails> getTopicDetails(final Collection<String> topics); TopicDetails getTopicDetails(final String topic); TopicConfig getTopicConfig(final String topic); BrokerConfig getBrokerConfig(final String brokerId); boolean createTopic(final CreateTopic createTopic); TopicConfig alterTopicConfig(final String topic, final Map<String, String> configItems); boolean removeTopic(final String topic); List<ConsumerGroupIdentifier> listConsumers(); boolean removeConsumerGroup(final String id); ConsumerGroupDetails getConsumerGroupDetails(final String consumerGroupId); List<ConsumerGroupDetails> getConsumerGroupDetails(final List<String> consumerGroupIds); ConsumerGroupOffsets getConsumerGroupOffsets(final String consumerGroupId); ConsumerGroupOffsetsWithTailPositions getConsumerGroupOffsetsWithTailOffsets(final String consumerGroupId); TailOffsets getTailOffsets(final String topic); TailOffsets getTailOffsets(final String topic, final Collection<Integer> partitions); void close();  }
@Test public void testGetTopicConfig() { final String topic1 = "MyTopic1" + System.currentTimeMillis(); final String topic2 = "MyTopic2" + System.currentTimeMillis(); sharedKafkaTestResource .getKafkaTestUtils() .createTopic(topic1, 2, (short) 1); sharedKafkaTestResource .getKafkaTestUtils() .createTopic(topic2, 1, (short) 1); final TopicConfig topicConfig = kafkaOperations.getTopicConfig(topic1); assertNotNull("non-null response", topicConfig); assertFalse("Should not be empty", topicConfig.getConfigEntries().isEmpty()); for (final ConfigItem configItem: topicConfig.getConfigEntries()) { assertNotNull(configItem.getName()); } }