use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo 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.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class TotalThreadCountCodecTest method createJoinTotalThreadCountBoList.
private List<JoinStatBo> createJoinTotalThreadCountBoList(long currentTime) {
final String id = "test_app";
final List<JoinStatBo> joinTotalThreadCountBoList = new ArrayList<>();
JoinTotalThreadCountBo joinTotalThreadCountBo1 = new JoinTotalThreadCountBo(id, currentTime, 80, 1000, "agent1_1", 30, "agent1_2");
JoinTotalThreadCountBo joinTotalThreadCountBo2 = new JoinTotalThreadCountBo(id, currentTime + 5000, 70, 900, "agent2_1", 20, "agent2_2");
JoinTotalThreadCountBo joinTotalThreadCountBo3 = new JoinTotalThreadCountBo(id, currentTime + 15000, 60, 800, "agent4_1", 15, "agent4_2");
JoinTotalThreadCountBo joinTotalThreadCountBo4 = new JoinTotalThreadCountBo(id, currentTime + 10000, 50, 700, "agent3_1", 10, "agent3_2");
JoinTotalThreadCountBo joinTotalThreadCountBo5 = new JoinTotalThreadCountBo(id, currentTime + 20000, 40, 600, "agent5_1", 5, "agent5_2");
joinTotalThreadCountBoList.add(joinTotalThreadCountBo1);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo2);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo3);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo4);
joinTotalThreadCountBoList.add(joinTotalThreadCountBo5);
return joinTotalThreadCountBoList;
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo 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));
}
}
use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo 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.server.bo.stat.join.JoinStatBo in project pinpoint by naver.
the class DataSourceCodecTest method createJoinDataSourceListBoList.
private List<JoinStatBo> createJoinDataSourceListBoList(long currentTime) {
final String id = "test_app";
List<JoinStatBo> joinDataSourceListBoList = new ArrayList<>();
JoinDataSourceListBo joinDataSourceListBo1 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(10), currentTime);
JoinDataSourceListBo joinDataSourceListBo2 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(20), currentTime + 5000);
JoinDataSourceListBo joinDataSourceListBo3 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(30), currentTime + 10000);
JoinDataSourceListBo joinDataSourceListBo4 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(40), currentTime + 15000);
JoinDataSourceListBo joinDataSourceListBo5 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(50), currentTime + 20000);
joinDataSourceListBoList.add(joinDataSourceListBo1);
joinDataSourceListBoList.add(joinDataSourceListBo2);
joinDataSourceListBoList.add(joinDataSourceListBo3);
joinDataSourceListBoList.add(joinDataSourceListBo4);
joinDataSourceListBoList.add(joinDataSourceListBo5);
return joinDataSourceListBoList;
}
Aggregations