Search in sources :

Example 1 with RequestRunnableFactory

use of com.spotify.apollo.request.RequestRunnableFactory in project apollo by spotify.

the class RequestLoggingDecoratorTest method collectLoggingEventsForRequest.

private List<LoggingEvent> collectLoggingEventsForRequest(OngoingRequest ongoingRequest) {
    RequestRunnableFactory decorated = decorator.apply(delegateFactory);
    decorated.create(ongoingRequest).run(EMPTY_CONTINUATION);
    return testLogger.getLoggingEvents().stream().filter(event -> event.getLevel() == Level.INFO).collect(Collectors.toList());
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Response(com.spotify.apollo.Response) Endpoint(com.spotify.apollo.dispatch.Endpoint) Arrays(java.util.Arrays) Request(com.spotify.apollo.Request) Level(uk.org.lidalia.slf4jext.Level) TestLoggerFactory(uk.org.lidalia.slf4jtest.TestLoggerFactory) AtomicReference(java.util.concurrent.atomic.AtomicReference) OngoingRequest(com.spotify.apollo.request.OngoingRequest) Assert.assertThat(org.junit.Assert.assertThat) ByteString.encodeUtf8(okio.ByteString.encodeUtf8) TestLogger(uk.org.lidalia.slf4jtest.TestLogger) RuleMatch(com.spotify.apollo.route.RuleMatch) ByteString(okio.ByteString) BiConsumer(java.util.function.BiConsumer) RequestMetadata(com.spotify.apollo.RequestMetadata) LoggingEvent(uk.org.lidalia.slf4jtest.LoggingEvent) Before(org.junit.Before) Description(org.hamcrest.Description) Iterator(java.util.Iterator) Test(org.junit.Test) TestLoggerFactoryResetRule(uk.org.lidalia.slf4jtest.TestLoggerFactoryResetRule) TypeSafeMatcher(org.hamcrest.TypeSafeMatcher) Collectors(java.util.stream.Collectors) List(java.util.List) Rule(org.junit.Rule) Matcher(org.hamcrest.Matcher) RequestRunnableFactory(com.spotify.apollo.request.RequestRunnableFactory) RequestRunnableFactory(com.spotify.apollo.request.RequestRunnableFactory)

Aggregations

Request (com.spotify.apollo.Request)1 RequestMetadata (com.spotify.apollo.RequestMetadata)1 Response (com.spotify.apollo.Response)1 Endpoint (com.spotify.apollo.dispatch.Endpoint)1 OngoingRequest (com.spotify.apollo.request.OngoingRequest)1 RequestRunnableFactory (com.spotify.apollo.request.RequestRunnableFactory)1 RuleMatch (com.spotify.apollo.route.RuleMatch)1 Arrays (java.util.Arrays)1 Iterator (java.util.Iterator)1 List (java.util.List)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 BiConsumer (java.util.function.BiConsumer)1 Collectors (java.util.stream.Collectors)1 ByteString (okio.ByteString)1 ByteString.encodeUtf8 (okio.ByteString.encodeUtf8)1 CoreMatchers.is (org.hamcrest.CoreMatchers.is)1 Description (org.hamcrest.Description)1 Matcher (org.hamcrest.Matcher)1 TypeSafeMatcher (org.hamcrest.TypeSafeMatcher)1 Assert.assertThat (org.junit.Assert.assertThat)1