Search in sources :

Example 1 with ConfigurationObjectFactory

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());
}
Also used : ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) Duration(org.joda.time.Duration) Properties(java.util.Properties) Test(org.junit.Test)

Example 2 with ConfigurationObjectFactory

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;
}
Also used : ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory)

Example 3 with ConfigurationObjectFactory

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);
}
Also used : SubscriptionConfig(org.killbill.billing.util.config.definition.SubscriptionConfig) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory)

Example 4 with ConfigurationObjectFactory

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();
}
Also used : DefaultPaymentGatewayApi(org.killbill.billing.payment.api.DefaultPaymentGatewayApi) OSGIServiceRegistration(org.killbill.billing.osgi.api.OSGIServiceRegistration) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) DefaultAdminPaymentApi(org.killbill.billing.payment.api.DefaultAdminPaymentApi) MultiTenantPaymentConfig(org.killbill.billing.payment.config.MultiTenantPaymentConfig) PaymentPluginServiceRegistration(org.killbill.billing.payment.core.PaymentPluginServiceRegistration) PaymentBusEventHandler(org.killbill.billing.payment.bus.PaymentBusEventHandler) PaymentTagHandler(org.killbill.billing.payment.invoice.PaymentTagHandler) PaymentExecutors(org.killbill.billing.payment.core.PaymentExecutors) PaymentConfig(org.killbill.billing.util.config.definition.PaymentConfig) MultiTenantPaymentConfig(org.killbill.billing.payment.config.MultiTenantPaymentConfig) DefaultPaymentApi(org.killbill.billing.payment.api.DefaultPaymentApi)

Example 5 with ConfigurationObjectFactory

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();
}
Also used : DefaultNextBillingDateNotifier(org.killbill.billing.invoice.notification.DefaultNextBillingDateNotifier) TranslatorConfig(org.killbill.billing.util.template.translation.TranslatorConfig) ConfigurationObjectFactory(org.skife.config.ConfigurationObjectFactory) DefaultNextBillingDatePoster(org.killbill.billing.invoice.notification.DefaultNextBillingDatePoster)

Aggregations

ConfigurationObjectFactory (org.skife.config.ConfigurationObjectFactory)26 Properties (java.util.Properties)4 TranslatorConfig (org.killbill.billing.util.template.translation.TranslatorConfig)4 BeforeClass (org.testng.annotations.BeforeClass)3 Test (org.junit.Test)2 OSGIServiceRegistration (org.killbill.billing.osgi.api.OSGIServiceRegistration)2 RbacConfig (org.killbill.billing.util.config.definition.RbacConfig)2 MustacheTemplateEngine (org.killbill.billing.util.email.templates.MustacheTemplateEngine)2 Configuration (com.espertech.esper.client.Configuration)1 EPServiceProvider (com.espertech.esper.client.EPServiceProvider)1 Injector (com.google.inject.Injector)1 TypeLiteral (com.google.inject.TypeLiteral)1 File (java.io.File)1 MBeanServer (javax.management.MBeanServer)1 AuthenticationInfo (org.apache.shiro.authc.AuthenticationInfo)1 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)1 AuthorizationInfo (org.apache.shiro.authz.AuthorizationInfo)1 SimplePrincipalCollection (org.apache.shiro.subject.SimplePrincipalCollection)1 JacksonJsonProvider (org.codehaus.jackson.jaxrs.JacksonJsonProvider)1 Duration (org.joda.time.Duration)1