use of org.apache.druid.server.lookup.namespace.NamespaceExtractionModule in project druid by druid-io.
the class TestKafkaExtractionCluster method setUp.
@Before
public void setUp() throws Exception {
zkServer = new TestingCluster(1);
zkServer.start();
closer.register(() -> {
zkServer.stop();
});
kafkaServer = new KafkaServer(getBrokerProperties(), Time.SYSTEM, Some.apply(StringUtils.format("TestingBroker[%d]-", 1)), false);
kafkaServer.startup();
closer.register(() -> {
kafkaServer.shutdown();
kafkaServer.awaitShutdown();
});
log.info("---------------------------Started Kafka Broker ---------------------------");
log.info("---------------------------Publish Messages to topic-----------------------");
publishRecordsToKafka();
System.setProperty("druid.extensions.searchCurrentClassloader", "false");
injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("test");
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0);
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(-1);
}
}, // These injections fail under IntelliJ but are required for maven
new NamespaceExtractionModule(), new KafkaExtractionNamespaceModule()));
mapper = injector.getInstance(ObjectMapper.class);
log.info("--------------------------- placed default item via producer ---------------------------");
final Map<String, String> consumerProperties = getConsumerProperties();
final KafkaLookupExtractorFactory kafkaLookupExtractorFactory = new KafkaLookupExtractorFactory(null, TOPIC_NAME, consumerProperties);
factory = (KafkaLookupExtractorFactory) mapper.readValue(mapper.writeValueAsString(kafkaLookupExtractorFactory), LookupExtractorFactory.class);
Assert.assertEquals(kafkaLookupExtractorFactory.getKafkaTopic(), factory.getKafkaTopic());
Assert.assertEquals(kafkaLookupExtractorFactory.getKafkaProperties(), factory.getKafkaProperties());
factory.start();
closer.register(() -> factory.close());
log.info("--------------------------- started rename manager ---------------------------");
}
Aggregations