use of com.hotels.styx.api.Environment in project styx by ExpediaGroup.
the class ServiceProvisionTest method loadsNewConfigurationFormat.
@Test
public void loadsNewConfigurationFormat() {
Environment env = environmentWithConfig(yamlForServiceFactories);
Map<String, StyxService> services = loadServices(env.configuration(), env, "multi", StyxService.class);
assertThat(services.get("backendProvider"), instanceOf(BackendServiceProvider.class));
assertThat(services.get("routingProvider"), instanceOf(RoutingObjectProvider.class));
}
use of com.hotels.styx.api.Environment in project styx by ExpediaGroup.
the class ServiceProvisionTest method isInstanceWorks.
@Test
public void isInstanceWorks() {
Environment env = environmentWithConfig(yamlForServices);
Map<String, StyxService> services = loadServices(env.configuration(), env, "multi", StyxService.class);
assertThat(services.get("backendProvider"), instanceOf(BackendServiceProvider.class));
assertThat(services.get("routingProvider"), instanceOf(RoutingObjectProvider.class));
}
use of com.hotels.styx.api.Environment in project styx by ExpediaGroup.
the class ServiceProvisionTest method throwsExceptionForInvalidSpiExtensionFactory.
@Test
public void throwsExceptionForInvalidSpiExtensionFactory() {
String config = "" + "multi:\n" + " factories:\n" + " backendProvider:\n" + " enabled: false\n" + " factory:\n" + " classPath: /path/to/jar\n" + " config:\n" + " attribute: x\n";
Environment env = environmentWithConfig(config);
Exception e = assertThrows(ConfigurationException.class, () -> loadServices(env.configuration(), env, "multi", StyxService.class));
assertThat(e.getMessage(), matchesPattern("Unexpected configuration object 'services.factories.backendProvider', Configuration.*'"));
}
use of com.hotels.styx.api.Environment in project styx by ExpediaGroup.
the class ServiceProvisionTest method throwsExceptionForInvalidServiceFactoryConfig.
@Test
public void throwsExceptionForInvalidServiceFactoryConfig() {
String config = "" + "multi:\n" + " factories:\n" + " backendProvider:\n" + " enabled: false\n" + " config:\n" + " stringValue: valueNumber1\n";
Environment env = environmentWithConfig(config);
Exception e = assertThrows(ConfigurationException.class, () -> loadServices(env.configuration(), env, "multi", StyxService.class));
assertThat(e.getMessage(), matchesPattern("Unexpected configuration object 'services.factories.backendProvider', Configuration.*'"));
}
use of com.hotels.styx.api.Environment in project styx by ExpediaGroup.
the class FileBackedBackendServicesRegistryFactoryTest method setUp.
@BeforeEach
public void setUp() throws Exception {
tempDir = createTempDirectory("");
monitoredFile = Paths.get(tempDir.toString(), "origins.yml");
write(monitoredFile, "content-v1");
environment = new com.hotels.styx.Environment.Builder().registry(new MicrometerRegistry(new SimpleMeterRegistry())).build();
}
Aggregations