diff options
author | Julien HENRY <henryju@yahoo.fr> | 2017-01-09 10:22:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-09 10:22:36 +0100 |
commit | 3a78e2dd377c501a417036ee78509f461a3c6a6b (patch) | |
tree | 4b161c893bf70e24b20cd68aa2f7f795fe0d0458 /sonar-scanner-engine/src/main/java/org/sonar | |
parent | a21a43dbec4a9c6b7c199b2beee76c009b70b8b3 (diff) | |
download | sonarqube-3a78e2dd377c501a417036ee78509f461a3c6a6b.tar.gz sonarqube-3a78e2dd377c501a417036ee78509f461a3c6a6b.zip |
Scanner cleanup
* Fail fast when a WS call is made in medium test mode
* Rename many Batch* -> Scanner*
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar')
30 files changed, 92 insertions, 146 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java index b526a3e95c3..bfd02386af7 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/batch/bootstrapper/Batch.java @@ -136,7 +136,7 @@ public final class Batch { private void checkStarted() { if (!started) { - throw new IllegalStateException("Batch is not started. Unable to execute task."); + throw new IllegalStateException("Scanner engine is not started. Unable to execute task."); } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java index f16fda3c995..3fc163d34a5 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java @@ -26,7 +26,6 @@ import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.scanner.bootstrap.AbstractAnalysisMode; import org.sonar.scanner.bootstrap.GlobalProperties; -import org.sonar.scanner.mediumtest.FakePluginInstaller; /** * @since 4.0 @@ -36,17 +35,12 @@ public class DefaultAnalysisMode extends AbstractAnalysisMode { private static final Logger LOG = LoggerFactory.getLogger(DefaultAnalysisMode.class); private static final String KEY_SCAN_ALL = "sonar.scanAllFiles"; - private boolean mediumTestMode; private boolean scanAllFiles; public DefaultAnalysisMode(GlobalProperties globalProps, AnalysisProperties props) { init(globalProps.properties(), props.properties()); } - public boolean isMediumTest() { - return mediumTestMode; - } - public boolean scanAllFiles() { return scanAllFiles; } @@ -67,7 +61,7 @@ public class DefaultAnalysisMode extends AbstractAnalysisMode { String mode = getPropertyWithFallback(analysisProps, globalProps, CoreProperties.ANALYSIS_MODE); validate(mode); issues = CoreProperties.ANALYSIS_MODE_ISSUES.equals(mode) || CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode); - mediumTestMode = "true".equals(getPropertyWithFallback(analysisProps, globalProps, FakePluginInstaller.MEDIUM_TEST_ENABLED)); + mediumTestMode = "true".equals(getPropertyWithFallback(analysisProps, globalProps, MEDIUM_TEST_ENABLED)); String scanAllStr = getPropertyWithFallback(analysisProps, globalProps, KEY_SCAN_ALL); scanAllFiles = !issues || "true".equals(scanAllStr); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/AbstractAnalysisMode.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/AbstractAnalysisMode.java index 2aa8108f3a2..546d6e88d83 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/AbstractAnalysisMode.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/AbstractAnalysisMode.java @@ -19,18 +19,19 @@ */ package org.sonar.scanner.bootstrap; +import java.util.Arrays; import org.apache.commons.lang.StringUtils; import org.sonar.api.CoreProperties; - -import java.util.Arrays; - import org.sonar.api.batch.AnalysisMode; public abstract class AbstractAnalysisMode implements AnalysisMode { + private static final String[] VALID_MODES = {CoreProperties.ANALYSIS_MODE_PREVIEW, CoreProperties.ANALYSIS_MODE_PUBLISH, CoreProperties.ANALYSIS_MODE_ISSUES}; + public static final String MEDIUM_TEST_ENABLED = "sonar.mediumTest.enabled"; protected boolean preview; protected boolean issues; + protected boolean mediumTestMode; protected AbstractAnalysisMode() { } @@ -50,6 +51,10 @@ public abstract class AbstractAnalysisMode implements AnalysisMode { return !preview && !issues; } + public boolean isMediumTest() { + return mediumTestMode; + } + protected static void validate(String mode) { if (StringUtils.isEmpty(mode)) { return; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java index c4532d72ea9..19e2e4702fa 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java @@ -73,18 +73,18 @@ public class GlobalContainer extends ComponentContainer { Version apiVersion = ApiVersion.load(System2.INSTANCE); add( // plugins - BatchPluginRepository.class, + ScannerPluginRepository.class, PluginLoader.class, PluginClassloaderFactory.class, - BatchPluginJarExploder.class, - BatchPluginPredicate.class, + ScannerPluginJarExploder.class, + ScannerPluginPredicate.class, ExtensionInstaller.class, new SonarQubeVersion(apiVersion), SonarRuntimeImpl.forSonarQube(apiVersion, SonarQubeSide.SCANNER), StoragesManager.class, GlobalSettings.class, - new BatchWsClientProvider(), + new ScannerWsClientProvider(), DefaultServer.class, new GlobalTempFolderProvider(), DefaultHttpDownloader.class, @@ -93,7 +93,7 @@ public class GlobalContainer extends ComponentContainer { System2.INSTANCE, new GlobalRepositoriesProvider(), UuidFactoryImpl.INSTANCE); - addIfMissing(BatchPluginInstaller.class, PluginInstaller.class); + addIfMissing(ScannerPluginInstaller.class, PluginInstaller.class); addIfMissing(DefaultGlobalRepositoriesLoader.class, GlobalRepositoriesLoader.class); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalMode.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalMode.java index 29b6b805616..2e696df126b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalMode.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalMode.java @@ -30,7 +30,7 @@ public class GlobalMode extends AbstractAnalysisMode { String mode = props.property(CoreProperties.ANALYSIS_MODE); validate(mode); issues = CoreProperties.ANALYSIS_MODE_ISSUES.equals(mode) || CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode); - + mediumTestMode = "true".equals(props.property(MEDIUM_TEST_ENABLED)); if (preview) { LOG.debug("Preview global mode"); } else if (issues) { @@ -38,5 +38,9 @@ public class GlobalMode extends AbstractAnalysisMode { } else { LOG.debug("Publish global mode"); } + if (mediumTestMode) { + LOG.info("Medium test mode"); + } } + } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java index a839986ce7b..8334f61bfdd 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginInstaller.java @@ -36,7 +36,7 @@ public interface PluginInstaller { /** * Used only by tests. - * @see org.sonar.scanner.mediumtest.BatchMediumTester + * @see org.sonar.scanner.mediumtest.ScannerMediumTester */ Map<String, Plugin> installLocals(); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchExtensionDictionnary.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java index 6aac81cf120..1ffe0400337 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchExtensionDictionnary.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnary.java @@ -53,7 +53,7 @@ import org.sonar.scanner.sensor.SensorWrapper; /** * @since 2.6 */ -public class BatchExtensionDictionnary { +public class ScannerExtensionDictionnary { private final ComponentContainer componentContainer; private final SensorContext sensorContext; @@ -61,7 +61,7 @@ public class BatchExtensionDictionnary { private final PostJobContext postJobContext; private final PostJobOptimizer postJobOptimizer; - public BatchExtensionDictionnary(ComponentContainer componentContainer, DefaultSensorContext sensorContext, SensorOptimizer sensorOptimizer, PostJobContext postJobContext, + public ScannerExtensionDictionnary(ComponentContainer componentContainer, DefaultSensorContext sensorContext, SensorOptimizer sensorOptimizer, PostJobContext postJobContext, PostJobOptimizer postJobOptimizer) { this.componentContainer = componentContainer; this.sensorContext = sensorContext; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java index 25ce8cf68a4..35b97e6ad7d 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginInstaller.java @@ -50,16 +50,16 @@ import static java.lang.String.format; * Downloads the plugins installed on server and stores them in a local user cache * (see {@link FileCacheProvider}). */ -public class BatchPluginInstaller implements PluginInstaller { +public class ScannerPluginInstaller implements PluginInstaller { - private static final Logger LOG = Loggers.get(BatchPluginInstaller.class); + private static final Logger LOG = Loggers.get(ScannerPluginInstaller.class); private static final String PLUGINS_INDEX_URL = "/deploy/plugins/index.txt"; private final FileCache fileCache; - private final BatchPluginPredicate pluginPredicate; - private final BatchWsClient wsClient; + private final ScannerPluginPredicate pluginPredicate; + private final ScannerWsClient wsClient; - public BatchPluginInstaller(BatchWsClient wsClient, FileCache fileCache, BatchPluginPredicate pluginPredicate) { + public ScannerPluginInstaller(ScannerWsClient wsClient, FileCache fileCache, ScannerPluginPredicate pluginPredicate) { this.fileCache = fileCache; this.pluginPredicate = pluginPredicate; this.wsClient = wsClient; @@ -89,7 +89,7 @@ public class BatchPluginInstaller implements PluginInstaller { /** * Returns empty on purpose. This method is used only by tests. - * @see org.sonar.scanner.mediumtest.BatchMediumTester + * @see org.sonar.scanner.mediumtest.ScannerMediumTester */ @Override public Map<String, Plugin> installLocals() { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginJarExploder.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java index f4eea73f7db..f2d936e87d9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginJarExploder.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploder.java @@ -34,11 +34,11 @@ import java.io.IOException; import static org.sonar.core.util.FileUtils.deleteQuietly; @ScannerSide -public class BatchPluginJarExploder extends PluginJarExploder { +public class ScannerPluginJarExploder extends PluginJarExploder { private final FileCache fileCache; - public BatchPluginJarExploder(FileCache fileCache) { + public ScannerPluginJarExploder(FileCache fileCache) { this.fileCache = fileCache; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginPredicate.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginPredicate.java index f86adc3dd1d..e3d0e2daea4 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginPredicate.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginPredicate.java @@ -41,9 +41,9 @@ import static com.google.common.collect.Sets.newHashSet; * Filters the plugins to be enabled during analysis */ @ScannerSide -public class BatchPluginPredicate implements Predicate<String> { +public class ScannerPluginPredicate implements Predicate<String> { - private static final Logger LOG = Loggers.get(BatchPluginPredicate.class); + private static final Logger LOG = Loggers.get(ScannerPluginPredicate.class); private static final String BUILDBREAKER_PLUGIN_KEY = "buildbreaker"; private static final Joiner COMMA_JOINER = Joiner.on(", "); @@ -52,7 +52,7 @@ public class BatchPluginPredicate implements Predicate<String> { private final Set<String> blacks = newHashSet(); private final GlobalMode mode; - public BatchPluginPredicate(Settings settings, GlobalMode mode) { + public ScannerPluginPredicate(Settings settings, GlobalMode mode) { this.mode = mode; if (mode.isPreview() || mode.isIssues()) { // These default values are not supported by Settings because the class CorePlugin diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java index 0bad3324f52..f804a528107 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchPluginRepository.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerPluginRepository.java @@ -34,8 +34,8 @@ import org.sonar.core.platform.PluginRepository; /** * Orchestrates the installation and loading of plugins */ -public class BatchPluginRepository implements PluginRepository, Startable { - private static final Logger LOG = Loggers.get(BatchPluginRepository.class); +public class ScannerPluginRepository implements PluginRepository, Startable { + private static final Logger LOG = Loggers.get(ScannerPluginRepository.class); private final PluginInstaller installer; private final PluginLoader loader; @@ -43,7 +43,7 @@ public class BatchPluginRepository implements PluginRepository, Startable { private Map<String, Plugin> pluginInstancesByKeys; private Map<String, PluginInfo> infosByKeys; - public BatchPluginRepository(PluginInstaller installer, PluginLoader loader) { + public ScannerPluginRepository(PluginInstaller installer, PluginLoader loader) { this.installer = installer; this.loader = loader; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchWsClient.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClient.java index 98269c46a67..65ce8857932 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchWsClient.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClient.java @@ -21,6 +21,7 @@ package org.sonar.scanner.bootstrap; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; +import com.google.common.base.Preconditions; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -43,16 +44,18 @@ import static java.net.HttpURLConnection.HTTP_BAD_REQUEST; import static java.net.HttpURLConnection.HTTP_FORBIDDEN; import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; -public class BatchWsClient { +public class ScannerWsClient { - private static final Logger LOG = Loggers.get(BatchWsClient.class); + private static final Logger LOG = Loggers.get(ScannerWsClient.class); private final WsClient target; private final boolean hasCredentials; + private final GlobalMode globalMode; - public BatchWsClient(WsClient target, boolean hasCredentials) { + public ScannerWsClient(WsClient target, boolean hasCredentials, GlobalMode globalMode) { this.target = target; this.hasCredentials = hasCredentials; + this.globalMode = globalMode; } /** @@ -65,6 +68,7 @@ public class BatchWsClient { * @throws HttpException if the response code is not in range [200..300) */ public WsResponse call(WsRequest request) { + Preconditions.checkState(!globalMode.isMediumTest(), "No WS call should be made in medium test mode"); Profiler profiler = Profiler.createIfDebug(LOG).start(); WsResponse response = target.wsConnector().call(request); profiler.stopDebug(format("%s %d %s", request.getMethod(), response.code(), response.requestUrl())); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchWsClientProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java index c40c1ddb761..9e8203230bd 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/BatchWsClientProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java @@ -31,15 +31,15 @@ import static java.lang.String.valueOf; import static org.apache.commons.lang.StringUtils.defaultIfBlank; @ScannerSide -public class BatchWsClientProvider extends ProviderAdapter { +public class ScannerWsClientProvider extends ProviderAdapter { static final int CONNECT_TIMEOUT_MS = 5_000; static final String READ_TIMEOUT_SEC_PROPERTY = "sonar.ws.timeout"; static final int DEFAULT_READ_TIMEOUT_SEC = 60; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; - public synchronized BatchWsClient provide(final GlobalProperties settings, final EnvironmentInformation env) { + public synchronized ScannerWsClient provide(final GlobalProperties settings, final EnvironmentInformation env, GlobalMode globalMode) { if (wsClient == null) { String url = defaultIfBlank(settings.property("sonar.host.url"), CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE); HttpConnector.Builder connectorBuilder = HttpConnector.newBuilder(); @@ -59,7 +59,7 @@ public class BatchWsClientProvider extends ProviderAdapter { connectorBuilder.proxyCredentials(proxyUser, System.getProperty("http.proxyPassword")); } - wsClient = new BatchWsClient(WsClientFactories.getDefault().newClient(connectorBuilder.build()), login != null); + wsClient = new ScannerWsClient(WsClientFactories.getDefault().newClient(connectorBuilder.build()), login != null, globalMode); } return wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/InputFileComponent.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/InputFileComponent.java deleted file mode 100644 index 8a11c1856e4..00000000000 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/deprecated/InputFileComponent.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.scanner.deprecated; - -import org.sonar.api.batch.fs.InputFile.Type; -import org.sonar.api.batch.fs.internal.DefaultInputFile; -import org.sonar.api.component.Component; -import org.sonar.api.resources.Qualifiers; - -public class InputFileComponent implements Component { - - private final DefaultInputFile inputFile; - - public InputFileComponent(DefaultInputFile inputFile) { - this.inputFile = inputFile; - } - - @Override - public String key() { - return inputFile.key(); - } - - @Override - public String path() { - return inputFile.relativePath(); - } - - @Override - public String name() { - return inputFile.file().getName(); - } - - @Override - public String longName() { - return inputFile.relativePath(); - } - - @Override - public String qualifier() { - return inputFile.type() == Type.MAIN ? Qualifiers.FILE : Qualifiers.UNIT_TEST_FILE; - } - -} diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java index 1e2d92c2cc6..ed0d6551fea 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoader.java @@ -29,13 +29,13 @@ import com.google.common.collect.Iterators; import org.apache.commons.io.IOUtils; import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.util.BatchUtils; public class DefaultServerLineHashesLoader implements ServerLineHashesLoader { - private BatchWsClient wsClient; + private ScannerWsClient wsClient; - public DefaultServerLineHashesLoader(BatchWsClient wsClient) { + public DefaultServerLineHashesLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakePluginInstaller.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakePluginInstaller.java index 6fdb948df38..13c75c2e0eb 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakePluginInstaller.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakePluginInstaller.java @@ -27,7 +27,6 @@ import org.sonar.core.platform.PluginInfo; import org.sonar.scanner.bootstrap.PluginInstaller; public class FakePluginInstaller implements PluginInstaller { - public static final String MEDIUM_TEST_ENABLED = "sonar.mediumTest.enabled"; private final Map<String, PluginInfo> infosByKeys = new HashMap<>(); private final Map<String, Plugin> instancesByKeys = new HashMap<>(); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/InitializersExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/InitializersExecutor.java index e2b5bc6fdac..91cf3e899a0 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/InitializersExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/InitializersExecutor.java @@ -26,7 +26,7 @@ import org.sonar.api.resources.Project; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.api.utils.log.Profiler; -import org.sonar.scanner.bootstrap.BatchExtensionDictionnary; +import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary; import org.sonar.scanner.events.EventBus; import java.util.Collection; @@ -35,10 +35,10 @@ public class InitializersExecutor { private static final Logger LOG = Loggers.get(SensorsExecutor.class); private Project project; - private BatchExtensionDictionnary selector; + private ScannerExtensionDictionnary selector; private EventBus eventBus; - public InitializersExecutor(BatchExtensionDictionnary selector, Project project, EventBus eventBus) { + public InitializersExecutor(ScannerExtensionDictionnary selector, Project project, EventBus eventBus) { this.selector = selector; this.project = project; this.eventBus = eventBus; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java index f01ab46a896..ce5863ecc1b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/PostJobsExecutor.java @@ -28,7 +28,7 @@ import org.sonar.api.batch.SensorContext; import org.sonar.api.resources.Project; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; -import org.sonar.scanner.bootstrap.BatchExtensionDictionnary; +import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary; import org.sonar.scanner.events.EventBus; import org.sonar.scanner.util.BatchUtils; @@ -36,11 +36,11 @@ import org.sonar.scanner.util.BatchUtils; public class PostJobsExecutor { private static final Logger LOG = Loggers.get(PostJobsExecutor.class); - private final BatchExtensionDictionnary selector; + private final ScannerExtensionDictionnary selector; private final Project project; private final EventBus eventBus; - public PostJobsExecutor(BatchExtensionDictionnary selector, Project project, EventBus eventBus) { + public PostJobsExecutor(ScannerExtensionDictionnary selector, Project project, EventBus eventBus) { this.selector = selector; this.project = project; this.eventBus = eventBus; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/SensorsExecutor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/SensorsExecutor.java index 5953f4d5613..acaa8727cf9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/SensorsExecutor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/phases/SensorsExecutor.java @@ -24,7 +24,7 @@ import org.sonar.api.batch.ScannerSide; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.resources.Project; -import org.sonar.scanner.bootstrap.BatchExtensionDictionnary; +import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary; import org.sonar.scanner.events.EventBus; import java.util.Collection; @@ -33,9 +33,9 @@ public class SensorsExecutor { private EventBus eventBus; private Project module; - private BatchExtensionDictionnary selector; + private ScannerExtensionDictionnary selector; - public SensorsExecutor(BatchExtensionDictionnary selector, Project project, EventBus eventBus) { + public SensorsExecutor(ScannerExtensionDictionnary selector, Project project, EventBus eventBus) { this.selector = selector; this.eventBus = eventBus; this.module = project; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java index 594c7b5ba31..c125952ef3b 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/platform/DefaultServer.java @@ -28,7 +28,7 @@ import org.sonar.api.batch.ScannerSide; import org.sonar.api.config.Settings; import org.sonar.api.platform.Server; import org.sonar.api.utils.DateUtils; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import static org.apache.commons.lang.StringUtils.trimToEmpty; @@ -36,9 +36,9 @@ import static org.apache.commons.lang.StringUtils.trimToEmpty; public class DefaultServer extends Server { private final Settings settings; - private final BatchWsClient client; + private final ScannerWsClient client; - public DefaultServer(Settings settings, BatchWsClient client) { + public DefaultServer(Settings settings, ScannerWsClient client) { this.settings = settings; this.client = client; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java index 65c483c535b..39f22a46aec 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java @@ -37,7 +37,7 @@ import org.sonar.api.utils.System2; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.core.platform.PluginInfo; -import org.sonar.scanner.bootstrap.BatchPluginRepository; +import org.sonar.scanner.bootstrap.ScannerPluginRepository; import org.sonar.scanner.protocol.input.GlobalRepositories; import org.sonar.scanner.protocol.output.ScannerReportWriter; import org.sonar.scanner.repository.ProjectRepositories; @@ -51,7 +51,7 @@ public class AnalysisContextReportPublisher { private static final String ENV_PROP_PREFIX = "env."; private static final String SONAR_PROP_PREFIX = "sonar."; - private final BatchPluginRepository pluginRepo; + private final ScannerPluginRepository pluginRepo; private final AnalysisMode mode; private final System2 system; private final ProjectRepositories projectRepos; @@ -59,7 +59,7 @@ public class AnalysisContextReportPublisher { private ScannerReportWriter writer; - public AnalysisContextReportPublisher(AnalysisMode mode, BatchPluginRepository pluginRepo, System2 system, + public AnalysisContextReportPublisher(AnalysisMode mode, ScannerPluginRepository pluginRepo, System2 system, ProjectRepositories projectRepos, GlobalRepositories globalRepositories) { this.mode = mode; this.pluginRepo = pluginRepo; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java index 5c291d30dd2..e082bcecfd9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java @@ -44,7 +44,7 @@ import org.sonar.api.utils.ZipUtils; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.scanner.analysis.DefaultAnalysisMode; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.output.ScannerReportWriter; import org.sonar.scanner.scan.ImmutableProjectReactor; import org.sonarqube.ws.MediaTypes; @@ -64,7 +64,7 @@ public class ReportPublisher implements Startable { public static final String METADATA_DUMP_FILENAME = "report-task.txt"; private final Settings settings; - private final BatchWsClient wsClient; + private final ScannerWsClient wsClient; private final AnalysisContextReportPublisher contextPublisher; private final ImmutableProjectReactor projectReactor; private final DefaultAnalysisMode analysisMode; @@ -75,7 +75,7 @@ public class ReportPublisher implements Startable { private File reportDir; private ScannerReportWriter writer; - public ReportPublisher(Settings settings, BatchWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher, + public ReportPublisher(Settings settings, ScannerWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher, ImmutableProjectReactor projectReactor, DefaultAnalysisMode analysisMode, TempFolder temp, ReportPublisherStep[] publishers) { this.settings = settings; this.wsClient = wsClient; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoader.java index 84a44c49d12..5c2ca68395c 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoader.java @@ -19,7 +19,7 @@ */ package org.sonar.scanner.repository; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.GlobalRepositories; import org.sonarqube.ws.client.GetRequest; import java.io.IOException; @@ -30,9 +30,9 @@ import org.apache.commons.io.IOUtils; public class DefaultGlobalRepositoriesLoader implements GlobalRepositoriesLoader { private static final String BATCH_GLOBAL_URL = "/batch/global"; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; - public DefaultGlobalRepositoriesLoader(BatchWsClient wsClient) { + public DefaultGlobalRepositoriesLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java index abdefcae436..2ccfb6c8a7f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoader.java @@ -31,7 +31,7 @@ import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.utils.MessageException; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.util.BatchUtils; import org.sonarqube.ws.WsBatch; import org.sonarqube.ws.WsBatch.WsProjectResponse; @@ -44,9 +44,9 @@ import org.sonarqube.ws.client.WsResponse; public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoader { private static final Logger LOG = LoggerFactory.getLogger(DefaultProjectRepositoriesLoader.class); private static final String BATCH_PROJECT_URL = "/batch/project.protobuf"; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; - public DefaultProjectRepositoriesLoader(BatchWsClient wsClient) { + public DefaultProjectRepositoriesLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java index 6ed05d2a7bc..148f7ee0c82 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultQualityProfileLoader.java @@ -20,7 +20,7 @@ package org.sonar.scanner.repository; import org.sonar.api.utils.MessageException; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.util.BatchUtils; import org.sonarqube.ws.QualityProfiles.SearchWsResponse; import org.apache.commons.io.IOUtils; @@ -35,9 +35,9 @@ import java.util.List; public class DefaultQualityProfileLoader implements QualityProfileLoader { private static final String WS_URL = "/api/qualityprofiles/search.protobuf"; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; - public DefaultQualityProfileLoader(BatchWsClient wsClient) { + public DefaultQualityProfileLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java index 00015cee70a..02e8ff57a47 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/DefaultServerIssuesLoader.java @@ -23,16 +23,16 @@ import com.google.common.base.Function; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; import org.sonar.scanner.util.BatchUtils; import org.sonarqube.ws.client.GetRequest; public class DefaultServerIssuesLoader implements ServerIssuesLoader { - private final BatchWsClient wsClient; + private final ScannerWsClient wsClient; - public DefaultServerIssuesLoader(BatchWsClient wsClient) { + public DefaultServerIssuesLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java index acf5d8c7d95..42d6fca9840 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/user/UserRepositoryLoader.java @@ -22,7 +22,7 @@ package org.sonar.scanner.repository.user; import org.apache.commons.io.IOUtils; import com.google.common.collect.Lists; import com.google.common.base.Joiner; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.ScannerInput; import org.sonar.scanner.util.BatchUtils; import org.sonarqube.ws.client.GetRequest; @@ -35,9 +35,9 @@ import java.util.Collections; import java.util.List; public class UserRepositoryLoader { - private final BatchWsClient wsClient; + private final ScannerWsClient wsClient; - public UserRepositoryLoader(BatchWsClient wsClient) { + public UserRepositoryLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java index 7df5a23f820..4a6db254ed9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultActiveRulesLoader.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.io.IOUtils; import org.sonar.api.rule.RuleKey; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.util.BatchUtils; import org.sonarqube.ws.Rules; import org.sonarqube.ws.Rules.Active; @@ -40,9 +40,9 @@ import org.sonarqube.ws.client.GetRequest; public class DefaultActiveRulesLoader implements ActiveRulesLoader { private static final String RULES_SEARCH_URL = "/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true"; - private final BatchWsClient wsClient; + private final ScannerWsClient wsClient; - public DefaultActiveRulesLoader(BatchWsClient wsClient) { + public DefaultActiveRulesLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultRulesLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultRulesLoader.java index ff310de154b..3162e51eaf4 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultRulesLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/rule/DefaultRulesLoader.java @@ -20,7 +20,7 @@ package org.sonar.scanner.rule; import org.apache.commons.io.IOUtils; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonarqube.ws.Rules.ListResponse.Rule; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.Rules.ListResponse; @@ -32,9 +32,9 @@ import java.util.List; public class DefaultRulesLoader implements RulesLoader { private static final String RULES_SEARCH_URL = "/api/rules/list.protobuf"; - private final BatchWsClient wsClient; + private final ScannerWsClient wsClient; - public DefaultRulesLoader(BatchWsClient wsClient) { + public DefaultRulesLoader(ScannerWsClient wsClient) { this.wsClient = wsClient; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java index 5ab42b57c2e..1033130b961 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleScanContainer.java @@ -31,7 +31,7 @@ import org.sonar.api.scan.filesystem.FileExclusions; import org.sonar.core.platform.ComponentContainer; import org.sonar.scanner.DefaultFileLinesContextFactory; import org.sonar.scanner.DefaultProjectTree; -import org.sonar.scanner.bootstrap.BatchExtensionDictionnary; +import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary; import org.sonar.scanner.bootstrap.ExtensionInstaller; import org.sonar.scanner.bootstrap.ExtensionUtils; import org.sonar.scanner.deprecated.DeprecatedSensorContext; @@ -140,7 +140,7 @@ public class ModuleScanContainer extends ComponentContainer { DefaultPostJobContext.class, DefaultSensorStorage.class, DeprecatedSensorContext.class, - BatchExtensionDictionnary.class, + ScannerExtensionDictionnary.class, IssueFilters.class, CoverageExclusions.class, |