use of com.navercorp.pinpoint.thrift.dto.TAgentInfo in project pinpoint by naver.
the class HeaderTBaseSerializerTest method test.
private void test(HeaderTBaseSerializer serializer, HeaderTBaseDeserializer deserializer) throws TException {
Header header = new Header();
// 10 is JVMInfoThriftDTO type
header.setType((short) 10);
TAgentInfo tAgentInfo = new TAgentInfo();
tAgentInfo.setAgentId("agentId");
tAgentInfo.setHostname("host");
tAgentInfo.setApplicationName("applicationName");
byte[] serialize = serializer.serialize(tAgentInfo);
dump(serialize);
TAgentInfo deserialize = (TAgentInfo) deserializer.deserialize(serialize);
logger.debug("deserializer:{}", deserialize.getClass());
Assert.assertEquals(deserialize, tAgentInfo);
}
use of com.navercorp.pinpoint.thrift.dto.TAgentInfo in project pinpoint by naver.
the class UdpDataSenderTest method sendAndFlushCheck.
@Test
public void sendAndFlushCheck() throws InterruptedException {
UdpDataSender sender = new UdpDataSender("localhost", PORT, "test", 128, 1000, 1024 * 64 * 100);
TAgentInfo agentInfo = new TAgentInfo();
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.send(agentInfo);
sender.stop();
}
use of com.navercorp.pinpoint.thrift.dto.TAgentInfo in project pinpoint by naver.
the class UdpDataSenderTest method sendExceedData.
// @Test
// public void sendAndLarge() throws InterruptedException {
// String random = RandomStringUtils.randomAlphabetic(UdpDataSender.UDP_MAX_PACKET_LENGTH);
// TAgentInfo agentInfo = new TAgentInfo();
// agentInfo.setAgentId(random);
// boolean limit = sendMessage_getLimit(agentInfo, 5000);
// Assert.assertTrue("limit overflow",limit);
//
// boolean noLimit = sendMessage_getLimit(new TAgentInfo(), 5000);
// Assert.assertFalse("success", noLimit);
// }
@Test
public void sendExceedData() throws InterruptedException {
String random = RandomStringUtils.randomAlphabetic(UdpDataSender.UDP_MAX_PACKET_LENGTH + 100);
TAgentInfo agentInfo = new TAgentInfo();
agentInfo.setAgentId(random);
boolean limit = sendMessage_getLimit(agentInfo, 1000);
// do not execute.
Assert.assertFalse(limit);
}
use of com.navercorp.pinpoint.thrift.dto.TAgentInfo in project pinpoint by naver.
the class AgentInfoHandler method handleRequest.
@Override
public TBase<?, ?> handleRequest(TBase<?, ?> tbase) {
if (!(tbase instanceof TAgentInfo)) {
logger.warn("invalid tbase:{}", tbase);
return null;
}
try {
TAgentInfo agentInfo = (TAgentInfo) tbase;
logger.debug("Received AgentInfo={}", agentInfo);
// agent info
agentInfoDao.insert(agentInfo);
// for querying agentid using applicationname
applicationIndexDao.insert(agentInfo);
return new TResult(true);
// for querying applicationname using agentid
// agentIdApplicationIndexDao.insert(agentInfo.getAgentId(), agentInfo.getApplicationName());
} catch (Exception e) {
logger.warn("AgentInfo handle error. Caused:{}", e.getMessage(), e);
TResult result = new TResult(false);
result.setMessage(e.getMessage());
return result;
}
}
use of com.navercorp.pinpoint.thrift.dto.TAgentInfo in project pinpoint by naver.
the class AgentStatHandlerV2Test method handleShouldThrowIllegalArgumentExceptionForIncorrectTBaseObjects.
@Test(expected = IllegalArgumentException.class)
public void handleShouldThrowIllegalArgumentExceptionForIncorrectTBaseObjects() {
// Given
final TAgentInfo wrongTBaseObject = new TAgentInfo();
// When
agentStatHandler.handle(wrongTBaseObject);
// Then
fail();
}
Aggregations