use of com.navercorp.pinpoint.profiler.plugin.PluginPackageFilter in project pinpoint by naver.
the class JarProfilerPluginClassInjectorTest method testInjectClass.
@Test
public void testInjectClass() throws Exception {
final URL sampleJar = getSampleJar("org.slf4j.impl.Log4jLoggerAdapter");
final ClassLoader contextTypeMatchClassLoader = createContextTypeMatchClassLoader(new URL[] { sampleJar });
final ProfilerPlugin profilerPlugin = Mockito.mock(ProfilerPlugin.class);
final PluginPackageFilter pluginPackageFilter = new PluginPackageFilter(Arrays.asList(LOG4_IMPL));
PluginConfig pluginConfig = new PluginConfig(sampleJar, pluginPackageFilter);
logger.debug("pluginConfig:{}", pluginConfig);
PlainClassLoaderHandler injector = new PlainClassLoaderHandler(pluginConfig);
final Class<?> loggerClass = injector.injectClass(contextTypeMatchClassLoader, logger.getClass().getName());
logger.debug("ClassLoader{}", loggerClass.getClassLoader());
Assert.assertEquals("check className", loggerClass.getName(), "org.slf4j.impl.Log4jLoggerAdapter");
Assert.assertEquals("check ClassLoader", loggerClass.getClassLoader().getClass().getName(), CONTEXT_TYPE_MATCH_CLASS_LOADER);
}
Aggregations