Search in sources :

Example 6 with StyxService

use of com.hotels.styx.api.extension.service.spi.StyxService in project styx by ExpediaGroup.

the class ServiceProvisionTest method ignoresDisabledServices.

@Test
public void ignoresDisabledServices() {
    Environment env = environmentWithConfig(mixedDisabledServices);
    Map<String, StyxService> services = loadServices(env.configuration(), env, "multi", StyxService.class);
    assertThat(services.isEmpty(), is(true));
}
Also used : Environment(com.hotels.styx.api.Environment) StyxService(com.hotels.styx.api.extension.service.spi.StyxService) AbstractStyxService(com.hotels.styx.api.extension.service.spi.AbstractStyxService) Test(org.junit.jupiter.api.Test)

Example 7 with StyxService

use of com.hotels.styx.api.extension.service.spi.StyxService in project styx by ExpediaGroup.

the class ServiceProvisionTest method loadsFromMixedConfigFormat.

@Test
public void loadsFromMixedConfigFormat() {
    Environment env = environmentWithConfig(yamlForMixedServiceFactories);
    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));
}
Also used : Environment(com.hotels.styx.api.Environment) StyxService(com.hotels.styx.api.extension.service.spi.StyxService) AbstractStyxService(com.hotels.styx.api.extension.service.spi.AbstractStyxService) Test(org.junit.jupiter.api.Test)

Example 8 with StyxService

use of com.hotels.styx.api.extension.service.spi.StyxService in project styx by ExpediaGroup.

the class StyxServerComponentsTest method exposesAdditionalServices.

@Test
public void exposesAdditionalServices() {
    StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry((new CompositeMeterRegistry()))).styxConfig(new StyxConfig()).additionalServices(Map.of("service1", mock(StyxService.class), "service2", mock(StyxService.class))).build();
    Map<String, StyxService> services = components.services();
    assertThat(services.keySet(), containsInAnyOrder("service1", "service2"));
}
Also used : CompositeMeterRegistry(io.micrometer.core.instrument.composite.CompositeMeterRegistry) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) StyxConfig(com.hotels.styx.StyxConfig) StyxService(com.hotels.styx.api.extension.service.spi.StyxService) Test(org.junit.jupiter.api.Test)

Aggregations

StyxService (com.hotels.styx.api.extension.service.spi.StyxService)8 Test (org.junit.jupiter.api.Test)7 Environment (com.hotels.styx.api.Environment)4 AbstractStyxService (com.hotels.styx.api.extension.service.spi.AbstractStyxService)4 StyxConfig (com.hotels.styx.StyxConfig)2 MicrometerRegistry (com.hotels.styx.api.MicrometerRegistry)2 CompositeMeterRegistry (io.micrometer.core.instrument.composite.CompositeMeterRegistry)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Service (com.google.common.util.concurrent.Service)1 Environment (com.hotels.styx.Environment)1 StyxObjectRecord (com.hotels.styx.StyxObjectRecord)1 Eventual (com.hotels.styx.api.Eventual)1 HttpResponse.response (com.hotels.styx.api.HttpResponse.response)1 Configuration (com.hotels.styx.api.configuration.Configuration)1 BackendService (com.hotels.styx.api.extension.service.BackendService)1 Plugin (com.hotels.styx.api.plugins.spi.Plugin)1 NamedPlugin (com.hotels.styx.proxy.plugin.NamedPlugin)1 StyxObjectStore (com.hotels.styx.routing.db.StyxObjectStore)1 LoggingSetUp (com.hotels.styx.startup.StyxServerComponents.LoggingSetUp)1