use of io.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(propertyBase, LookupListeningAnnouncerConfig.class);
configProvider.inject(properties, configurator);
final LookupListeningAnnouncerConfig config = configProvider.get().get();
Assert.assertEquals(LookupListeningAnnouncerConfig.DEFAULT_TIER, config.getLookupTier());
}
use of io.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(propertyBase + ".lookupTier", "");
final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(propertyBase, LookupListeningAnnouncerConfig.class);
configProvider.inject(properties, configurator);
final LookupListeningAnnouncerConfig config = configProvider.get().get();
config.getLookupTier();
}
use of io.druid.guice.JsonConfigurator in project druid by druid-io.
the class IndexerZkConfigTest method testIndexerBaseOverride.
@Test
public void testIndexerBaseOverride() {
final String overrideValue = "/foo/bar/baz";
final String indexerPropertyKey = indexerPropertyString + ".base";
final String priorValue = System.getProperty(indexerPropertyKey);
// Set it here so that the binding picks it up
System.setProperty(indexerPropertyKey, overrideValue);
final Injector injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of(simpleZkConfigModule));
propertyValues.clear();
// Have to set it here as well annoyingly enough
propertyValues.setProperty(indexerPropertyKey, overrideValue);
JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
JsonConfigProvider<IndexerZkConfig> indexerPathsConfig = JsonConfigProvider.of(indexerPropertyString, IndexerZkConfig.class);
indexerPathsConfig.inject(propertyValues, configurator);
IndexerZkConfig indexerZkConfig = indexerPathsConfig.get().get();
// Rewind value before we potentially fail
if (priorValue == null) {
System.clearProperty(indexerPropertyKey);
} else {
System.setProperty(indexerPropertyKey, priorValue);
}
Assert.assertEquals(overrideValue, indexerZkConfig.getBase());
Assert.assertEquals(overrideValue + "/announcements", indexerZkConfig.getAnnouncementsPath());
}
Aggregations