use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.
the class MockTraceContextFactory method newMockApplicationContext.
public static DefaultApplicationContext newMockApplicationContext(ProfilerConfig profilerConfig) {
Module loggingModule = new LoggingModule();
InterceptorRegistryBinder interceptorRegistryBinder = new EmptyInterceptorRegistryBinder();
Module interceptorRegistryModule = InterceptorRegistryModule.wrap(interceptorRegistryBinder);
ModuleFactory moduleFactory = new OverrideModuleFactory(loggingModule, interceptorRegistryModule);
MockApplicationContextFactory factory = new MockApplicationContextFactory();
return factory.build(profilerConfig, moduleFactory);
}
use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.
the class OverrideModuleFactory method newModule.
@Override
public Module newModule(AgentOption agentOption) {
DefaultProfilerConfig profilerConfig = (DefaultProfilerConfig) agentOption.getProfilerConfig();
profilerConfig.setTransportModule(TransportModule.THRIFT.name());
ModuleFactory moduleFactory = new ApplicationContextModuleFactory() {
@Override
protected Module newRpcModule(AgentOption agentOption) {
logger.info("load {}", MockRpcModule.class.getName());
return new MockRpcModule();
}
};
Module module = moduleFactory.newModule(agentOption);
return Modules.override(module).with(overrideModule);
}
use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.
the class PluginTestAgent method newApplicationContext.
@Override
protected ApplicationContext newApplicationContext(AgentOption agentOption) {
PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
ModuleFactory moduleFactory = new OverrideModuleFactory(pluginApplicationContextModule);
DefaultApplicationContext applicationContext = new DefaultApplicationContext(agentOption, moduleFactory);
exportVerifier(applicationContext);
return applicationContext;
}
use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.
the class MockApplicationContextFactory method newModuleFactory.
private ModuleFactory newModuleFactory() {
Module pluginModule = new MockApplicationContextModule();
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
Module interceptorRegistryModule = InterceptorRegistryModule.wrap(binder);
ModuleFactory moduleFactory = new OverrideModuleFactory(pluginModule, interceptorRegistryModule);
return moduleFactory;
}
use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.
the class MockApplicationContextModuleTest method testMockApplicationContext.
@Test
public void testMockApplicationContext() {
ProfilerConfig profilerConfig = spy(new DefaultProfilerConfig());
when(profilerConfig.getStaticResourceCleanup()).thenReturn(true);
Instrumentation instrumentation = Mockito.mock(Instrumentation.class);
AgentOption agentOption = new DefaultAgentOption(instrumentation, "mockAgentId", "mockAgentName", "mockApplicationName", false, profilerConfig, Collections.<String>emptyList(), Collections.<String>emptyList());
Module pluginModule = new PluginApplicationContextModule();
InterceptorRegistryBinder interceptorRegistryBinder = new TestInterceptorRegistryBinder();
Module testInterceptorRegistryModule = InterceptorRegistryModule.wrap(interceptorRegistryBinder);
ModuleFactory moduleFactory = new OverrideModuleFactory(pluginModule, testInterceptorRegistryModule);
DefaultApplicationContext applicationContext = new DefaultApplicationContext(agentOption, moduleFactory);
Injector injector = applicationContext.getInjector();
// singleton check
AgentInfoSender instance1 = injector.getInstance(AgentInfoSender.class);
AgentInfoSender instance2 = injector.getInstance(AgentInfoSender.class);
Assert.assertSame(instance1, instance2);
ClassFileTransformer instance4 = injector.getInstance(ClassFileTransformer.class);
applicationContext.close();
}
Aggregations