Ejemplo n.º 1
0
 private T parseConfiguration(
     ConfigurationSourceProvider provider, String path, Class<T> klass, ObjectMapper objectMapper)
     throws IOException, ConfigurationException {
   final Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
   final ConfigurationFactory<T> configurationFactory =
       new ConfigurationFactory<>(klass, validator, objectMapper, "dw");
   if (path != null) {
     return configurationFactory.build(provider, path);
   }
   return configurationFactory.build();
 }
Ejemplo n.º 2
0
  @Before
  public void setUp() throws Exception {
    objectMapper
        .getSubtypeResolver()
        .registerSubtypes(
            ConsoleReporterFactory.class, CsvReporterFactory.class, Slf4jReporterFactory.class);

    this.config = factory.build(new File(Resources.getResource("yaml/metrics.yml").toURI()));
  }