use of com.hotels.styx.infrastructure.configuration.yaml.YamlConfig in project styx by ExpediaGroup.
the class AdminServerConfigTest method usesConfiguredPortIfPresent.
@Test
public void usesConfiguredPortIfPresent() {
String yaml = "" + "admin:\n" + " connectors:\n" + " http:\n" + " port: 1234\n";
YamlConfig yamlConfig = new YamlConfig(yaml);
Optional<AdminServerConfig> admin = yamlConfig.get("admin", AdminServerConfig.class);
assertThat(admin.get().httpConnectorConfig().get().port(), is(1234));
}
use of com.hotels.styx.infrastructure.configuration.yaml.YamlConfig in project styx by ExpediaGroup.
the class LoadBalancerFactoryProviderTest method errorsIfTheSpecifiedStrategyFactoryKeyClassIsMissing.
@Test
public void errorsIfTheSpecifiedStrategyFactoryKeyClassIsMissing() {
String yaml = "" + "loadBalancing:\n" + " strategy: noentry\n";
Configuration configurations = new YamlConfig(yaml);
assertThrows(MissingConfigurationException.class, () -> newProvider(configurations).get());
}
use of com.hotels.styx.infrastructure.configuration.yaml.YamlConfig in project styx by ExpediaGroup.
the class LoadBalancerFactoryProviderTest method errorsIfCannotFindTheFactoryClass.
@Test
public void errorsIfCannotFindTheFactoryClass() {
String yaml = "" + "loadBalancing:\n" + " strategy: awesome\n" + " strategies:\n" + " awesome:\n" + " factory: {class: \"doesnot.really.exist\"}\n";
Configuration configurations = new YamlConfig(yaml);
assertThrows(RuntimeException.class, () -> newProvider(configurations).get());
}
use of com.hotels.styx.infrastructure.configuration.yaml.YamlConfig in project styx by ExpediaGroup.
the class LoadBalancerFactoryProviderTest method loadsTheConfiguredStrategy.
@Test
public void loadsTheConfiguredStrategy() {
String yaml = "" + "loadBalancing:\n" + " strategy: awesome\n" + " strategies:\n" + " awesome:\n" + " factory: {class: \"com.hotels.styx.proxy.LoadBalancerFactoryProviderTest$NewAwesomeStrategy\"}\n";
Configuration configuration = new YamlConfig(yaml);
LoadBalancingStrategyFactoryProvider factoryProvider = newProvider(configuration);
assertThat(factoryProvider.get(), is(instanceOf(NewAwesomeStrategy.class)));
}
use of com.hotels.styx.infrastructure.configuration.yaml.YamlConfig in project styx by ExpediaGroup.
the class AdminServerConfigTest method usesDefaultPortIfNoConnectors.
@Test
public void usesDefaultPortIfNoConnectors() {
String yaml = "" + "admin:\n" + " maxConnectionsCount: 123\n";
YamlConfig yamlConfig = new YamlConfig(yaml);
Optional<AdminServerConfig> admin = yamlConfig.get("admin", AdminServerConfig.class);
assertThat(admin.get().httpConnectorConfig().get().port(), is(DEFAULT_ADMIN_PORT));
}
Aggregations