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 Cclientprotected brave.propagation.TraceContext.Extractor<okhttp3.mockwebserver.RecordedRequest>extractorprotected HttpTracinghttpTracingokhttp3.mockwebserver.MockWebServerserver-
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 voidaddsStatusCodeWhenNotOk()protected voidclientTimestampAndDurationEnclosedByParent()This prevents confusion as a blocking client should end before, the start of the next span.voidclose()Closes the client prior to callingITRemote.close()protected abstract voidcloseClient(C client)protected voidcustomSampler()protected voiddefaultSpanNameIsMethodName()protected voidemptyPath()This tests empty path "" coerces to "/" per RFC 7230 Section 2.7.3protected brave.propagation.TraceContextextract(okhttp3.mockwebserver.RecordedRequest request)protected abstract voidget(C client, String pathIncludingQuery)protected voidhttpPathTagExcludesQueryParams()protected abstract CnewClient(int port)Make sure the client you return has retries disabled.protected voidoptions()protected abstract voidoptions(C client, String path)protected voidpost()protected abstract voidpost(C client, String pathIncludingQuery, String body)protected voidpropagatesBaggage()protected voidpropagatesBaggage_unsampled()protected voidpropagatesChildOfCurrentSpan()protected voidpropagatesNewTrace()protected voidpropagatesUnsampledContext()Unlike Brave 3, Brave 4 propagates trace ids even when unsampledprotected voidreadsRequestAtResponseTime()protected voidredirect()protected voidreportsClientKindToZipkin()protected voidreportsServerAddress()protected voidsetsError_onTransportException()voidsetup()protected voidspanHandlerSeesError()protected voidsupportsPortableCustomization()protected okhttp3.mockwebserver.RecordedRequesttakeRequest()Ensures a timeout receiving a request happens before the method timeoutprotected Stringurl(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 ExceptionCloses the client prior to callingITRemote.close()
-
propagatesChildOfCurrentSpan
@Test protected void propagatesChildOfCurrentSpan() throws IOException- Throws:
IOException
-
propagatesUnsampledContext
@Test protected void propagatesUnsampledContext() throws IOExceptionUnlike 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 IOExceptionThis 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 IOExceptionThis 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)
-
-