use of org.springframework.kafka.core.ConsumerFactory in project loc-framework by lord-of-code.
the class LocKafkaTest method testConsumer.
@Test
@SuppressWarnings("unchecked")
public void testConsumer() throws Exception {
assertThat(concurrentKafkaListenerContainerFactory).isNotNull();
ContainerProperties containerProperties = concurrentKafkaListenerContainerFactory.getContainerProperties();
assertThat(containerProperties).isNotNull();
assertThat(containerProperties.getGenericErrorHandler()).isNotNull();
assertThat(containerProperties.getAckMode()).isEqualTo(AckMode.RECORD);
ConsumerFactory consumerFactory = concurrentKafkaListenerContainerFactory.getConsumerFactory();
assertThat(consumerFactory).isNotNull();
assertThat(consumerFactory.getConfigurationProperties()).isNotNull();
assertThat(consumerFactory.getConfigurationProperties()).isNotNull();
assertThat(consumerFactory.getConfigurationProperties().get("group.id")).isEqualTo("loc-kafka-unittest");
assertThat(consumerFactory.getConfigurationProperties().get("bootstrap.servers")).isEqualTo(Lists.newArrayList("127.0.0.1:9092"));
assertThat(consumerFactory.getConfigurationProperties().get("enable.auto.commit")).isEqualTo(false);
assertThat(consumerFactory.getConfigurationProperties().get("key.deserializer")).isEqualTo(org.apache.kafka.common.serialization.ByteArrayDeserializer.class);
assertThat(consumerFactory.getConfigurationProperties().get("value.deserializer")).isEqualTo(org.apache.kafka.common.serialization.ByteArrayDeserializer.class);
}
Aggregations