Search in sources :

Example 1 with ResourceConfigurationSourceProvider

use of io.dropwizard.configuration.ResourceConfigurationSourceProvider in project dropwizard by dropwizard.

the class DataSourceFactoryTest method createDefaultFactory.

@Test
public void createDefaultFactory() throws Exception {
    final DataSourceFactory factory = new YamlConfigurationFactory<>(DataSourceFactory.class, BaseValidator.newValidator(), Jackson.newObjectMapper(), "dw").build(new ResourceConfigurationSourceProvider(), "yaml/minimal_db_pool.yml");
    assertThat(factory.getDriverClass()).isEqualTo("org.postgresql.Driver");
    assertThat(factory.getUser()).isEqualTo("pg-user");
    assertThat(factory.getPassword()).isEqualTo("iAMs00perSecrEET");
    assertThat(factory.getUrl()).isEqualTo("jdbc:postgresql://db.example.com/db-prod");
    assertThat(factory.getValidationQuery()).isEqualTo("/* Health Check */ SELECT 1");
    assertThat(factory.getValidationQueryTimeout()).isEqualTo(Optional.empty());
}
Also used : ResourceConfigurationSourceProvider(io.dropwizard.configuration.ResourceConfigurationSourceProvider) Test(org.junit.Test)

Aggregations

ResourceConfigurationSourceProvider (io.dropwizard.configuration.ResourceConfigurationSourceProvider)1 Test (org.junit.Test)1