use of io.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(propertyBase + ".lookupTier", lookupTier);
final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(propertyBase, LookupListeningAnnouncerConfig.class);
configProvider.inject(properties, configurator);
final LookupListeningAnnouncerConfig config = configProvider.get().get();
Assert.assertEquals(lookupTier, config.getLookupTier());
}
use of io.druid.guice.JsonConfigurator in project druid by druid-io.
the class LookupListeningAnnouncerConfigTest method testFailsInjection.
@Test(expected = IllegalArgumentException.class)
public void testFailsInjection() {
final String lookupTier = "some_tier";
final JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
properties.put(propertyBase + ".lookupTier", lookupTier);
properties.put(propertyBase + ".lookupTierIsDatasource", "true");
final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(propertyBase, LookupListeningAnnouncerConfig.class);
configProvider.inject(properties, configurator);
final LookupListeningAnnouncerConfig config = configProvider.get().get();
Assert.assertEquals(lookupTier, config.getLookupTier());
}
use of io.druid.guice.JsonConfigurator in project druid by druid-io.
the class LookupListeningAnnouncerConfigTest method testDatasourceInjection.
@Test
public void testDatasourceInjection() {
final JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
properties.put(propertyBase + ".lookupTierIsDatasource", "true");
final JsonConfigProvider<LookupListeningAnnouncerConfig> configProvider = JsonConfigProvider.of(propertyBase, LookupListeningAnnouncerConfig.class);
configProvider.inject(properties, configurator);
final LookupListeningAnnouncerConfig config = configProvider.get().get();
Assert.assertEquals("some_datasource", config.getLookupTier());
}
use of io.druid.guice.JsonConfigurator in project druid by druid-io.
the class IndexerZkConfigTest method testExactConfig.
@Test
public void testExactConfig() {
final Injector injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of(simpleZkConfigModule));
propertyValues.setProperty(zkServiceConfigString + ".base", "/druid/metrics");
JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
JsonConfigProvider<ZkPathsConfig> zkPathsConfig = JsonConfigProvider.of(zkServiceConfigString, ZkPathsConfig.class);
zkPathsConfig.inject(propertyValues, configurator);
ZkPathsConfig zkPathsConfig1 = zkPathsConfig.get().get();
IndexerZkConfig indexerZkConfig = new IndexerZkConfig(zkPathsConfig1, null, null, null, null, null);
Assert.assertEquals("/druid/metrics/indexer", indexerZkConfig.getBase());
Assert.assertEquals("/druid/metrics/indexer/announcements", indexerZkConfig.getAnnouncementsPath());
}
use of io.druid.guice.JsonConfigurator in project druid by druid-io.
the class IndexerZkConfigTest method testNullConfig.
@Test
public void testNullConfig() {
propertyValues.clear();
final Injector injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of(simpleZkConfigModule));
JsonConfigurator configurator = injector.getBinding(JsonConfigurator.class).getProvider().get();
JsonConfigProvider<ZkPathsConfig> zkPathsConfig = JsonConfigProvider.of(zkServiceConfigString, ZkPathsConfig.class);
zkPathsConfig.inject(propertyValues, configurator);
JsonConfigProvider<IndexerZkConfig> indexerZkConfig = JsonConfigProvider.of(indexerPropertyString, IndexerZkConfig.class);
indexerZkConfig.inject(propertyValues, configurator);
Assert.assertEquals("/druid/indexer/leaderLatchPath", indexerZkConfig.get().get().getLeaderLatchPath());
}
Aggregations