io.dropwizard.configuration.DefaultConfigurationFactoryFactory Java Examples
The following examples show how to use
io.dropwizard.configuration.DefaultConfigurationFactoryFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestFlexibleConfigurationSourceProvider.java From soabase with Apache License 2.0 | 5 votes |
@Test public void testViaDW() throws Exception { Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); ObjectMapper objectMapper = Jackson.newObjectMapper(); ConfigurationFactory<MyConfiguration> configurationFactory = new DefaultConfigurationFactoryFactory<MyConfiguration>().create(MyConfiguration.class, validator, objectMapper, "dw"); MyConfiguration configuration = configurationFactory.build(new FlexibleConfigurationSourceProvider(), "%{\"testValue\": \"override\"}"); Assert.assertEquals("override", configuration.testValue); }
Example #2
Source File: ClientExample.java From alchemy with MIT License | 5 votes |
private static AlchemyClient buildClient(String configurationFile) throws Exception { final Validator validator = BaseValidator.newValidator(); final ObjectMapper mapper = Jackson.newObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); final ConfigurationFactory<AlchemyClientConfiguration> configurationFactory = new DefaultConfigurationFactoryFactory<AlchemyClientConfiguration>().create( AlchemyClientConfiguration.class, validator, mapper, ""); return new AlchemyClient( configurationFactory.build(new File(configurationFile)) ); }
Example #3
Source File: Cli.java From oxd with Apache License 2.0 | 5 votes |
private static OxdServerConfiguration parseConfiguration(String pathToYaml) throws IOException, ConfigurationException { if (StringUtils.isBlank(pathToYaml)) { System.out.println("Path to yml configuration file is not specified. Exit!"); System.exit(1); } File file = new File(pathToYaml); if (!file.exists()) { System.out.println("Failed to find yml configuration file. Please check " + pathToYaml); System.exit(1); } DefaultConfigurationFactoryFactory<OxdServerConfiguration> configurationFactoryFactory = new DefaultConfigurationFactoryFactory<>(); ConfigurationFactory<OxdServerConfiguration> configurationFactory = configurationFactoryFactory.create(OxdServerConfiguration.class, Validators.newValidatorFactory().getValidator(), Jackson.newObjectMapper(), "dw"); return configurationFactory.build(file); }
Example #4
Source File: TestUtils.java From oxd with Apache License 2.0 | 5 votes |
public static OxdServerConfiguration parseConfiguration(String pathToYaml) throws IOException, ConfigurationException { File file = new File(pathToYaml); if (!file.exists()) { System.out.println("Failed to find yml configuration file. Please check " + pathToYaml); System.exit(1); } DefaultConfigurationFactoryFactory<OxdServerConfiguration> configurationFactoryFactory = new DefaultConfigurationFactoryFactory<>(); ConfigurationFactory<OxdServerConfiguration> configurationFactory = configurationFactoryFactory.create(OxdServerConfiguration.class, Validators.newValidatorFactory().getValidator(), Jackson.newObjectMapper(), "dw"); return configurationFactory.build(file); }