use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer 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();
ActiveTraceCodec activeTraceCodec = new ActiveTraceCodec(new AgentStatDataPointCodec());
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> 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<JoinStatBo> decodedJoinActiveTraceBoList = activeTraceCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinActiveTraceBoList.size(); i++) {
assertEquals(decodedJoinActiveTraceBoList.get(i), joinActiveTraceBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class LoadedClassCountCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final LoadedClassCodec loadedClassCodec = new LoadedClassCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinLoadedClassBoList = createJoinLoadedClassCountBoList(currentTime);
encodedValueBuffer.putByte(loadedClassCodec.getVersion());
loadedClassCodec.encodeValues(encodedValueBuffer, joinLoadedClassBoList);
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(), loadedClassCodec.getVersion());
List<JoinStatBo> decodedJoinLoadedClassBoList = loadedClassCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinLoadedClassBoList.size(); i++) {
assertEquals(decodedJoinLoadedClassBoList.get(i), joinLoadedClassBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class ResponseTimeCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final ResponseTimeCodec responseTimeCodec = new ResponseTimeCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinResponseTimeBoList = createJoinResponseTimeBoList(currentTime);
encodedValueBuffer.putByte(responseTimeCodec.getVersion());
responseTimeCodec.encodeValues(encodedValueBuffer, joinResponseTimeBoList);
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(), responseTimeCodec.getVersion());
List<JoinStatBo> decodedJoinResponseTimeBoList = responseTimeCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinResponseTimeBoList.size(); i++) {
assertEquals(decodedJoinResponseTimeBoList.get(i), joinResponseTimeBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class MemoryCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final MemoryCodec memoryCodec = new MemoryCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinMemoryBoList = createJoinMemoryBoList(currentTime);
encodedValueBuffer.putByte(memoryCodec.getVersion());
memoryCodec.encodeValues(encodedValueBuffer, joinMemoryBoList);
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(), memoryCodec.getVersion());
List<JoinStatBo> decodedJoinMemoryBoList = memoryCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinMemoryBoList.size(); i++) {
assertEquals(decodedJoinMemoryBoList.get(i), joinMemoryBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class TotalThreadCountCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final TotalThreadCountCodec totalThreadCountCodec = new TotalThreadCountCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinStatBo> joinTotalThreadCountBoList = createJoinTotalThreadCountBoList(currentTime);
encodedValueBuffer.putByte(totalThreadCountCodec.getVersion());
totalThreadCountCodec.encodeValues(encodedValueBuffer, joinTotalThreadCountBoList);
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(), totalThreadCountCodec.getVersion());
List<JoinStatBo> decodedJoinTotalThreadCountBoList = totalThreadCountCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinTotalThreadCountBoList.size(); i++) {
assertEquals(decodedJoinTotalThreadCountBoList.get(i), joinTotalThreadCountBoList.get(i));
}
}
Aggregations