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);
}
Aggregations