Search in sources :

Example 6 with ModuleFactory

use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.

the class DefaultAgent method newApplicationContext.

protected ApplicationContext newApplicationContext(AgentOption agentOption) {
    Objects.requireNonNull(agentOption, "agentOption");
    ProfilerConfig profilerConfig = Objects.requireNonNull(agentOption.getProfilerConfig(), "profilerConfig");
    ModuleFactoryResolver moduleFactoryResolver = new DefaultModuleFactoryResolver(profilerConfig.getInjectionModuleFactoryClazzName());
    ModuleFactory moduleFactory = moduleFactoryResolver.resolve();
    return new DefaultApplicationContext(agentOption, moduleFactory);
}
Also used : ModuleFactory(com.navercorp.pinpoint.profiler.context.module.ModuleFactory) DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultModuleFactoryResolver(com.navercorp.pinpoint.profiler.context.module.DefaultModuleFactoryResolver) ModuleFactoryResolver(com.navercorp.pinpoint.profiler.context.module.ModuleFactoryResolver) DefaultModuleFactoryResolver(com.navercorp.pinpoint.profiler.context.module.DefaultModuleFactoryResolver)

Example 7 with ModuleFactory

use of com.navercorp.pinpoint.profiler.context.module.ModuleFactory in project pinpoint by naver.

the class DependencyGraph method newApplicationContext.

private DefaultApplicationContext newApplicationContext() {
    ProfilerConfig profilerConfig = spy(new DefaultProfilerConfig());
    Mockito.when(profilerConfig.getStaticResourceCleanup()).thenReturn(true);
    Instrumentation instrumentation = mock(Instrumentation.class);
    AgentOption agentOption = new DefaultAgentOption(instrumentation, "mockAgentId", "mockAgentName", "mockApplicationName", false, profilerConfig, Collections.<String>emptyList(), Collections.<String>emptyList());
    InterceptorRegistryBinder interceptorRegistryBinder = new TestInterceptorRegistryBinder();
    Module testInterceptorRegistryModule = InterceptorRegistryModule.wrap(interceptorRegistryBinder);
    ModuleFactory moduleFactory = new OverrideModuleFactory(testInterceptorRegistryModule);
    return new DefaultApplicationContext(agentOption, moduleFactory);
}
Also used : OverrideModuleFactory(com.navercorp.pinpoint.profiler.context.module.OverrideModuleFactory) ModuleFactory(com.navercorp.pinpoint.profiler.context.module.ModuleFactory) DefaultApplicationContext(com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) TestInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder) ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) TestInterceptorRegistryBinder(com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder) OverrideModuleFactory(com.navercorp.pinpoint.profiler.context.module.OverrideModuleFactory) Instrumentation(java.lang.instrument.Instrumentation) DefaultAgentOption(com.navercorp.pinpoint.bootstrap.DefaultAgentOption) AgentOption(com.navercorp.pinpoint.bootstrap.AgentOption) Module(com.google.inject.Module) InterceptorRegistryModule(com.navercorp.pinpoint.profiler.context.module.InterceptorRegistryModule) GraphvizModule(com.google.inject.grapher.graphviz.GraphvizModule)

Example 8 with ModuleFactory

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);
}
Also used : OverrideModuleFactory(com.navercorp.pinpoint.profiler.context.module.OverrideModuleFactory) ModuleFactory(com.navercorp.pinpoint.profiler.context.module.ModuleFactory) InterceptorRegistryBinder(com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder) OverrideModuleFactory(com.navercorp.pinpoint.profiler.context.module.OverrideModuleFactory) Module(com.google.inject.Module) InterceptorRegistryModule(com.navercorp.pinpoint.profiler.context.module.InterceptorRegistryModule) AbstractModule(com.google.inject.AbstractModule)

Aggregations

ModuleFactory (com.navercorp.pinpoint.profiler.context.module.ModuleFactory)8 Module (com.google.inject.Module)6 InterceptorRegistryBinder (com.navercorp.pinpoint.profiler.interceptor.registry.InterceptorRegistryBinder)5 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)4 AgentOption (com.navercorp.pinpoint.bootstrap.AgentOption)3 DefaultProfilerConfig (com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig)3 ProfilerConfig (com.navercorp.pinpoint.bootstrap.config.ProfilerConfig)3 AbstractModule (com.google.inject.AbstractModule)2 DefaultAgentOption (com.navercorp.pinpoint.bootstrap.DefaultAgentOption)2 InterceptorRegistryModule (com.navercorp.pinpoint.profiler.context.module.InterceptorRegistryModule)2 OverrideModuleFactory (com.navercorp.pinpoint.profiler.context.module.OverrideModuleFactory)2 Instrumentation (java.lang.instrument.Instrumentation)2 Injector (com.google.inject.Injector)1 GraphvizModule (com.google.inject.grapher.graphviz.GraphvizModule)1 TransportModule (com.navercorp.pinpoint.bootstrap.config.TransportModule)1 AgentInfoSender (com.navercorp.pinpoint.profiler.AgentInfoSender)1 ApplicationContextModuleFactory (com.navercorp.pinpoint.profiler.context.module.ApplicationContextModuleFactory)1 DefaultModuleFactoryResolver (com.navercorp.pinpoint.profiler.context.module.DefaultModuleFactoryResolver)1 ModuleFactoryResolver (com.navercorp.pinpoint.profiler.context.module.ModuleFactoryResolver)1 TestInterceptorRegistryBinder (com.navercorp.pinpoint.profiler.util.TestInterceptorRegistryBinder)1