use of com.hubspot.singularity.runner.base.config.SingularityRunnerConfigurationProvider in project Singularity by HubSpot.
the class SingularityExecutorConfigurationTest method loadConfig.
private SingularityExecutorConfiguration loadConfig(String file) {
try {
ObjectMapper mapper = new SingularityRunnerBaseModule(null).providesYamlMapper();
Validator validator = mock(Validator.class);
Field mapperField = SingularityRunnerConfigurationProvider.class.getDeclaredField("objectMapper");
mapperField.setAccessible(true);
Field validatorField = SingularityRunnerConfigurationProvider.class.getDeclaredField("validator");
validatorField.setAccessible(true);
SingularityRunnerConfigurationProvider<SingularityExecutorConfiguration> configProvider = new SingularityRunnerConfigurationProvider<>(SingularityExecutorConfiguration.class, Optional.of(new File(getClass().getClassLoader().getResource(file).toURI()).getAbsolutePath()));
mapperField.set(configProvider, mapper);
validatorField.set(configProvider, validator);
return configProvider.get();
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
Aggregations