use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class BackendServicesTest method derivesApplicationIdsOnOriginsWhenUsingYamlConstructor.
@Test
public void derivesApplicationIdsOnOriginsWhenUsingYamlConstructor() {
BackendService before = BackendService.newBackendServiceBuilder().id("generic_app").origins(newOriginBuilder("localhost", 8080).id("origin1").build()).build();
BackendServices backendServices = new BackendServices(singletonList(before));
Origin origin = first(backendServices.first().origins());
assertThat(origin.applicationId(), is(id("generic_app")));
}
use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class YamlApplicationsProviderTest method readsBackendAppsWithHttpConfiguration.
@Test
public void readsBackendAppsWithHttpConfiguration() throws Exception {
List<BackendService> backends = backendsAsList(loadApplicationsFrom(ORIGINS_FILE));
BackendService httpApp = backends.get(0);
assertThat(httpApp.protocol(), is(HTTP));
assertThat(httpApp.tlsSettings(), is(Optional.empty()));
}
use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class YamlApplicationsProviderTest method readsBackendsAppsWithHttpsConfiguration.
@Test
public void readsBackendsAppsWithHttpsConfiguration() throws Exception {
List<BackendService> backends = backendsAsList(loadApplicationsFrom(ORIGINS_FILE));
BackendService secureApp = backends.get(1);
assertThat(secureApp.protocol(), is(HTTPS));
assertThat(secureApp.tlsSettings(), is(Optional.of(new TlsSettings.Builder().authenticate(true).sslProvider("JDK").additionalCerts(certificate("my certificate", "/path/to/mycert"), certificate("alt certificatfe", "/path/to/altcert")).trustStorePath("/path/to/truststore").trustStorePassword("truststore-123").build())));
}
use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class YamlApplicationsProviderTest method readsBackendsAppsWithOldHttpsConfiguration.
@Test
public void readsBackendsAppsWithOldHttpsConfiguration() throws Exception {
List<BackendService> backends = backendsAsList(loadApplicationsFrom(OLD_ORIGINS_FILE));
BackendService secureApp = backends.get(1);
assertThat(secureApp.protocol(), is(HTTPS));
assertThat(secureApp.tlsSettings(), is(Optional.of(new TlsSettings.Builder().authenticate(true).sslProvider("JDK").additionalCerts(certificate("my certificate", "/path/to/mycert"), certificate("alt certificatfe", "/path/to/altcert")).trustStorePath("/path/to/truststore").trustStorePassword("truststore-123").build())));
}
use of com.hotels.styx.api.extension.service.BackendService in project styx by ExpediaGroup.
the class FileBackedRegistryTest method announcesInitialStateWhenStarts.
@Test
public void announcesInitialStateWhenStarts() throws IOException {
Resource configurationFile = mockResource("/styx/config", new ByteArrayInputStream(originalContent));
registry = new FileBackedRegistry<>(configurationFile, bytes -> List.of(backendService), any -> true);
registry.addListener(listener);
await(registry.reload());
verify(listener).onChange(eq(changeSet().added(backendService).build()));
}
Aggregations