use of org.opengrok.indexer.framework.PluginClassLoader in project OpenGrok by OpenGrok.
the class PluginClassLoaderTest method testProhibitedNames.
@Test
public void testProhibitedNames() throws ClassNotFoundException {
PluginClassLoader instance = new PluginClassLoader(null);
instance.loadClass("org.opengrok.indexer.configuration.Group");
instance.loadClass("org.opengrok.indexer.configuration.Project");
instance.loadClass("org.opengrok.indexer.authorization.IAuthorizationPlugin");
instance.loadClass("org.opengrok.indexer.configuration.RuntimeEnvironment");
}
use of org.opengrok.indexer.framework.PluginClassLoader in project OpenGrok by OpenGrok.
the class PluginClassLoaderTest method testFalsePlugin.
@Test
public void testFalsePlugin() {
PluginClassLoader instance = new PluginClassLoader(pluginDirectory);
Class<?> clazz = loadClass(instance, "opengrok.auth.plugin.FalsePlugin");
IAuthorizationPlugin plugin = getNewInstance(clazz);
Group g = new Group("group1");
Project p = new Project("project1");
assertFalse(plugin.isAllowed(new DummyHttpServletRequest(), g));
assertFalse(plugin.isAllowed(new DummyHttpServletRequest(), p));
}
use of org.opengrok.indexer.framework.PluginClassLoader in project OpenGrok by OpenGrok.
the class PluginClassLoaderTest method testTruePlugin.
@Test
public void testTruePlugin() {
PluginClassLoader instance = new PluginClassLoader(pluginDirectory);
Class<?> clazz = loadClass(instance, "opengrok.auth.plugin.TruePlugin");
IAuthorizationPlugin plugin = getNewInstance(clazz);
Group g = new Group("group1");
Project p = new Project("project1");
assertTrue(plugin.isAllowed(new DummyHttpServletRequest(), g));
assertTrue(plugin.isAllowed(new DummyHttpServletRequest(), p));
}
use of org.opengrok.indexer.framework.PluginClassLoader in project OpenGrok by OpenGrok.
the class PluginClassLoaderTest method testProhibitedPackages.
@Test
public void testProhibitedPackages() {
PluginClassLoader instance = new PluginClassLoader(null);
assertThrows(SecurityException.class, () -> instance.loadClass("java.lang.plugin.MyPlugin"));
assertThrows(SecurityException.class, () -> instance.loadClass("javax.servlet.HttpServletRequest"));
assertThrows(SecurityException.class, () -> instance.loadClass("org.w3c.plugin.MyPlugin"));
assertThrows(SecurityException.class, () -> instance.loadClass("org.xml.plugin.MyPlugin"));
assertThrows(SecurityException.class, () -> instance.loadClass("org.omg.plugin.MyPlugin"));
assertThrows(SecurityException.class, () -> instance.loadClass("sun.org.plugin.MyPlugin"));
}
use of org.opengrok.indexer.framework.PluginClassLoader in project OpenGrok by OpenGrok.
the class PluginClassLoaderTest method testNonExistingPlugin.
@Test
public void testNonExistingPlugin() {
PluginClassLoader instance = new PluginClassLoader(pluginDirectory);
loadClass(instance, "org.sample.plugin.NoPlugin", true);
}
Aggregations