Search in sources :

Example 1 with TBaseRecorder

use of com.navercorp.pinpoint.test.TBaseRecorder in project pinpoint by naver.

the class BasePinpointTest method setup.

public void setup(TestContext testContext) {
    MockApplicationContext mockApplicationContext = testContext.getMockApplicationContext();
    DataSender spanDataSender = mockApplicationContext.getSpanDataSender();
    if (spanDataSender instanceof ListenableDataSender) {
        ListenableDataSender listenableDataSender = (ListenableDataSender) spanDataSender;
        final TBaseRecorder tBaseRecord = new TBaseRecorder();
        listenableDataSender.setListener(new ListenableDataSender.Listener() {

            @Override
            public boolean handleSend(TBase<?, ?> data) {
                return tBaseRecord.add(data);
            }
        });
        setTBaseRecorder(tBaseRecord);
    }
    ServerMetaDataHolder serverMetaDataHolder = mockApplicationContext.getTraceContext().getServerMetaDataHolder();
    if (serverMetaDataHolder instanceof ResettableServerMetaDataHolder) {
        ResettableServerMetaDataHolder resettableServerMetaDataHolder = (ResettableServerMetaDataHolder) serverMetaDataHolder;
        this.setServerMetaDataHolder(resettableServerMetaDataHolder);
    }
    this.serverMetaDataHolder.addListener(this.listener);
}
Also used : ResettableServerMetaDataHolder(com.navercorp.pinpoint.test.ResettableServerMetaDataHolder) TBaseRecorder(com.navercorp.pinpoint.test.TBaseRecorder) ListenableDataSender(com.navercorp.pinpoint.test.ListenableDataSender) DataSender(com.navercorp.pinpoint.profiler.sender.DataSender) ResettableServerMetaDataHolder(com.navercorp.pinpoint.test.ResettableServerMetaDataHolder) ServerMetaDataHolder(com.navercorp.pinpoint.bootstrap.context.ServerMetaDataHolder) ListenableDataSender(com.navercorp.pinpoint.test.ListenableDataSender) MockApplicationContext(com.navercorp.pinpoint.test.MockApplicationContext)

Aggregations

ServerMetaDataHolder (com.navercorp.pinpoint.bootstrap.context.ServerMetaDataHolder)1 DataSender (com.navercorp.pinpoint.profiler.sender.DataSender)1 ListenableDataSender (com.navercorp.pinpoint.test.ListenableDataSender)1 MockApplicationContext (com.navercorp.pinpoint.test.MockApplicationContext)1 ResettableServerMetaDataHolder (com.navercorp.pinpoint.test.ResettableServerMetaDataHolder)1 TBaseRecorder (com.navercorp.pinpoint.test.TBaseRecorder)1