From: Sébastien Lesaint Date: Tue, 6 Jun 2017 16:14:22 +0000 (+0200) Subject: SONAR-7618 Compute Engine does not load @ServerSide components anymore X-Git-Tag: 6.5-M2~81 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd1da108a8fce023bad8bd5f58fb0cad5e45bc0c;p=sonarqube.git SONAR-7618 Compute Engine does not load @ServerSide components anymore --- diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java b/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java index 6841387e8d8..22d46c12f20 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/platform/ComputeEngineExtensionInstaller.java @@ -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); } + } diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java index f5bfffe602e..76f3e86f20c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java +++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerExtensionInstaller.java @@ -20,9 +20,13 @@ 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[] supportedAnnotationTypes; + private final Set> supportedAnnotationTypes; + + protected ServerExtensionInstaller(SonarRuntime sonarRuntime, PluginRepository pluginRepository, + @Nullable Collection> 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... 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) { diff --git a/tests/src/test/java/org/sonarqube/tests/plugins/PluginsTest.java b/tests/src/test/java/org/sonarqube/tests/plugins/PluginsTest.java index 45b9262ca3e..8c0d36f4d52 100644 --- a/tests/src/test/java/org/sonarqube/tests/plugins/PluginsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/plugins/PluginsTest.java @@ -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);