use of org.skife.config.ConfigurationObjectFactory in project druid by druid-io.
the class DruidCoordinatorConfigTest method testDeserialization.
@Test
public void testDeserialization() throws Exception {
ConfigurationObjectFactory factory = Config.createFactory(new Properties());
//with defaults
DruidCoordinatorConfig config = factory.build(DruidCoordinatorConfig.class);
Assert.assertEquals(new Duration("PT300s"), config.getCoordinatorStartDelay());
Assert.assertEquals(new Duration("PT60s"), config.getCoordinatorPeriod());
Assert.assertEquals(new Duration("PT1800s"), config.getCoordinatorIndexingPeriod());
Assert.assertFalse(config.isMergeSegments());
Assert.assertFalse(config.isConvertSegments());
Assert.assertFalse(config.isKillSegments());
Assert.assertEquals(86400000, config.getCoordinatorKillPeriod().getMillis());
Assert.assertEquals(-1000, config.getCoordinatorKillDurationToRetain().getMillis());
Assert.assertEquals(0, config.getCoordinatorKillMaxSegments());
Assert.assertEquals(new Duration(15 * 60 * 1000), config.getLoadTimeoutDelay());
Assert.assertNull(config.getConsoleStatic());
Assert.assertEquals(Duration.millis(50), config.getLoadQueuePeonRepeatDelay());
//with non-defaults
Properties props = new Properties();
props.setProperty("druid.coordinator.startDelay", "PT1s");
props.setProperty("druid.coordinator.period", "PT1s");
props.setProperty("druid.coordinator.period.indexingPeriod", "PT1s");
props.setProperty("druid.coordinator.merge.on", "true");
props.setProperty("druid.coordinator.conversion.on", "true");
props.setProperty("druid.coordinator.kill.on", "true");
props.setProperty("druid.coordinator.kill.period", "PT1s");
props.setProperty("druid.coordinator.kill.durationToRetain", "PT1s");
props.setProperty("druid.coordinator.kill.maxSegments", "10000");
props.setProperty("druid.coordinator.load.timeout", "PT1s");
props.setProperty("druid.coordinator.console.static", "test");
props.setProperty("druid.coordinator.loadqueuepeon.repeatDelay", "PT0.100s");
factory = Config.createFactory(props);
config = factory.build(DruidCoordinatorConfig.class);
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorStartDelay());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorPeriod());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorIndexingPeriod());
Assert.assertTrue(config.isMergeSegments());
Assert.assertTrue(config.isConvertSegments());
Assert.assertTrue(config.isKillSegments());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorKillPeriod());
Assert.assertEquals(new Duration("PT1s"), config.getCoordinatorKillDurationToRetain());
Assert.assertEquals(10000, config.getCoordinatorKillMaxSegments());
Assert.assertEquals(new Duration("PT1s"), config.getLoadTimeoutDelay());
Assert.assertEquals("test", config.getConsoleStatic());
Assert.assertEquals(Duration.millis(100), config.getLoadQueuePeonRepeatDelay());
}
use of org.skife.config.ConfigurationObjectFactory in project druid by druid-io.
the class Config method createFactory.
public static ConfigurationObjectFactory createFactory(Properties props) {
ConfigurationObjectFactory configFactory = new ConfigurationObjectFactory(props);
configFactory.addCoercible(new DurationCoercible());
return configFactory;
}
use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class DefaultSubscriptionModule method installConfig.
protected void installConfig() {
final SubscriptionConfig config = new ConfigurationObjectFactory(skifeConfigSource).build(SubscriptionConfig.class);
bind(SubscriptionConfig.class).toInstance(config);
}
use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class PaymentModule method configure.
@Override
protected void configure() {
final ConfigurationObjectFactory factory = new ConfigurationObjectFactory(skifeConfigSource);
final PaymentConfig paymentConfig = factory.build(PaymentConfig.class);
bind(PaymentConfig.class).annotatedWith(Names.named(STATIC_CONFIG)).toInstance(paymentConfig);
bind(PaymentConfig.class).to(MultiTenantPaymentConfig.class).asEagerSingleton();
bind(new TypeLiteral<OSGIServiceRegistration<PaymentPluginApi>>() {
}).toProvider(DefaultPaymentProviderPluginRegistryProvider.class).asEagerSingleton();
bind(new TypeLiteral<OSGIServiceRegistration<PaymentControlPluginApi>>() {
}).toProvider(DefaultPaymentControlProviderPluginRegistryProvider.class).asEagerSingleton();
bind(PaymentPluginServiceRegistration.class).asEagerSingleton();
bind(PaymentApi.class).to(DefaultPaymentApi.class).asEagerSingleton();
bind(PaymentGatewayApi.class).to(DefaultPaymentGatewayApi.class).asEagerSingleton();
bind(AdminPaymentApi.class).to(DefaultAdminPaymentApi.class).asEagerSingleton();
bind(PaymentBusEventHandler.class).asEagerSingleton();
bind(PaymentTagHandler.class).asEagerSingleton();
bind(PaymentService.class).to(DefaultPaymentService.class).asEagerSingleton();
bind(PaymentExecutors.class).asEagerSingleton();
installPaymentProviderPlugins(paymentConfig);
installPaymentDao();
installProcessors(paymentConfig);
installStateMachines();
installAutomatonRunner();
installRetryEngines();
installJanitor();
}
use of org.skife.config.ConfigurationObjectFactory in project killbill by killbill.
the class DefaultInvoiceModule method installNotifiers.
protected void installNotifiers() {
bind(NextBillingDateNotifier.class).to(DefaultNextBillingDateNotifier.class).asEagerSingleton();
bind(NextBillingDatePoster.class).to(DefaultNextBillingDatePoster.class).asEagerSingleton();
final TranslatorConfig config = new ConfigurationObjectFactory(skifeConfigSource).build(TranslatorConfig.class);
bind(TranslatorConfig.class).toInstance(config);
bind(InvoiceFormatterFactory.class).to(config.getInvoiceFormatterFactoryClass()).asEagerSingleton();
}
Aggregations