use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.
the class InvokeMethodInterceptorTest method spyTraceContext.
private TraceContext spyTraceContext() {
ProfilerConfig profilerConfig = new DefaultProfilerConfig();
TraceContext traceContext = MockTraceContextFactory.newTestTraceContext(profilerConfig);
return spy(traceContext);
}
use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig 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.ProfilerConfig 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.ProfilerConfig 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));
}
use of com.navercorp.pinpoint.bootstrap.config.ProfilerConfig in project pinpoint by naver.
the class VertxHttpClientConfigTest method config.
@Test
public void config() {
Properties properties = new Properties();
properties.setProperty("profiler.vertx.http.client.param", "true");
properties.setProperty("profiler.vertx.http.client.cookie", "true");
properties.setProperty("profiler.vertx.http.client.cookie.dumptype", "EXCEPTION");
properties.setProperty("profiler.vertx.http.client.cookie.sampling.rate", "1");
properties.setProperty("profiler.vertx.http.client.entity.statuscode", "true");
ProfilerConfig profilerConfig = new DefaultProfilerConfig(properties);
VertxHttpClientConfig config = new VertxHttpClientConfig(profilerConfig);
assertEquals(true, config.isParam());
assertEquals(true, config.isCookie());
assertEquals(DumpType.EXCEPTION, config.getCookieDumpType());
assertEquals(1, config.getCookieSamplingRate());
assertEquals(true, config.isStatusCode());
properties = new Properties();
properties.setProperty("profiler.vertx.http.client.param", "false");
properties.setProperty("profiler.vertx.http.client.cookie", "false");
properties.setProperty("profiler.vertx.http.client.cookie.dumptype", "ALWAYS");
properties.setProperty("profiler.vertx.http.client.cookie.sampling.rate", "99");
properties.setProperty("profiler.vertx.http.client.entity.statuscode", "false");
profilerConfig = new DefaultProfilerConfig(properties);
config = new VertxHttpClientConfig(profilerConfig);
assertEquals(false, config.isParam());
assertEquals(false, config.isCookie());
assertEquals(DumpType.ALWAYS, config.getCookieDumpType());
assertEquals(99, config.getCookieSamplingRate());
assertEquals(false, config.isStatusCode());
}
Aggregations