use of com.navercorp.pinpoint.profiler.context.DefaultServerMetaData in project pinpoint by naver.
the class AgentInfoSenderTest method serverMetaDataShouldBeSentOnPublish.
@Test
public void serverMetaDataShouldBeSentOnPublish() throws InterruptedException {
// Given
final AtomicInteger requestCount = new AtomicInteger();
final AtomicInteger successCount = new AtomicInteger();
final long agentInfoSendRetryIntervalMs = 1000L;
ResponseServerMessageListener serverListener = new ResponseServerMessageListener(requestCount, successCount);
PinpointServerAcceptor serverAcceptor = createServerAcceptor(serverListener);
PinpointClientFactory clientFactory = createPinpointClientFactory();
PinpointClient pinpointClient = ClientFactoryUtils.createPinpointClient(HOST, PORT, clientFactory);
TcpDataSender dataSender = new TcpDataSender(pinpointClient);
AgentInfoSender agentInfoSender = new AgentInfoSender.Builder(dataSender, getAgentInfo()).sendInterval(agentInfoSendRetryIntervalMs).build();
final List<ServerMetaData> serverMetaDataObjects = new ArrayList<ServerMetaData>();
serverMetaDataObjects.add(new DefaultServerMetaData("server1", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
serverMetaDataObjects.add(new DefaultServerMetaData("server2", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
serverMetaDataObjects.add(new DefaultServerMetaData("server3", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
serverMetaDataObjects.add(new DefaultServerMetaData("server4", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
serverMetaDataObjects.add(new DefaultServerMetaData("server5", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
// When
try {
for (ServerMetaData serverMetaData : serverMetaDataObjects) {
agentInfoSender.publishServerMetaData(serverMetaData);
}
waitExpectedRequestCount(requestCount, 5);
} finally {
closeAll(serverAcceptor, agentInfoSender, pinpointClient, clientFactory);
}
// Then
assertEquals(5, requestCount.get());
assertEquals(5, successCount.get());
}
use of com.navercorp.pinpoint.profiler.context.DefaultServerMetaData in project pinpoint by naver.
the class AgentGrpcDataSenderTestMain method newAgentInfo.
private AgentInfo newAgentInfo() {
AgentInformation agentInformation = new DefaultAgentInformation(AGENT_ID, AGENT_NAME, APPLICATION_NAME, true, START_TIME, 99, "", "", ServiceType.TEST_STAND_ALONE, "1.0", "1.0");
JvmInformation jvmInformation = new JvmInformation("1.0", JvmGcType.G1);
ServerMetaData serverInfo = new DefaultServerMetaData("serverInfo", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList());
return new AgentInfo(agentInformation, serverInfo, jvmInformation);
}
Aggregations