Search in sources :

Example 6 with StyxConfig

use of com.hotels.styx.StyxConfig in project styx by ExpediaGroup.

the class StyxServerComponentsTest method createsEnvironment.

@Test
public void createsEnvironment() {
    Configuration config = new Configuration.MapBackedConfiguration().set("foo", "abc").set("bar", "def");
    StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).styxConfig(new StyxConfig(config)).build();
    Environment environment = components.environment();
    assertThat(environment.configuration().get("foo", String.class), isValue("abc"));
    assertThat(environment.configuration().get("bar", String.class), isValue("def"));
    assertThat(environment.eventBus(), is(notNullValue()));
    assertThat(environment.metricRegistry(), is(notNullValue()));
}
Also used : CompositeMeterRegistry(io.micrometer.core.instrument.composite.CompositeMeterRegistry) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) StyxConfig(com.hotels.styx.StyxConfig) Configuration(com.hotels.styx.api.configuration.Configuration) Environment(com.hotels.styx.Environment) Test(org.junit.jupiter.api.Test)

Example 7 with StyxConfig

use of com.hotels.styx.StyxConfig in project styx by ExpediaGroup.

the class StyxServerComponentsTest method setsUpLoggingOnBuild.

@Test
public void setsUpLoggingOnBuild() {
    LoggingSetUp loggingSetUp = mock(LoggingSetUp.class);
    new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).styxConfig(new StyxConfig()).loggingSetUp(loggingSetUp).build();
    verify(loggingSetUp).setUp(any(Environment.class));
}
Also used : CompositeMeterRegistry(io.micrometer.core.instrument.composite.CompositeMeterRegistry) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) StyxConfig(com.hotels.styx.StyxConfig) LoggingSetUp(com.hotels.styx.startup.StyxServerComponents.LoggingSetUp) Environment(com.hotels.styx.Environment) Test(org.junit.jupiter.api.Test)

Aggregations

StyxConfig (com.hotels.styx.StyxConfig)7 MicrometerRegistry (com.hotels.styx.api.MicrometerRegistry)6 Test (org.junit.jupiter.api.Test)6 CompositeMeterRegistry (io.micrometer.core.instrument.composite.CompositeMeterRegistry)5 Environment (com.hotels.styx.Environment)3 Configuration (com.hotels.styx.api.configuration.Configuration)2 StyxService (com.hotels.styx.api.extension.service.spi.StyxService)2 NamedPlugin (com.hotels.styx.proxy.plugin.NamedPlugin)2 LoggingSetUp (com.hotels.styx.startup.StyxServerComponents.LoggingSetUp)2 ConfiguredPluginFactory (com.hotels.styx.startup.extensions.ConfiguredPluginFactory)2 NettyExecutor (com.hotels.styx.NettyExecutor)1 Eventual (com.hotels.styx.api.Eventual)1 HttpResponse.response (com.hotels.styx.api.HttpResponse.response)1 LiveHttpRequest (com.hotels.styx.api.LiveHttpRequest)1 LiveHttpResponse (com.hotels.styx.api.LiveHttpResponse)1 MapBackedConfiguration (com.hotels.styx.api.configuration.Configuration.MapBackedConfiguration)1 Origin.newOriginBuilder (com.hotels.styx.api.extension.Origin.newOriginBuilder)1 BackendService (com.hotels.styx.api.extension.service.BackendService)1 BackendService.newBackendServiceBuilder (com.hotels.styx.api.extension.service.BackendService.newBackendServiceBuilder)1 StickySessionConfig.newStickySessionConfigBuilder (com.hotels.styx.api.extension.service.StickySessionConfig.newStickySessionConfigBuilder)1