use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class ApplicationMapStatisticsUtilsTest method testMakeColumnName2.
@Test
public void testMakeColumnName2() {
// short serviceType, String applicationName, String destHost, short slotNumber
final short slotNumber = 10;
final byte[] columnNameBytes = ApplicationMapStatisticsUtils.makeColumnName(ServiceType.STAND_ALONE.getCode(), "applicationName", "dest", slotNumber);
Buffer buffer = new FixedBuffer(columnNameBytes);
Assert.assertEquals(ServiceType.STAND_ALONE.getCode(), buffer.readShort());
Assert.assertEquals(10, buffer.readShort());
Assert.assertEquals("applicationName", buffer.read2PrefixedString());
int offset = buffer.getOffset();
byte[] interBuffer = buffer.getInternalBuffer();
Assert.assertEquals(BytesUtils.toString(interBuffer, offset, interBuffer.length - offset), "dest");
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class AnnotationTranscoder method decodeIntStringStringValue.
private Object decodeIntStringStringValue(byte[] data) {
final Buffer buffer = new FixedBuffer(data);
final int intValue = buffer.readSVInt();
final String stringValue1 = BytesUtils.toString(buffer.readPrefixedBytes());
final String stringValue2 = BytesUtils.toString(buffer.readPrefixedBytes());
return new IntStringStringValue(intValue, stringValue1, stringValue2);
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class AnnotationTranscoder method decodeIntStringValue.
private Object decodeIntStringValue(byte[] data) {
final Buffer buffer = new FixedBuffer(data);
final int intValue = buffer.readSVInt();
final String stringValue = BytesUtils.toString(buffer.readPrefixedBytes());
return new IntStringValue(intValue, stringValue);
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer 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.FixedBuffer 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));
}
}
Aggregations