Skip to content

Commit

Permalink
SONAR-7027 make DevCockpit run as a privileged plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sns-seb committed Nov 17, 2015
1 parent cc1b349 commit df0b8c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -55,7 +55,7 @@ public class PluginLoader {
* Defines the base keys (defined by {@link #basePluginKey(PluginInfo, Map)}) of the plugins which are allowed to
* run a full server extensions.
*/
private static final Set<String> PRIVILEGED_PLUGINS_BASE_KEYS = ImmutableSet.of("views");
private static final Set<String> PRIVILEGED_PLUGINS_BASE_KEYS = ImmutableSet.of("views", "devcockpit");

public static final Version COMPATIBILITY_MODE_MAX_VERSION = Version.create("5.2");

Expand Down
Expand Up @@ -147,14 +147,23 @@ public void test_plugins_sharing_the_same_classloader() throws Exception {
}

@Test
public void plugin_is_recognised_as_server_extension_if_key_is_views_and_extends_no_other_plugin_and_runs_in_compatibility_mode() throws IOException {
public void plugin_is_recognised_as_priviledge_if_key_is_views_and_extends_no_other_plugin_and_runs_in_compatibility_mode() throws IOException {
PluginInfo views = create52PluginInfo("views");

Collection<PluginClassLoaderDef> defs = loader.defineClassloaders(ImmutableMap.of("views", views));

assertThat(defs.iterator().next().isPrivileged()).isTrue();
}

@Test
public void plugin_is_recognised_as_priviledge_if_key_is_devcockpit_and_extends_no_other_plugin_and_runs_in_compatibility_mode() throws IOException {
PluginInfo views = create52PluginInfo("devcockpit");

Collection<PluginClassLoaderDef> defs = loader.defineClassloaders(ImmutableMap.of("views", views));

assertThat(defs.iterator().next().isPrivileged()).isTrue();
}

@Test
public void plugin_is_not_recognised_as_system_extension_if_key_is_views_and_extends_another_plugin() throws IOException {
PluginInfo foo = create52PluginInfo("foo");
Expand Down

0 comments on commit df0b8c4

Please sign in to comment.