Search in sources :

Example 1 with FileMonitorSettings

use of com.hotels.styx.proxy.backends.file.FileChangeMonitor.FileMonitorSettings in project styx by ExpediaGroup.

the class FileBackedBackendServicesRegistryFactoryTest method createsWithFileChangeMonitor.

@Test
public void createsWithFileChangeMonitor() {
    Configuration configuration = mockConfiguration(Optional.of(monitoredFile.toString()), Optional.of(new FileMonitorSettings(true)));
    FileBackedBackendServicesRegistry registry = (FileBackedBackendServicesRegistry) new FileBackedBackendServicesRegistry.Factory().create(environment, configuration);
    assertThat(registry.monitor(), instanceOf(FileChangeMonitor.class));
}
Also used : Configuration(com.hotels.styx.api.configuration.Configuration) FileMonitorSettings(com.hotels.styx.proxy.backends.file.FileChangeMonitor.FileMonitorSettings) Test(org.junit.jupiter.api.Test)

Example 2 with FileMonitorSettings

use of com.hotels.styx.proxy.backends.file.FileChangeMonitor.FileMonitorSettings in project styx by ExpediaGroup.

the class FileBackedBackendServicesRegistryFactoryTest method mockConfiguration.

private Configuration mockConfiguration(Optional<String> path, Optional<FileMonitorSettings> monitorSettings) {
    Configuration configuration = mock(Configuration.class);
    when(configuration.get(eq("originsFile"), eq(String.class))).thenReturn(path);
    when(configuration.get(eq("monitor"), eq(FileMonitorSettings.class))).thenReturn(monitorSettings);
    return configuration;
}
Also used : Configuration(com.hotels.styx.api.configuration.Configuration) FileMonitorSettings(com.hotels.styx.proxy.backends.file.FileChangeMonitor.FileMonitorSettings)

Aggregations

Configuration (com.hotels.styx.api.configuration.Configuration)2 FileMonitorSettings (com.hotels.styx.proxy.backends.file.FileChangeMonitor.FileMonitorSettings)2 Test (org.junit.jupiter.api.Test)1