Search in sources :

Example 16 with JsonConfigurator

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

the class RequestLoggerProviderTest method testNoLoggerAtAll.

@Test
public void testNoLoggerAtAll() {
    final Properties properties = new Properties();
    properties.setProperty("dummy", "unrelated");
    final JsonConfigurator configurator = new JsonConfigurator(mapper, Validation.buildDefaultValidatorFactory().getValidator());
    final RequestLoggerProvider provider = configurator.configurate(properties, "log", RequestLoggerProvider.class, NoopRequestLoggerProvider.class);
    Assert.assertThat(provider, CoreMatchers.instanceOf(NoopRequestLoggerProvider.class));
}
Also used : JsonConfigurator(org.apache.druid.guice.JsonConfigurator) Properties(java.util.Properties) Test(org.junit.Test)

Example 17 with JsonConfigurator

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

the class LookupListeningAnnouncerConfigTest method testSimpleInjection.

@Test
public void testSimpleInjection() {
    final String lookupTier = "some_tier";
    final JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
    properties.put(PROPERTY_BASE + ".lookupTier", lookupTier);
    final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(PROPERTY_BASE, LookupListeningAnnouncerConfig.class);
    configProvider.inject(properties, configurator);
    final LookupListeningAnnouncerConfig config = configProvider.get().get();
    Assert.assertEquals(lookupTier, config.getLookupTier());
}
Also used : JsonConfigurator(org.apache.druid.guice.JsonConfigurator) Test(org.junit.Test)

Example 18 with JsonConfigurator

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

the class LookupListeningAnnouncerConfigTest method testFailsOnEmptyTier.

@Test(expected = NullPointerException.class)
public void testFailsOnEmptyTier() {
    final JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
    properties.put(PROPERTY_BASE + ".lookupTier", "");
    final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(PROPERTY_BASE, LookupListeningAnnouncerConfig.class);
    configProvider.inject(properties, configurator);
    final LookupListeningAnnouncerConfig config = configProvider.get().get();
    config.getLookupTier();
}
Also used : JsonConfigurator(org.apache.druid.guice.JsonConfigurator) Test(org.junit.Test)

Example 19 with JsonConfigurator

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

the class LookupListeningAnnouncerConfigTest method testDefaultInjection.

@Test
public void testDefaultInjection() {
    final JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
    final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(PROPERTY_BASE, LookupListeningAnnouncerConfig.class);
    configProvider.inject(properties, configurator);
    final LookupListeningAnnouncerConfig config = configProvider.get().get();
    Assert.assertEquals(LookupListeningAnnouncerConfig.DEFAULT_TIER, config.getLookupTier());
}
Also used : JsonConfigurator(org.apache.druid.guice.JsonConfigurator) Test(org.junit.Test)

Aggregations

JsonConfigurator (org.apache.druid.guice.JsonConfigurator)19 Test (org.junit.Test)19 Properties (java.util.Properties)9 Injector (com.google.inject.Injector)7 ImmutableList (com.google.common.collect.ImmutableList)3 Lists (com.google.common.collect.Lists)3 Ints (com.google.common.primitives.Ints)3 Inject (com.google.inject.Inject)3 Names (com.google.inject.name.Names)3 ArrayList (java.util.ArrayList)3 Collections (java.util.Collections)3 Map (java.util.Map)3 Random (java.util.Random)3 UUID (java.util.UUID)3 ForkJoinPool (java.util.concurrent.ForkJoinPool)3 GuiceInjectors (org.apache.druid.guice.GuiceInjectors)3 JsonConfigProvider (org.apache.druid.guice.JsonConfigProvider)3 ManageLifecycle (org.apache.druid.guice.ManageLifecycle)3 Initialization (org.apache.druid.initialization.Initialization)3 StringUtils (org.apache.druid.java.util.common.StringUtils)3