use of com.navercorp.pinpoint.collector.receiver.thrift.TCPReceiverBean in project pinpoint by naver.
the class DataReceiverGroupTest method receiverGroupTest1.
@Test
public void receiverGroupTest1() throws Exception {
DataReceiverGroupConfiguration mockConfig = createMockConfig(true, true);
TestDispatchHandler dispatchHandler = new TestDispatchHandler(2, 1);
UDPReceiverBean udpReceiverBean = createUdpReceiverBean(mockConfig, dispatchHandler);
TCPReceiverBean tcpReceiverBean = createTcpReceiverBean(mockConfig, dispatchHandler);
DataSender<TBase<?, ?>> udpDataSender = null;
TcpDataSender<TBase<?, ?>> tcpDataSender = null;
PinpointClientFactory pinpointClientFactory = null;
try {
udpReceiverBean.afterPropertiesSet();
tcpReceiverBean.afterPropertiesSet();
udpDataSender = newUdpDataSender(mockConfig);
pinpointClientFactory = createPinpointClientFactory();
tcpDataSender = new TcpDataSender<>(this.getClass().getName(), "127.0.0.1", mockConfig.getTcpBindPort(), pinpointClientFactory);
udpDataSender.send(new TResult());
tcpDataSender.send(new TResult());
tcpDataSender.request(new TResult());
Assert.assertTrue(tcpDataSender.isConnected());
Assert.assertTrue(dispatchHandler.getSendLatch().await(1000, TimeUnit.MILLISECONDS));
Assert.assertTrue(dispatchHandler.getRequestLatch().await(1000, TimeUnit.MILLISECONDS));
} finally {
closeDataSender(udpDataSender);
closeDataSender(tcpDataSender);
closeClientFactory(pinpointClientFactory);
closeBean(udpReceiverBean);
closeBean(tcpReceiverBean);
}
}
use of com.navercorp.pinpoint.collector.receiver.thrift.TCPReceiverBean in project pinpoint by naver.
the class DataReceiverGroupTest method receiverGroupTest2.
@Test
public void receiverGroupTest2() throws Exception {
DataReceiverGroupConfiguration mockConfig = createMockConfig(true, false);
TestDispatchHandler testDispatchHandler = new TestDispatchHandler(1, 1);
TCPReceiverBean receiver = createTcpReceiverBean(mockConfig, testDispatchHandler);
DataSender<TBase<?, ?>> udpDataSender = null;
TcpDataSender<TBase<?, ?>> tcpDataSender = null;
PinpointClientFactory pinpointClientFactory = null;
try {
receiver.afterPropertiesSet();
udpDataSender = newUdpDataSender(mockConfig);
udpDataSender.send(new TResult());
Assert.assertFalse(testDispatchHandler.getSendLatch().await(1000, TimeUnit.MILLISECONDS));
pinpointClientFactory = createPinpointClientFactory();
tcpDataSender = new TcpDataSender<>(this.getClass().getName(), "127.0.0.1", mockConfig.getTcpBindPort(), pinpointClientFactory);
Assert.assertTrue(tcpDataSender.isConnected());
tcpDataSender.send(new TResult());
tcpDataSender.request(new TResult());
Assert.assertTrue(testDispatchHandler.getSendLatch().await(1000, TimeUnit.MILLISECONDS));
Assert.assertTrue(testDispatchHandler.getRequestLatch().await(1000, TimeUnit.MILLISECONDS));
} finally {
closeDataSender(udpDataSender);
closeDataSender(tcpDataSender);
closeClientFactory(pinpointClientFactory);
closeBean(receiver);
}
}
use of com.navercorp.pinpoint.collector.receiver.thrift.TCPReceiverBean in project pinpoint by naver.
the class DataReceiverGroupTest method createTcpReceiverBean.
private TCPReceiverBean createTcpReceiverBean(DataReceiverGroupConfiguration mockConfig, DispatchHandler<TBase<?, ?>, TBase<?, ?>> dispatchHandler) {
TCPReceiverBean tcpReceiverBean = new TCPReceiverBean();
tcpReceiverBean.setBeanName("tcpReceiver");
tcpReceiverBean.setBindIp(mockConfig.getTcpBindIp());
tcpReceiverBean.setBindPort(mockConfig.getTcpBindPort());
tcpReceiverBean.setAcceptorProvider(createPinpointAcceptorProvider());
tcpReceiverBean.setDispatchHandler(dispatchHandler);
tcpReceiverBean.setExecutor(MoreExecutors.directExecutor());
tcpReceiverBean.setEnable(true);
return tcpReceiverBean;
}
Aggregations