Package brave.test.http
Class ITHttpAsyncClient<C>
java.lang.Object
brave.test.ITRemote
brave.test.http.ITHttpClient<C>
brave.test.http.ITHttpAsyncClient<C>
public abstract class ITHttpAsyncClient<C> extends ITHttpClient<C>
-
Field Summary
Fields inherited from class brave.test.ITRemote
BAGGAGE_FIELD, BAGGAGE_FIELD_KEY, currentTraceContext, globalTimeout, propagationFactory, testName, testSpanHandler, tracing
-
Constructor Summary
Constructors Constructor Description ITHttpAsyncClient()
-
Method Summary
Modifier and Type Method Description void
addsStatusCodeWhenNotOk_async()
void
callbackContextIsFromInvocationTime()
This ensures that response callbacks run in the invocation context, not the client one.void
callbackContextIsFromInvocationTime_root()
This ensures that response callbacks run when there is no invocation trace context.protected abstract void
get(C client, String path, BiConsumer<Integer,Throwable> callback)
This invokes a GET with the indicated path, but does not block until the response is complete.void
usesParentFromInvocationTime()
This tests that the parent is determined at the time the request was made, not when the request was executed.Methods inherited from class brave.test.http.ITHttpClient
addsStatusCodeWhenNotOk, clientTimestampAndDurationEnclosedByParent, close, closeClient, customSampler, defaultSpanNameIsMethodName, emptyPath, extract, get, httpPathTagExcludesQueryParams, newClient, options, options, post, post, propagatesBaggage, propagatesBaggage_unsampled, propagatesChildOfCurrentSpan, propagatesNewTrace, propagatesUnsampledContext, readsRequestAtResponseTime, redirect, reportsClientKindToZipkin, reportsServerAddress, setsError_onTransportException, setup, spanHandlerSeesError, supportsDeprecatedPortableCustomization, supportsPortableCustomization, takeRequest, url
Methods inherited from class brave.test.ITRemote
assertChildOf, assertChildOf, assertChildOf, assertNoError, assertNoErrorTag, assertSameIds, assertSequential, assertSpanInInterval, checkForLeakedScopes, currentTraceContextBuilder, newTraceContext, tracingBuilder
-
Constructor Details
-
ITHttpAsyncClient
public ITHttpAsyncClient()
-
-
Method Details
-
get
This invokes a GET with the indicated path, but does not block until the response is complete.The success callback should always be invoked with the HTTP status code. If the implementation coerces a 500 code without an exception as an error, you should call the success callback directly.
Invoke the callback with one of success or failure even in unexpected scenarios. For example, if there is a cancelation that didn't result in an error, invoke
BiConsumer.accept(Object, Object)
with your ownCancellationException
.- Parameters:
callback
- accepts the status code or the error invoking the request
-
usesParentFromInvocationTime
public void usesParentFromInvocationTime()This tests that the parent is determined at the time the request was made, not when the request was executed. -
callbackContextIsFromInvocationTime
public void callbackContextIsFromInvocationTime()This ensures that response callbacks run in the invocation context, not the client one. This allows async chaining to appear caused by the parent, not by the most recent client. Otherwise, we would see a client span child of a client span, which could be confused with duplicate instrumentation and affect dependency link counts. -
callbackContextIsFromInvocationTime_root
public void callbackContextIsFromInvocationTime_root()This ensures that response callbacks run when there is no invocation trace context. -
addsStatusCodeWhenNotOk_async
public void addsStatusCodeWhenNotOk_async()
-