use of com.navercorp.pinpoint.bootstrap.AgentOption in project pinpoint by naver.
the class DefaultApplicationContextTest method newApplicationContext.
private DefaultApplicationContext newApplicationContext() {
ProfilerConfig profilerConfig = new DefaultProfilerConfig();
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
Instrumentation instrumentation = mock(Instrumentation.class);
AgentOption agentOption = new DefaultAgentOption(instrumentation, "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
return new DefaultApplicationContext(agentOption, binder);
}
use of com.navercorp.pinpoint.bootstrap.AgentOption in project pinpoint by naver.
the class MockApplicationContextModuleTest method test.
@Test
public void test() {
ProfilerConfig profilerConfig = new DefaultProfilerConfig();
AgentOption agentOption = new DefaultAgentOption(new DummyInstrumentation(), "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
final PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
PluginTestAgent pluginTestAgent = new PluginTestAgent(agentOption) {
@Override
protected ApplicationContext newApplicationContext(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
ApplicationContext applicationContext = new DefaultApplicationContext(agentOption, interceptorRegistryBinder) {
@Override
protected Module newApplicationContextModule(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
Module applicationContextModule = super.newApplicationContextModule(agentOption, interceptorRegistryBinder);
// PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
return Modules.override(applicationContextModule).with(pluginApplicationContextModule);
}
};
return applicationContext;
}
};
try {
pluginTestAgent.start();
} finally {
pluginTestAgent.stop(true);
}
}
use of com.navercorp.pinpoint.bootstrap.AgentOption in project pinpoint by naver.
the class MockApplicationContext method of.
public static MockApplicationContext of(ProfilerConfig config) {
AgentOption agentOption = new DefaultAgentOption(new DummyInstrumentation(), "mockAgent", "mockApplicationName", config, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
binder.bind();
return new MockApplicationContext(agentOption, binder);
}
use of com.navercorp.pinpoint.bootstrap.AgentOption in project pinpoint by naver.
the class PluginTestAgent method newApplicationContext.
@Override
protected ApplicationContext newApplicationContext(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
this.pluginApplicationContextModule = new PluginApplicationContextModule();
ApplicationContext applicationContext = new DefaultApplicationContext(agentOption, interceptorRegistryBinder) {
@Override
protected Module newApplicationContextModule(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
Module applicationContextModule = super.newApplicationContextModule(agentOption, interceptorRegistryBinder);
return Modules.override(applicationContextModule).with(pluginApplicationContextModule);
}
};
return applicationContext;
}
use of com.navercorp.pinpoint.bootstrap.AgentOption in project pinpoint by naver.
the class MockApplicationContextModuleTest method testMockApplicationContext.
@Test
public void testMockApplicationContext() {
ProfilerConfig profilerConfig = new DefaultProfilerConfig();
InterceptorRegistryBinder binder = new TestInterceptorRegistryBinder();
AgentOption agentOption = new DefaultAgentOption(new DummyInstrumentation(), "mockAgent", "mockApplicationName", profilerConfig, new URL[0], null, new DefaultServiceTypeRegistryService(), new DefaultAnnotationKeyRegistryService());
DefaultApplicationContext applicationContext = new DefaultApplicationContext(agentOption, binder) {
@Override
protected Module newApplicationContextModule(AgentOption agentOption, InterceptorRegistryBinder interceptorRegistryBinder) {
Module module = super.newApplicationContextModule(agentOption, interceptorRegistryBinder);
PluginApplicationContextModule pluginApplicationContextModule = new PluginApplicationContextModule();
return Modules.override(module).with(pluginApplicationContextModule);
}
};
Injector injector = applicationContext.getInjector();
// singleton check
AgentInfoSender instance1 = injector.getInstance(AgentInfoSender.class);
AgentInfoSender instance2 = injector.getInstance(AgentInfoSender.class);
Assert.assertSame(instance1, instance2);
ClassFileTransformerDispatcher instance4 = injector.getInstance(ClassFileTransformerDispatcher.class);
}
Aggregations