Package brave.test.http
Class ITHttpClient<C>
- java.lang.Object
-
- brave.test.ITRemote
-
- brave.test.http.ITHttpClient<C>
-
- Direct Known Subclasses:
ITHttpAsyncClient
public abstract class ITHttpClient<C> extends ITRemote
-
-
Field Summary
Fields Modifier and Type Field Description protected C
client
protected brave.propagation.TraceContext.Extractor<okhttp3.mockwebserver.RecordedRequest>
extractor
protected HttpTracing
httpTracing
okhttp3.mockwebserver.MockWebServer
server
-
Fields inherited from class brave.test.ITRemote
BAGGAGE_FIELD, BAGGAGE_FIELD_KEY, currentTraceContext, propagationFactory, testName, testSpanHandler, tracing
-
-
Constructor Summary
Constructors Constructor Description ITHttpClient()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addsStatusCodeWhenNotOk()
protected void
clientTimestampAndDurationEnclosedByParent()
This prevents confusion as a blocking client should end before, the start of the next span.void
close()
Closes the client prior to callingITRemote.close()
protected abstract void
closeClient(C client)
protected void
customSampler()
protected void
defaultSpanNameIsMethodName()
protected void
emptyPath()
This tests empty path "" coerces to "/" per RFC 7230 Section 2.7.3protected brave.propagation.TraceContext
extract(okhttp3.mockwebserver.RecordedRequest request)
protected abstract void
get(C client, String pathIncludingQuery)
protected void
httpPathTagExcludesQueryParams()
protected abstract C
newClient(int port)
Make sure the client you return has retries disabled.protected void
options()
protected abstract void
options(C client, String path)
protected void
post()
protected abstract void
post(C client, String pathIncludingQuery, String body)
protected void
propagatesBaggage()
protected void
propagatesBaggage_unsampled()
protected void
propagatesChildOfCurrentSpan()
protected void
propagatesNewTrace()
protected void
propagatesUnsampledContext()
Unlike Brave 3, Brave 4 propagates trace ids even when unsampledprotected void
readsRequestAtResponseTime()
protected void
redirect()
protected void
reportsClientKindToZipkin()
protected void
reportsServerAddress()
protected void
setsError_onTransportException()
void
setup()
protected void
spanHandlerSeesError()
protected void
supportsPortableCustomization()
protected okhttp3.mockwebserver.RecordedRequest
takeRequest()
Ensures a timeout receiving a request happens before the method timeoutprotected String
url(String pathIncludingQuery)
-
Methods inherited from class brave.test.ITRemote
assertChildOf, assertChildOf, assertChildOf, assertNoError, assertNoErrorTag, assertSameIds, assertSequential, assertSpanInInterval, checkForLeakedScopes, currentTraceContextBuilder, newTraceContext, tracingBuilder
-
-
-
-
Field Detail
-
server
public okhttp3.mockwebserver.MockWebServer server
-
client
protected C client
-
httpTracing
protected HttpTracing httpTracing
-
extractor
protected brave.propagation.TraceContext.Extractor<okhttp3.mockwebserver.RecordedRequest> extractor
-
-
Method Detail
-
setup
@BeforeEach public void setup() throws IOException
- Throws:
IOException
-
newClient
protected abstract C newClient(int port) throws IOException
Make sure the client you return has retries disabled.- Throws:
IOException
-
closeClient
protected abstract void closeClient(C client) throws IOException
- Throws:
IOException
-
options
protected abstract void options(C client, String path) throws IOException
- Throws:
IOException
-
get
protected abstract void get(C client, String pathIncludingQuery) throws IOException
- Throws:
IOException
-
post
protected abstract void post(C client, String pathIncludingQuery, String body) throws IOException
- Throws:
IOException
-
close
@AfterEach public void close() throws Exception
Closes the client prior to callingITRemote.close()
-
propagatesChildOfCurrentSpan
@Test protected void propagatesChildOfCurrentSpan() throws IOException
- Throws:
IOException
-
propagatesUnsampledContext
@Test protected void propagatesUnsampledContext() throws IOException
Unlike Brave 3, Brave 4 propagates trace ids even when unsampled- Throws:
IOException
-
propagatesBaggage
@Test protected void propagatesBaggage() throws IOException
- Throws:
IOException
-
propagatesBaggage_unsampled
@Test protected void propagatesBaggage_unsampled() throws IOException
- Throws:
IOException
-
customSampler
@Test protected void customSampler() throws IOException
- Throws:
IOException
-
clientTimestampAndDurationEnclosedByParent
@Test protected void clientTimestampAndDurationEnclosedByParent() throws IOException
This prevents confusion as a blocking client should end before, the start of the next span.- Throws:
IOException
-
reportsClientKindToZipkin
@Test protected void reportsClientKindToZipkin() throws IOException
- Throws:
IOException
-
reportsServerAddress
@Test protected void reportsServerAddress() throws IOException
- Throws:
IOException
-
defaultSpanNameIsMethodName
@Test protected void defaultSpanNameIsMethodName() throws IOException
- Throws:
IOException
-
readsRequestAtResponseTime
@Test protected void readsRequestAtResponseTime() throws IOException
- Throws:
IOException
-
supportsPortableCustomization
@Test protected void supportsPortableCustomization() throws IOException
- Throws:
IOException
-
addsStatusCodeWhenNotOk
@Test protected void addsStatusCodeWhenNotOk() throws IOException
- Throws:
IOException
-
redirect
@Test protected void redirect() throws IOException
- Throws:
IOException
-
emptyPath
@Test protected void emptyPath() throws IOException
This tests empty path "" coerces to "/" per RFC 7230 Section 2.7.3- Throws:
IOException
-
options
@Test protected void options() throws IOException
- Throws:
IOException
-
post
@Test protected void post() throws IOException
- Throws:
IOException
-
httpPathTagExcludesQueryParams
@Test protected void httpPathTagExcludesQueryParams() throws IOException
- Throws:
IOException
-
spanHandlerSeesError
@Test protected void spanHandlerSeesError() throws IOException
- Throws:
IOException
-
setsError_onTransportException
@Test protected void setsError_onTransportException()
-
takeRequest
protected okhttp3.mockwebserver.RecordedRequest takeRequest()
Ensures a timeout receiving a request happens before the method timeout
-
extract
protected brave.propagation.TraceContext extract(okhttp3.mockwebserver.RecordedRequest request)
-
-