use of com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext in project pinpoint by pinpoint-apm.
the class DataSourceCodecTest method encodeAndDecodeTest.
@Test
public void encodeAndDecodeTest() {
final String id = "test_app";
final long currentTime = new Date().getTime();
final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec();
final ApplicationStatCodec<JoinDataSourceListBo> dataSourceCodec = new DataSourceCodec(agentStatDataPointCodec);
final List<JoinDataSourceListBo> joinDataSourceListBoList = createJoinDataSourceListBoList(currentTime);
final Buffer encodedValueBuffer = new AutomaticBuffer();
encodedValueBuffer.putByte(dataSourceCodec.getVersion());
dataSourceCodec.encodeValues(encodedValueBuffer, joinDataSourceListBoList);
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(), dataSourceCodec.getVersion());
List<JoinDataSourceListBo> decodedJoinDataSourceListBoList = dataSourceCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinDataSourceListBoList.size(); ++i) {
assertEquals(decodedJoinDataSourceListBoList.get(i), joinDataSourceListBoList.get(i));
}
}
use of com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext 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 ApplicationStatCodec<JoinLoadedClassBo> loadedClassCodec = new LoadedClassCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinLoadedClassBo> 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<JoinLoadedClassBo> 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.server.bo.serializer.stat.ApplicationStatDecodingContext 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 ApplicationStatCodec<JoinMemoryBo> memoryCodec = new MemoryCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinMemoryBo> 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<JoinMemoryBo> 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.server.bo.serializer.stat.ApplicationStatDecodingContext 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<JoinResponseTimeBo> 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<JoinResponseTimeBo> 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.server.bo.serializer.stat.ApplicationStatDecodingContext 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 ApplicationStatCodec<JoinTotalThreadCountBo> totalThreadCountCodec = new TotalThreadCountCodec(agentStatDataPointCodec);
final Buffer encodedValueBuffer = new AutomaticBuffer();
final List<JoinTotalThreadCountBo> 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<JoinTotalThreadCountBo> decodedJoinTotalThreadCountBoList = totalThreadCountCodec.decodeValues(valueBuffer, decodingContext);
for (int i = 0; i < decodedJoinTotalThreadCountBoList.size(); i++) {
assertEquals(decodedJoinTotalThreadCountBoList.get(i), joinTotalThreadCountBoList.get(i));
}
}
Aggregations