use of com.navercorp.pinpoint.profiler.context.DefaultAsyncId in project pinpoint by naver.
the class SpanThriftMessageConverterTest method buildTSpanEvent.
@Test
public void buildTSpanEvent() {
final long startTime = System.currentTimeMillis() - 100;
SpanEvent spanEvent = new SpanEvent();
spanEvent.setDepth(RandomExUtils.nextInt(0, 100));
spanEvent.setStartTime(startTime + RandomExUtils.nextInt(0, 100));
spanEvent.setAfterTime(spanEvent.getStartTime() + RandomExUtils.nextInt(5, 100));
spanEvent.setDestinationId("destinationId");
spanEvent.setSequence(RandomExUtils.nextInt(0, 100));
spanEvent.setNextSpanId(RandomExUtils.nextInt(0, 100));
spanEvent.setAsyncIdObject(new DefaultAsyncId(RandomExUtils.nextInt(0, 100)));
spanEvent.addAnnotation(Annotations.of(1));
TSpanEvent tSpanEvent = messageConverter.buildTSpanEvent(spanEvent);
spanPostProcessor.postEventProcess(Collections.singletonList(spanEvent), Collections.singletonList(tSpanEvent), startTime);
Assert.assertEquals(spanEvent.getDepth(), tSpanEvent.getDepth());
Assert.assertEquals(spanEvent.getStartTime(), startTime + tSpanEvent.getStartElapsed());
Assert.assertEquals(spanEvent.getAfterTime(), startTime + tSpanEvent.getStartElapsed() + tSpanEvent.getEndElapsed());
Assert.assertEquals(spanEvent.getDestinationId(), tSpanEvent.getDestinationId());
Assert.assertEquals(spanEvent.getSequence(), tSpanEvent.getSequence());
Assert.assertEquals(spanEvent.getNextSpanId(), tSpanEvent.getNextSpanId());
Assert.assertEquals(spanEvent.getAsyncIdObject().getAsyncId(), tSpanEvent.getNextAsyncId());
Assert.assertEquals(spanEvent.getAnnotations().size(), tSpanEvent.getAnnotations().size());
}
Aggregations