use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig 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;
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig 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;
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig 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.config.DefaultProfilerConfig in project pinpoint by naver.
the class MockApplicationContext method of.
public static MockApplicationContext of(String configPath) {
ProfilerConfig profilerConfig = null;
try {
final URL resource = MockApplicationContext.class.getClassLoader().getResource(configPath);
if (resource == null) {
throw new FileNotFoundException("pinpoint.config not found. configPath:" + configPath);
}
profilerConfig = DefaultProfilerConfig.load(resource.getPath());
((DefaultProfilerConfig) profilerConfig).setApplicationServerType(ServiceType.TEST_STAND_ALONE.getName());
} catch (IOException ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
return of(profilerConfig);
}
use of com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig in project pinpoint by naver.
the class VertxConfigTest method config.
@Test
public void config() {
Properties properties = new Properties();
properties.setProperty("profiler.vertx.enable", "true");
properties.setProperty("profiler.vertx.http.server.enable", "true");
properties.setProperty("profiler.vertx.http.client.enable", "true");
properties.setProperty("profiler.vertx.bootstrap.main", "io.vertx.core.Starter");
ProfilerConfig profilerConfig = new DefaultProfilerConfig(properties);
VertxConfig config = new VertxConfig(profilerConfig);
assertEquals(true, config.isEnable());
assertEquals(true, config.isEnableHttpServer());
assertEquals(true, config.isEnableHttpClient());
assertEquals(1, config.getBootstrapMains().size());
assertEquals("io.vertx.core.Starter", config.getBootstrapMains().get(0));
properties = new Properties();
properties.setProperty("profiler.vertx.enable", "false");
properties.setProperty("profiler.vertx.http.server.enable", "false");
properties.setProperty("profiler.vertx.http.client.enable", "false");
properties.setProperty("profiler.vertx.bootstrap.main", "");
profilerConfig = new DefaultProfilerConfig(properties);
config = new VertxConfig(profilerConfig);
assertEquals(false, config.isEnable());
assertEquals(false, config.isEnableHttpServer());
assertEquals(false, config.isEnableHttpClient());
assertEquals(1, config.getBootstrapMains().size());
assertEquals("", config.getBootstrapMains().get(0));
}
Aggregations