Search in sources :

Example 1 with ExecutionAttributes

use of software.amazon.awssdk.core.interceptor.ExecutionAttributes in project aws-xray-sdk-java by aws.

the class TracingInterceptorTest method testNoHeaderAddedWhenPropagationOff.

@Test
public void testNoHeaderAddedWhenPropagationOff() {
    Subsegment subsegment = Subsegment.noOp(AWSXRay.getGlobalRecorder(), false);
    TracingInterceptor interceptor = new TracingInterceptor();
    Context.ModifyHttpRequest context = Mockito.mock(Context.ModifyHttpRequest.class);
    SdkHttpRequest mockRequest = Mockito.mock(SdkHttpRequest.class);
    SdkHttpRequest.Builder mockRequestBuilder = Mockito.mock(SdkHttpRequest.Builder.class);
    when(context.httpRequest()).thenReturn(mockRequest);
    Mockito.lenient().when(context.httpRequest().toBuilder()).thenReturn(mockRequestBuilder);
    ExecutionAttributes attributes = new ExecutionAttributes();
    attributes.putAttribute(TracingInterceptor.entityKey, subsegment);
    interceptor.modifyHttpRequest(context, attributes);
    verify(mockRequest.toBuilder(), never()).appendHeader(anyString(), anyString());
}
Also used : Context(software.amazon.awssdk.core.interceptor.Context) SdkHttpRequest(software.amazon.awssdk.http.SdkHttpRequest) ExecutionAttributes(software.amazon.awssdk.core.interceptor.ExecutionAttributes) Subsegment(com.amazonaws.xray.entities.Subsegment) Test(org.junit.Test)

Aggregations

Subsegment (com.amazonaws.xray.entities.Subsegment)1 Test (org.junit.Test)1 Context (software.amazon.awssdk.core.interceptor.Context)1 ExecutionAttributes (software.amazon.awssdk.core.interceptor.ExecutionAttributes)1 SdkHttpRequest (software.amazon.awssdk.http.SdkHttpRequest)1