Search in sources :

Example 1 with ListenableDataSender

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);
}
Also used : DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) SpanType(com.navercorp.pinpoint.profiler.context.SpanType) TBaseRecorder(com.navercorp.pinpoint.test.TBaseRecorder) ServerMetaDataRegistryService(com.navercorp.pinpoint.profiler.context.ServerMetaDataRegistryService) ListenableDataSender(com.navercorp.pinpoint.test.ListenableDataSender)

Example 2 with ListenableDataSender

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;
}
Also used : AgentStatMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot) TBaseRecorderAdaptor(com.navercorp.pinpoint.test.TBaseRecorderAdaptor) MetricType(com.navercorp.pinpoint.profiler.monitor.metric.MetricType) ListenableDataSender(com.navercorp.pinpoint.test.ListenableDataSender) Before(org.junit.Before)

Aggregations

ListenableDataSender (com.navercorp.pinpoint.test.ListenableDataSender)2 ServerMetaDataRegistryService (com.navercorp.pinpoint.profiler.context.ServerMetaDataRegistryService)1 SpanType (com.navercorp.pinpoint.profiler.context.SpanType)1 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)1 AgentStatMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot)1 MetricType (com.navercorp.pinpoint.profiler.monitor.metric.MetricType)1 TBaseRecorder (com.navercorp.pinpoint.test.TBaseRecorder)1 TBaseRecorderAdaptor (com.navercorp.pinpoint.test.TBaseRecorderAdaptor)1 Before (org.junit.Before)1