Search in sources :

Example 1 with MockApplicationContext

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

the class JavassistClassTest method getTestClassLoader.

private TestClassLoader getTestClassLoader() {
    PLoggerFactory.initialize(new Slf4jLoggerBinder());
    DefaultProfilerConfig profilerConfig = new DefaultProfilerConfig();
    profilerConfig.setApplicationServerType(ServiceType.TEST_STAND_ALONE.getName());
    MockApplicationContext applicationContext = MockApplicationContext.of(profilerConfig);
    TestClassLoader testClassLoader = new TestClassLoader(applicationContext);
    testClassLoader.initialize();
    return testClassLoader;
}
Also used : TestClassLoader(com.navercorp.pinpoint.test.classloader.TestClassLoader) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) Slf4jLoggerBinder(com.navercorp.pinpoint.profiler.logging.Slf4jLoggerBinder) MockApplicationContext(com.navercorp.pinpoint.test.MockApplicationContext)

Example 2 with MockApplicationContext

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

the class AccessorInjectionTest method getTestClassLoader.

private TestClassLoader getTestClassLoader() {
    PLoggerFactory.initialize(new Slf4jLoggerBinder());
    DefaultProfilerConfig profilerConfig = new DefaultProfilerConfig();
    profilerConfig.setApplicationServerType(ServiceType.TEST_STAND_ALONE.getName());
    MockApplicationContext applicationContext = MockApplicationContext.of(profilerConfig);
    TestClassLoader testClassLoader = new TestClassLoader(applicationContext);
    testClassLoader.initialize();
    return testClassLoader;
}
Also used : TestClassLoader(com.navercorp.pinpoint.test.classloader.TestClassLoader) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) Slf4jLoggerBinder(com.navercorp.pinpoint.profiler.logging.Slf4jLoggerBinder) MockApplicationContext(com.navercorp.pinpoint.test.MockApplicationContext)

Example 3 with MockApplicationContext

use of com.navercorp.pinpoint.test.MockApplicationContext 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

MockApplicationContext (com.navercorp.pinpoint.test.MockApplicationContext)3 DefaultProfilerConfig (com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig)2 Slf4jLoggerBinder (com.navercorp.pinpoint.profiler.logging.Slf4jLoggerBinder)2 TestClassLoader (com.navercorp.pinpoint.test.classloader.TestClassLoader)2 ServerMetaDataHolder (com.navercorp.pinpoint.bootstrap.context.ServerMetaDataHolder)1 DataSender (com.navercorp.pinpoint.profiler.sender.DataSender)1 ListenableDataSender (com.navercorp.pinpoint.test.ListenableDataSender)1 ResettableServerMetaDataHolder (com.navercorp.pinpoint.test.ResettableServerMetaDataHolder)1 TBaseRecorder (com.navercorp.pinpoint.test.TBaseRecorder)1