Search in sources :

Example 6 with LoggingTestSupport

use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.

the class PluginLoadingForStartupTest method attemptsToLoadAllPluginsEvenIfSomePluginFactoriesFailDuringExecution.

@Test
public void attemptsToLoadAllPluginsEvenIfSomePluginFactoriesFailDuringExecution() {
    LoggingTestSupport log = new LoggingTestSupport(FailureHandling.class);
    String yaml = "" + "plugins:\n" + "  active: myPlugin1,myPlugin2,myPlugin3\n" + "  all:\n" + "    myPlugin1:\n" + "      factory:\n" + "        class: com.hotels.styx.startup.extensions.PluginLoadingForStartupTest$FailingPluginFactory\n" + "        classPath: " + FIXTURES_CLASS_PATH + "\n" + "    myPlugin2:\n" + "      factory:\n" + "        class: com.hotels.styx.startup.extensions.PluginLoadingForStartupTest$FailingPluginFactory\n" + "        classPath: " + FIXTURES_CLASS_PATH + "\n" + "    myPlugin3:\n" + "      factory:\n" + "        class: com.hotels.styx.startup.extensions.PluginLoadingForStartupTest$FailingPluginFactory\n" + "        classPath: " + FIXTURES_CLASS_PATH + "\n";
    Exception e = assertThrows(RuntimeException.class, () -> PluginLoadingForStartup.loadPlugins(environment(yaml)));
    assertThat(e.getMessage(), matchesPattern("3 plugin\\(s\\) could not be loaded: failedPlugins=\\[myPlugin1, myPlugin2, myPlugin3\\]; failureCauses=\\[" + "myPlugin1: java.lang.RuntimeException: plugin factory error, " + "myPlugin2: java.lang.RuntimeException: plugin factory error, " + "myPlugin3: java.lang.RuntimeException: plugin factory error\\]"));
    assertThat(log.log(), hasItem(loggingEvent(ERROR, "Could not load plugin: pluginName=myPlugin1; factoryClass=.*", RuntimeException.class, "plugin factory error")));
    log.stop();
}
Also used : LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) ConfigurationException(com.hotels.styx.api.configuration.ConfigurationException) Test(org.junit.jupiter.api.Test)

Example 7 with LoggingTestSupport

use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.

the class HttpMessageLoggingInterceptorTest method before.

@BeforeEach
public void before() {
    responseLogSupport = new LoggingTestSupport("com.hotels.styx.http-messages.inbound");
    interceptor = new HttpMessageLoggingInterceptor(true, httpMessageFormatter);
}
Also used : LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with LoggingTestSupport

use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.

the class FlowControllingHttpContentProducerTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    contentChunk1 = copiedBuffer("aaa", UTF_8);
    contentChunk2 = copiedBuffer("bbb", UTF_8);
    logger = new LoggingTestSupport(FlowControllingHttpContentProducer.class);
}
Also used : LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with LoggingTestSupport

use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.

the class FileBackedBackendServicesRegistryTest method setUp.

@BeforeEach
public void setUp() {
    log = new LoggingTestSupport(FileBackedBackendServicesRegistry.class);
    fileBackedLog = new LoggingTestSupport(FileBackedRegistry.class);
}
Also used : LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) FileBackedRegistry(com.hotels.styx.infrastructure.FileBackedRegistry) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with LoggingTestSupport

use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.

the class StyxServerTest method setUp.

@BeforeEach
public void setUp() {
    log = new LoggingTestSupport(StyxServer.class);
    pssLog = new LoggingTestSupport(StyxServer.class);
}
Also used : LoggingTestSupport(com.hotels.styx.support.matchers.LoggingTestSupport) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

LoggingTestSupport (com.hotels.styx.support.matchers.LoggingTestSupport)15 BeforeEach (org.junit.jupiter.api.BeforeEach)12 Test (org.junit.jupiter.api.Test)4 ConfigurationException (com.hotels.styx.api.configuration.ConfigurationException)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 ERROR (ch.qos.logback.classic.Level.ERROR)1 Clock (com.codahale.metrics.Clock)1 MetricRegistry (com.codahale.metrics.MetricRegistry)1 Graphite (com.codahale.metrics.graphite.Graphite)1 EventBus (com.google.common.eventbus.EventBus)1 HttpHandler (com.hotels.styx.api.HttpHandler)1 HttpResponseStatus (com.hotels.styx.api.HttpResponseStatus)1 LiveHttpRequest (com.hotels.styx.api.LiveHttpRequest)1 LiveHttpResponse (com.hotels.styx.api.LiveHttpResponse)1 MicrometerRegistry (com.hotels.styx.api.MicrometerRegistry)1 ActiveOrigins (com.hotels.styx.api.extension.ActiveOrigins)1 Origin (com.hotels.styx.api.extension.Origin)1 RemoteHost (com.hotels.styx.api.extension.RemoteHost)1 LoadBalancer (com.hotels.styx.api.extension.loadbalancing.spi.LoadBalancer)1 OriginHealthStatusMonitor (com.hotels.styx.client.healthcheck.OriginHealthStatusMonitor)1