use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.
the class OriginRestrictionLoadBalancingStrategyTest method setUp.
@BeforeEach
public void setUp() {
delegate = mock(LoadBalancer.class);
when(delegate.choose(any(LoadBalancer.Preferences.class))).thenReturn(Optional.of(origins.get(0)));
strategy = new OriginRestrictionLoadBalancingStrategy(new ActiveOrigins() {
@Override
public Iterable<RemoteHost> snapshot() {
return origins;
}
@Override
public String getApplicationId() {
return null;
}
@Override
public List<Origin> origins() {
return null;
}
}, delegate);
log = new LoggingTestSupport(OriginRestrictionLoadBalancingStrategy.class);
}
use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.
the class OriginsInventoryTest method setUp.
@BeforeEach
public void setUp() {
meterRegistry = new MicrometerRegistry(new SimpleMeterRegistry());
logger = new LoggingTestSupport(OriginsInventory.class);
monitor = mock(OriginHealthStatusMonitor.class);
eventBus = mock(EventBus.class);
inventory = new OriginsInventory(eventBus, GENERIC_APP, monitor, connectionFactory, hostClientFactory, new CentralisedMetrics(meterRegistry));
}
use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.
the class ExceptionStatusMapperTest method exceptionMayNotBeMappedToMultipleExceptions.
@Test
public void exceptionMayNotBeMappedToMultipleExceptions() {
ExceptionStatusMapper mapper = new ExceptionStatusMapper.Builder().add(BAD_GATEWAY, Exception1.class).add(GATEWAY_TIMEOUT, DoubleMappedException.class).build();
LoggingTestSupport support = new LoggingTestSupport(ExceptionStatusMapper.class);
Optional<HttpResponseStatus> status;
try {
status = mapper.statusFor(new DoubleMappedException());
} finally {
assertThat(support.lastMessage(), is(loggingEvent(ERROR, "Multiple matching statuses for throwable=" + quote(DoubleMappedException.class.getName()) + " statuses=\\[502 Bad Gateway, 504 Gateway Timeout\\]")));
}
assertThat(status, isAbsent());
}
use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.
the class GraphiteReporterTest method setUp.
@BeforeEach
public void setUp() {
Clock clock = mock(Clock.class);
graphite = mock(Graphite.class);
MetricRegistry registry = mock(MetricRegistry.class);
when(clock.getTime()).thenReturn(TIMESTAMP * 1000);
reporter = forRegistry(registry).withClock(clock).prefixedWith("prefix").convertRatesTo(SECONDS).convertDurationsTo(MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
logging = new LoggingTestSupport(GraphiteReporter.class);
}
use of com.hotels.styx.support.matchers.LoggingTestSupport in project styx by ExpediaGroup.
the class HttpErrorStatusCauseLoggerTest method setUp.
@BeforeEach
public void setUp() {
loggingTestSupport = new LoggingTestSupport(HttpErrorStatusCauseLogger.class);
httpErrorStatusCauseLogger = new HttpErrorStatusCauseLogger(httpMessageFormatter);
}
Aggregations