Search in sources :

Example 1 with JarPlugin

use of com.navercorp.pinpoint.profiler.plugin.JarPlugin in project pinpoint by naver.

the class PlainClassLoaderHandlerTest method newPluginConfig.

// @Test
// public void injectClass() {
// PluginConfig pluginConfig = newPluginConfig();
// 
// PlainClassLoaderHandler plainClassLoaderHandler = new PlainClassLoaderHandler(pluginConfig);
// plainClassLoaderHandler.injectClass(this.getClass().getClassLoader(), "java.lang.String");
// 
// }
private PluginConfig newPluginConfig() {
    JarPlugin plugin = mock(JarPlugin.class);
    JarFile jarFile = mock(JarFile.class);
    when(plugin.getJarFile()).thenReturn(jarFile);
    ClassNameFilter filter = new ClassNameFilter() {

        @Override
        public boolean accept(String className) {
            return ClassNameFilter.ACCEPT;
        }
    };
    PluginConfig pluginConfig = new PluginConfig(plugin, filter);
    return pluginConfig;
}
Also used : PluginConfig(com.navercorp.pinpoint.profiler.plugin.PluginConfig) JarPlugin(com.navercorp.pinpoint.profiler.plugin.JarPlugin) ClassNameFilter(com.navercorp.pinpoint.profiler.plugin.ClassNameFilter) JarFile(java.util.jar.JarFile)

Example 2 with JarPlugin

use of com.navercorp.pinpoint.profiler.plugin.JarPlugin in project pinpoint by naver.

the class JarProfilerPluginClassInjectorTest method getMockPlugin.

private Plugin<?> getMockPlugin(Class<?> clazz) throws Exception {
    final URL location = CodeSourceUtils.getCodeLocation(clazz);
    logger.debug("url:{}", location);
    PluginJar pluginJar = PluginJar.fromFilePath(location.getFile());
    return new JarPlugin<>(pluginJar, Collections.emptyList(), Collections.<String>emptyList());
}
Also used : PluginJar(com.navercorp.pinpoint.profiler.plugin.PluginJar) JarPlugin(com.navercorp.pinpoint.profiler.plugin.JarPlugin) URL(java.net.URL)

Aggregations

JarPlugin (com.navercorp.pinpoint.profiler.plugin.JarPlugin)2 ClassNameFilter (com.navercorp.pinpoint.profiler.plugin.ClassNameFilter)1 PluginConfig (com.navercorp.pinpoint.profiler.plugin.PluginConfig)1 PluginJar (com.navercorp.pinpoint.profiler.plugin.PluginJar)1 URL (java.net.URL)1 JarFile (java.util.jar.JarFile)1