use of com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory in project pinpoint by naver.
the class SpanStreamSendDataSerializerTest method spanStreamSendDataSerializerTest2.
@Test
public void spanStreamSendDataSerializerTest2() throws InterruptedException, TException {
int spanEventSize = 10;
SpanStreamSendDataSerializer serializer = new SpanStreamSendDataSerializer();
HeaderTBaseSerializerFactory factory = new HeaderTBaseSerializerFactory();
Span span = createSpan(createSpanEventList(spanEventSize));
PartitionedByteBufferLocator partitionedByteBufferLocator = serializer.serializeSpanStream(factory.createSerializer(), span);
Assert.assertEquals(spanEventSize + 1, partitionedByteBufferLocator.getPartitionedCount());
HeaderTBaseDeserializer deserializer = new HeaderTBaseDeserializerFactory().createDeserializer();
for (int i = 0; i < partitionedByteBufferLocator.getPartitionedCount(); i++) {
ByteBuffer byteBuffer = partitionedByteBufferLocator.getByteBuffer(i);
byte[] readBuffer = new byte[byteBuffer.remaining()];
byteBuffer.get(readBuffer);
Object o = deserializer.deserialize(readBuffer);
if (o == null) {
Assert.fail();
}
if (i < spanEventSize) {
Assert.assertTrue(o instanceof TSpanEvent);
} else {
Assert.assertTrue(o instanceof TSpan);
}
}
}
Aggregations