use of com.amazonaws.xray.emitters.Emitter in project aws-xray-sdk-java by aws.
the class AWSXRayServletFilterTest method setupAWSXRay.
@Before
public void setupAWSXRay() {
Emitter blankEmitter = Mockito.mock(Emitter.class);
Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject());
Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject());
AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).build());
AWSXRay.clearTraceEntity();
}
use of com.amazonaws.xray.emitters.Emitter in project aws-xray-sdk-java by aws.
the class EntityTest method setupAWSXRay.
@Before
public void setupAWSXRay() {
Emitter blankEmitter = Mockito.mock(Emitter.class);
LocalizedSamplingStrategy defaultSamplingStrategy = new LocalizedSamplingStrategy();
Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject());
Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject());
AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).withSamplingStrategy(defaultSamplingStrategy).build());
AWSXRay.clearTraceEntity();
}
use of com.amazonaws.xray.emitters.Emitter in project aws-xray-sdk-java by aws.
the class AWSXRayRecorderTest method testSegmentEmitted.
@Test
public void testSegmentEmitted() {
Emitter mockEmitter = Mockito.mock(Emitter.class);
AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard().withEmitter(mockEmitter).build();
recorder.beginSegment("test");
recorder.beginSubsegment("test");
recorder.endSubsegment();
recorder.endSegment();
Mockito.verify(mockEmitter, Mockito.times(1)).sendSegment(any());
}
use of com.amazonaws.xray.emitters.Emitter in project aws-xray-sdk-java by aws.
the class AWSXRayRecorderTest method testSubsegmentNotEmittedWithoutExceptionInLambdaInitContext.
@Test
public void testSubsegmentNotEmittedWithoutExceptionInLambdaInitContext() {
PowerMockito.stub(PowerMockito.method(LambdaSegmentContext.class, "getTraceHeaderFromEnvironment")).toReturn(TraceHeader.fromString(null));
PowerMockito.stub(PowerMockito.method(LambdaSegmentContextResolver.class, "getLambdaTaskRoot")).toReturn("/var/task");
Emitter mockEmitter = Mockito.mock(Emitter.class);
AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard().withEmitter(mockEmitter).build();
recorder.createSubsegment("test", () -> {
});
Mockito.verify(mockEmitter, Mockito.times(0)).sendSubsegment(any());
}
use of com.amazonaws.xray.emitters.Emitter in project aws-xray-sdk-java by aws.
the class ConcurrencyTest method setupAWSXRay.
@BeforeEach
void setupAWSXRay() {
Emitter blankEmitter = Mockito.mock(Emitter.class);
LocalizedSamplingStrategy defaultSamplingStrategy = new LocalizedSamplingStrategy();
Mockito.doReturn(true).when(blankEmitter).sendSegment(Mockito.anyObject());
Mockito.doReturn(true).when(blankEmitter).sendSubsegment(Mockito.anyObject());
AWSXRay.setGlobalRecorder(AWSXRayRecorderBuilder.standard().withEmitter(blankEmitter).withSamplingStrategy(defaultSamplingStrategy).build());
AWSXRay.clearTraceEntity();
}
Aggregations