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 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, globalTimeout, propagationFactory, testName, testSpanHandler, tracing
-
-
Constructor Summary
Constructors Constructor Description ITHttpClient()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addsStatusCodeWhenNotOk()
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)
void
customSampler()
void
defaultSpanNameIsMethodName()
void
emptyPath()
This tests empty path "" coerces to "/" per RFC 7230 Section 2.7.3protected TraceContext
extract(okhttp3.mockwebserver.RecordedRequest request)
protected abstract void
get(C client, String pathIncludingQuery)
void
httpPathTagExcludesQueryParams()
protected abstract C
newClient(int port)
Make sure the client you return has retries disabled.void
options()
protected abstract void
options(C client, String path)
void
post()
protected abstract void
post(C client, String pathIncludingQuery, String body)
void
propagatesBaggage()
void
propagatesBaggage_unsampled()
void
propagatesChildOfCurrentSpan()
void
propagatesNewTrace()
void
propagatesUnsampledContext()
Unlike Brave 3, Brave 4 propagates trace ids even when unsampledvoid
readsRequestAtResponseTime()
void
redirect()
void
reportsClientKindToZipkin()
void
reportsServerAddress()
void
setsError_onTransportException()
void
setup()
void
spanHandlerSeesError()
void
supportsDeprecatedPortableCustomization()
Deprecated.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 TraceContext.Extractor<okhttp3.mockwebserver.RecordedRequest> extractor
-
-
Method Detail
-
setup
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
public void close() throws Exception
Closes the client prior to callingITRemote.close()
-
propagatesChildOfCurrentSpan
public void propagatesChildOfCurrentSpan() throws IOException
- Throws:
IOException
-
propagatesUnsampledContext
public void propagatesUnsampledContext() throws IOException
Unlike Brave 3, Brave 4 propagates trace ids even when unsampled- Throws:
IOException
-
propagatesBaggage
public void propagatesBaggage() throws IOException
- Throws:
IOException
-
propagatesBaggage_unsampled
public void propagatesBaggage_unsampled() throws IOException
- Throws:
IOException
-
customSampler
public void customSampler() throws IOException
- Throws:
IOException
-
clientTimestampAndDurationEnclosedByParent
public void clientTimestampAndDurationEnclosedByParent() throws IOException
This prevents confusion as a blocking client should end before, the start of the next span.- Throws:
IOException
-
reportsClientKindToZipkin
public void reportsClientKindToZipkin() throws IOException
- Throws:
IOException
-
reportsServerAddress
public void reportsServerAddress() throws IOException
- Throws:
IOException
-
defaultSpanNameIsMethodName
public void defaultSpanNameIsMethodName() throws IOException
- Throws:
IOException
-
readsRequestAtResponseTime
public void readsRequestAtResponseTime() throws IOException
- Throws:
IOException
-
supportsPortableCustomization
public void supportsPortableCustomization() throws IOException
- Throws:
IOException
-
supportsDeprecatedPortableCustomization
@Deprecated public void supportsDeprecatedPortableCustomization() throws IOException
Deprecated.- Throws:
IOException
-
addsStatusCodeWhenNotOk
public void addsStatusCodeWhenNotOk() throws IOException
- Throws:
IOException
-
redirect
public void redirect() throws IOException
- Throws:
IOException
-
emptyPath
public void emptyPath() throws IOException
This tests empty path "" coerces to "/" per RFC 7230 Section 2.7.3- Throws:
IOException
-
options
public void options() throws IOException
- Throws:
IOException
-
post
public void post() throws IOException
- Throws:
IOException
-
httpPathTagExcludesQueryParams
public void httpPathTagExcludesQueryParams() throws IOException
- Throws:
IOException
-
spanHandlerSeesError
public void spanHandlerSeesError() throws IOException
- Throws:
IOException
-
setsError_onTransportException
public void setsError_onTransportException()
-
takeRequest
protected okhttp3.mockwebserver.RecordedRequest takeRequest()
Ensures a timeout receiving a request happens before the method timeout
-
extract
protected TraceContext extract(okhttp3.mockwebserver.RecordedRequest request)
-
-