]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7027 make DevCockpit run as a privileged plugin 637/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 17 Nov 2015 14:45:28 +0000 (15:45 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 17 Nov 2015 16:55:21 +0000 (17:55 +0100)
sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java
sonar-core/src/test/java/org/sonar/core/platform/PluginLoaderTest.java

index 2118a0dc1e41e74325e1ee918516424e7a74ec0c..9dc71a63ee3c83d9307154cb2307e5e2ea06f675 100644 (file)
@@ -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");
 
index 34c0e76c1e9c46cd695c30087e5c276a4e059536..43542ee50a950c4c1ed75234b604b2a5a481e863 100644 (file)
@@ -147,7 +147,7 @@ public class PluginLoaderTest {
   }
 
   @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));
@@ -155,6 +155,15 @@ public class PluginLoaderTest {
     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");