]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7618 Compute Engine does not load @ServerSide components anymore
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 6 Jun 2017 16:14:22 +0000 (18:14 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 26 Jun 2017 13:23:27 +0000 (15:23 +0200)
server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java
tests/src/test/java/org/sonarqube/tests/plugins/PluginsTest.java

index 6841387e8d8af10d1e294d2d98fbdbcef27d36b7..22d46c12f2024716c2f90c1350ffb941e2e8ca05 100644 (file)
@@ -21,12 +21,12 @@ package org.sonar.ce.platform;
 
 import org.sonar.api.SonarRuntime;
 import org.sonar.api.ce.ComputeEngineSide;
-import org.sonar.api.server.ServerSide;
 import org.sonar.core.platform.PluginRepository;
 import org.sonar.server.plugins.ServerExtensionInstaller;
 
 public class ComputeEngineExtensionInstaller extends ServerExtensionInstaller {
   public ComputeEngineExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository) {
-    super(sonarRuntime, pluginRepository, ServerSide.class, ComputeEngineSide.class);
+    super(sonarRuntime, pluginRepository, ComputeEngineSide.class);
   }
+
 }
index f5bfffe602e425e7416a8016711a85e8cc6434de..76f3e86f20ccba59ee664f321a5265fa64a7c917 100644 (file)
 package org.sonar.server.plugins;
 
 import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ListMultimap;
 import java.lang.annotation.Annotation;
+import java.util.Collection;
 import java.util.Map;
+import java.util.Set;
+import javax.annotation.Nullable;
 import org.sonar.api.ExtensionProvider;
 import org.sonar.api.Plugin;
 import org.sonar.api.SonarRuntime;
@@ -31,6 +35,7 @@ import org.sonar.core.platform.ComponentContainer;
 import org.sonar.core.platform.PluginInfo;
 import org.sonar.core.platform.PluginRepository;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
 /**
@@ -40,14 +45,24 @@ public abstract class ServerExtensionInstaller {
 
   private final SonarRuntime sonarRuntime;
   private final PluginRepository pluginRepository;
-  private final Class<? extends Annotation>[] supportedAnnotationTypes;
+  private final Set<Class<? extends Annotation>> supportedAnnotationTypes;
+
+  protected ServerExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository,
+    @Nullable Collection<Class<? extends Annotation>> supportedAnnotationTypes) {
+    checkArgument(supportedAnnotationTypes != null && !supportedAnnotationTypes.isEmpty(),
+      "At least one supported annotation type must be specified");
+    this.sonarRuntime = sonarRuntime;
+    this.pluginRepository = pluginRepository;
+    this.supportedAnnotationTypes = ImmutableSet.copyOf(supportedAnnotationTypes);
+
+  }
 
   protected ServerExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository,
     Class<? extends Annotation>... supportedAnnotationTypes) {
     requireNonNull(supportedAnnotationTypes, "At least one supported annotation type must be specified");
     this.sonarRuntime = sonarRuntime;
     this.pluginRepository = pluginRepository;
-    this.supportedAnnotationTypes = supportedAnnotationTypes;
+    this.supportedAnnotationTypes = ImmutableSet.copyOf(supportedAnnotationTypes);
   }
 
   public void installExtensions(ComponentContainer container) {
index 45b9262ca3e5021d81030162696ceb80115ceeab..8c0d36f4d52ebc5e6313c35b9f29109b14e9cb38 100644 (file)
@@ -24,6 +24,14 @@ import com.sonar.orchestrator.Orchestrator;
 import com.sonar.orchestrator.OrchestratorBuilder;
 import com.sonar.orchestrator.build.BuildResult;
 import com.sonar.orchestrator.build.SonarScanner;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ErrorCollector;
 import org.sonarqube.tests.plugins.checks.AbapCheck;
 import org.sonarqube.tests.plugins.checks.CCheck;
 import org.sonarqube.tests.plugins.checks.Check;
@@ -34,21 +42,11 @@ import org.sonarqube.tests.plugins.checks.GroovyCheck;
 import org.sonarqube.tests.plugins.checks.JavaCheck;
 import org.sonarqube.tests.plugins.checks.JavascriptCheck;
 import org.sonarqube.tests.plugins.checks.PhpCheck;
-import org.sonarqube.tests.plugins.checks.PliCheck;
 import org.sonarqube.tests.plugins.checks.PythonCheck;
 import org.sonarqube.tests.plugins.checks.RpgCheck;
 import org.sonarqube.tests.plugins.checks.SwiftCheck;
 import org.sonarqube.tests.plugins.checks.Validation;
-import org.sonarqube.tests.plugins.checks.VbCheck;
 import org.sonarqube.tests.plugins.checks.WebCheck;
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ErrorCollector;
 
 import static com.sonar.orchestrator.locator.FileLocation.byWildcardMavenFilename;
 import static org.assertj.core.api.Assertions.fail;
@@ -74,11 +72,13 @@ public class PluginsTest {
     new JavaCheck(),
     new JavascriptCheck(),
     new PhpCheck(),
-    new PliCheck(),
+    // SONAR-7618 SonarPLI 1.5.0.702 not compatible with CE not loading @ServerSide
+    // new PliCheck(),
     new PythonCheck(),
     new RpgCheck(),
     new SwiftCheck(),
-    new VbCheck(),
+    // SONAR-7618 Visual Basic 2.2 not compatible with CE not loading @ServerSide
+    // new VbCheck(),
     new WebCheck());
 
   private static Orchestrator ORCHESTRATOR;
@@ -126,8 +126,10 @@ public class PluginsTest {
     installPlugin(builder, "lua");
     installPlugin(builder, "php");
     installPlugin(builder, "pitest");
-    installPlugin(builder, "pli");
-    installPlugin(builder, "plsql");
+    // SONAR-7618 SonarPLI 1.5.0.702 not compatible with CE not loading @ServerSide
+    // installPlugin(builder, "pli");
+    // SONAR-7618 SonarPLSQL 2.9.0.901 not compatible with CE not loading @ServerSide
+    // installPlugin(builder, "plsql");
     installPlugin(builder, "pmd");
     // FIXME puppet plugin is temporarily disabled because it is not compatible with SQ 6.4 until usage of Colorizer API is removed
     installPlugin(builder, "python");
@@ -145,7 +147,8 @@ public class PluginsTest {
     installPlugin(builder, "sonargraphintegration");
     installPlugin(builder, "status");
     installPlugin(builder, "swift");
-    installPlugin(builder, "vb");
+    // SONAR-7618 Visual Basic 2.2 not compatible with CE not loading @ServerSide
+    // installPlugin(builder, "vb");
     installPlugin(builder, "vbnet");
     installPlugin(builder, "web");
     installPlugin(builder, "xanitizer");
@@ -193,7 +196,7 @@ public class PluginsTest {
   private static void activateLicenses(OrchestratorBuilder builder) {
     LICENSED_PLUGINS.forEach(builder::activateLicense);
   }
-  
+
   private static void installPlugin(OrchestratorBuilder builder, String pluginKey) {
     builder.setOrchestratorProperty(pluginKey + "Version", "LATEST_RELEASE");
     builder.addPlugin(pluginKey);