Search in sources :

Example 1 with ConfigModule

use of org.apache.druid.guice.ConfigModule in project druid by druid-io.

the class BrokerInternalQueryConfigTest method testDefaultBehavior.

/**
 * Test the behavior if the operator does not specify anything for druid.broker.internal.query.config.context in runtime.properties
 */
@Test
public void testDefaultBehavior() {
    Injector injector = Guice.createInjector(new Module() {

        @Override
        public void configure(Binder binder) {
            binder.install(new ConfigModule());
            binder.install(new DruidGuiceExtensions());
            JsonConfigProvider.bind(binder, "druid.broker.internal.query.config", BrokerInternalQueryConfig.class);
        }

        @Provides
        @LazySingleton
        public ObjectMapper jsonMapper() {
            return new DefaultObjectMapper();
        }
    });
    BrokerInternalQueryConfig config = injector.getInstance(BrokerInternalQueryConfig.class);
    Assert.assertEquals(ImmutableMap.of(), config.getContext());
}
Also used : Binder(com.google.inject.Binder) LazySingleton(org.apache.druid.guice.LazySingleton) DruidGuiceExtensions(org.apache.druid.guice.DruidGuiceExtensions) Injector(com.google.inject.Injector) ConfigModule(org.apache.druid.guice.ConfigModule) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Module(com.google.inject.Module) ConfigModule(org.apache.druid.guice.ConfigModule) Provides(com.google.inject.Provides) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Binder (com.google.inject.Binder)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 Provides (com.google.inject.Provides)1 ConfigModule (org.apache.druid.guice.ConfigModule)1 DruidGuiceExtensions (org.apache.druid.guice.DruidGuiceExtensions)1 LazySingleton (org.apache.druid.guice.LazySingleton)1 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)1 Test (org.junit.Test)1