use of com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext in project pinpoint by naver.
the class TransactionCodecTest method encodeValuesTest.
@Test
public void encodeValuesTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
ApplicationStatCodec<JoinTransactionBo> transactionCodec = new TransactionCodec(new AgentStatDataPointCodec());
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinTransactionBo> joinTransactionBoList = createJoinTransactionBoList(currentTime);
encodedValueBuffer.putByte(transactionCodec.getVersion());
transactionCodec.encodeValues(encodedValueBuffer, joinTransactionBoList);
final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer());
final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime);
final long timestampDelta = currentTime - baseTimestamp;
final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext();
decodingContext.setApplicationId(id);
decodingContext.setBaseTimestamp(baseTimestamp);
decodingContext.setTimestampDelta(timestampDelta);
assertEquals(valueBuffer.readByte(), transactionCodec.getVersion());
List<JoinTransactionBo> decodedJoinTransactionBoList = transactionCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinTransactionBoList.size(); i++) {
assertEquals(decodedJoinTransactionBoList.get(i), joinTransactionBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext in project pinpoint by naver.
the class ActiveTraceCodecTest method encodeValuesTest.
@Test
public void encodeValuesTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
ApplicationStatCodec<JoinActiveTraceBo> activeTraceCodec = new ActiveTraceCodec(new AgentStatDataPointCodec());
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinActiveTraceBo> joinActiveTraceBoList = createJoinActiveTRaceBoList(currentTime);
encodedValueBuffer.putByte(activeTraceCodec.getVersion());
activeTraceCodec.encodeValues(encodedValueBuffer, joinActiveTraceBoList);
final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer());
final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime);
final long timestampDelta = currentTime - baseTimestamp;
final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext();
decodingContext.setApplicationId(id);
decodingContext.setBaseTimestamp(baseTimestamp);
decodingContext.setTimestampDelta(timestampDelta);
assertEquals(valueBuffer.readByte(), activeTraceCodec.getVersion());
List<JoinActiveTraceBo> decodedJoinActiveTraceBoList = activeTraceCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinActiveTraceBoList.size(); i++) {
assertEquals(decodedJoinActiveTraceBoList.get(i), joinActiveTraceBoList.get(i));
}
}
Aggregations