use of com.amazonaws.xray.entities.SegmentImpl in project aws-xray-sdk-java by aws.
the class EntityTest method testAllSubsegmentImplMutationMethodsThrowAlreadyEmittedExceptions.
@Test
public void testAllSubsegmentImplMutationMethodsThrowAlreadyEmittedExceptions() {
SegmentImpl segment = new SegmentImpl(AWSXRay.getGlobalRecorder(), "test");
segment.getName();
SubsegmentImpl subsegment = new SubsegmentImpl(AWSXRay.getGlobalRecorder(), "test", segment);
MutatingMethodCount mutationResults = numberOfMutatingMethodsThatThrewException(subsegment, SubsegmentImpl.class);
Assert.assertEquals(0, mutationResults.getMutatingMethodsThrowingExceptions());
// the mutating methods set this to null...
subsegment.setParentSegment(segment);
segment.end();
subsegment.end();
mutationResults = numberOfMutatingMethodsThatThrewException(subsegment, SubsegmentImpl.class);
Assert.assertEquals(mutationResults.getMutatingMethods(), mutationResults.getMutatingMethodsThrowingExceptions());
}
use of com.amazonaws.xray.entities.SegmentImpl in project aws-xray-sdk-java by aws.
the class EntityTest method testInProgressSegment.
@Test
public void testInProgressSegment() throws JSONException {
String segmentId = Entity.generateId();
TraceID traceId = new TraceID();
Segment segment = new SegmentImpl(AWSXRay.getGlobalRecorder(), "test", traceId);
segment.setId(segmentId);
segment.setStartTime(1.0);
String expected = expectedInProgressSegment(traceId, segmentId, segment.getStartTime()).toString();
JSONAssert.assertEquals(expected, segment.serialize(), JSONCompareMode.NON_EXTENSIBLE);
}
use of com.amazonaws.xray.entities.SegmentImpl in project aws-xray-sdk-java by aws.
the class EntityTest method testEndingSubsegmentImplTwiceThrowsAlreadyEmittedException.
@Test(expected = AlreadyEmittedException.class)
public void testEndingSubsegmentImplTwiceThrowsAlreadyEmittedException() {
SegmentImpl segment = new SegmentImpl(AWSXRay.getGlobalRecorder(), "test");
segment.getName();
SubsegmentImpl subsegment = new SubsegmentImpl(AWSXRay.getGlobalRecorder(), "test", segment);
segment.end();
subsegment.end();
subsegment.end();
}
use of com.amazonaws.xray.entities.SegmentImpl in project aws-xray-sdk-java by aws.
the class EntityTest method testModifyingSegmentAfterEndingThrowsAlreadyEmittedException.
@SuppressWarnings("resource")
@Test(expected = AlreadyEmittedException.class)
public void testModifyingSegmentAfterEndingThrowsAlreadyEmittedException() {
TraceID traceId = new TraceID();
Segment segment = new SegmentImpl(AWSXRay.getGlobalRecorder(), "test", traceId);
segment.end();
segment.setStartTime(1.0);
}
Aggregations