use of com.navercorp.pinpoint.test.ListenableDataSender in project pinpoint by naver.
the class BasePinpointTest method setup.
public void setup(TestContext testContext) {
DefaultApplicationContext mockApplicationContext = testContext.getDefaultApplicationContext();
DataSender<SpanType> spanDataSender = mockApplicationContext.getSpanDataSender();
if (spanDataSender instanceof ListenableDataSender) {
ListenableDataSender<SpanType> listenableDataSender = (ListenableDataSender<SpanType>) spanDataSender;
final TBaseRecorder<SpanType> tBaseRecord = new TBaseRecorder<>();
listenableDataSender.setListener(new ListenableDataSender.Listener<SpanType>() {
@Override
public boolean handleSend(SpanType data) {
return tBaseRecord.add(data);
}
});
setTBaseRecorder(tBaseRecord);
}
ServerMetaDataRegistryService serverMetaDataRegistryService = mockApplicationContext.getServerMetaDataRegistryService();
this.setServerMetaDataRegistryService(serverMetaDataRegistryService);
}
use of com.navercorp.pinpoint.test.ListenableDataSender in project pinpoint by naver.
the class AgentStatMonitorTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(agentStatCollector.collect()).thenReturn(new AgentStatMetricSnapshot());
this.tBaseRecorder = new TBaseRecorder<>();
ListenableDataSender.Listener<? extends MetricType> recorderAdaptor = new TBaseRecorderAdaptor<>(tBaseRecorder);
ListenableDataSender<MetricType> listenableDataSender = new ListenableDataSender<>("testDataSender");
listenableDataSender.setListener((ListenableDataSender.Listener<MetricType>) recorderAdaptor);
this.dataSender = listenableDataSender;
}
Aggregations