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 | |
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')
80 files changed, 283 insertions, 340 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, diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java index 180e447d5ca..36755896210 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/WsTestUtil.java @@ -22,7 +22,7 @@ package org.sonar.scanner; import org.apache.commons.lang.StringUtils; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonarqube.ws.client.WsRequest; import org.sonarqube.ws.client.WsResponse; @@ -36,39 +36,39 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class WsTestUtil { - public static void mockStream(BatchWsClient mock, String path, InputStream is) { + public static void mockStream(ScannerWsClient mock, String path, InputStream is) { WsResponse response = mock(WsResponse.class); when(response.contentStream()).thenReturn(is); when(mock.call(argThat(new RequestMatcher(path)))).thenReturn(response); } - public static void mockStream(BatchWsClient mock, InputStream is) { + public static void mockStream(ScannerWsClient mock, InputStream is) { WsResponse response = mock(WsResponse.class); when(response.contentStream()).thenReturn(is); when(mock.call(any(WsRequest.class))).thenReturn(response); } - public static void mockReader(BatchWsClient mock, Reader reader) { + public static void mockReader(ScannerWsClient mock, Reader reader) { WsResponse response = mock(WsResponse.class); when(response.contentReader()).thenReturn(reader); when(mock.call(any(WsRequest.class))).thenReturn(response); } - public static void mockReader(BatchWsClient mock, String path, Reader reader) { + public static void mockReader(ScannerWsClient mock, String path, Reader reader) { WsResponse response = mock(WsResponse.class); when(response.contentReader()).thenReturn(reader); when(mock.call(argThat(new RequestMatcher(path)))).thenReturn(response); } - public static void mockException(BatchWsClient mock, Exception e) { + public static void mockException(ScannerWsClient mock, Exception e) { when(mock.call(any(WsRequest.class))).thenThrow(e); } - public static void mockException(BatchWsClient mock, String path, Exception e) { + public static void mockException(ScannerWsClient mock, String path, Exception e) { when(mock.call(argThat(new RequestMatcher(path)))).thenThrow(e); } - public static void verifyCall(BatchWsClient mock, String path) { + public static void verifyCall(ScannerWsClient mock, String path) { verify(mock).call(argThat(new RequestMatcher(path))); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java index d278fcaeb81..0978c5441fb 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.when; public class ExtensionInstallerTest { GlobalMode mode; - BatchPluginRepository pluginRepository = mock(BatchPluginRepository.class); + ScannerPluginRepository pluginRepository = mock(ScannerPluginRepository.class); private static SonarPlugin newPluginInstance(final Object... extensions) { return new SonarPlugin() { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchExtensionDictionnaryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnaryTest.java index bcd5ce59dc7..28b9321deaa 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchExtensionDictionnaryTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerExtensionDictionnaryTest.java @@ -37,7 +37,7 @@ import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.postjob.PostJobContext; import org.sonar.api.resources.Project; import org.sonar.core.platform.ComponentContainer; -import org.sonar.scanner.bootstrap.BatchExtensionDictionnary; +import org.sonar.scanner.bootstrap.ScannerExtensionDictionnary; import org.sonar.scanner.bootstrap.ExtensionMatcher; import org.sonar.scanner.postjob.PostJobOptimizer; import org.sonar.scanner.sensor.DefaultSensorContext; @@ -47,14 +47,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; -public class BatchExtensionDictionnaryTest { +public class ScannerExtensionDictionnaryTest { - private BatchExtensionDictionnary newSelector(Object... extensions) { + private ScannerExtensionDictionnary newSelector(Object... extensions) { ComponentContainer iocContainer = new ComponentContainer(); for (Object extension : extensions) { iocContainer.addSingleton(extension); } - return new BatchExtensionDictionnary(iocContainer, mock(DefaultSensorContext.class), mock(SensorOptimizer.class), mock(PostJobContext.class), + return new ScannerExtensionDictionnary(iocContainer, mock(DefaultSensorContext.class), mock(SensorOptimizer.class), mock(PostJobContext.class), mock(PostJobOptimizer.class)); } @@ -63,7 +63,7 @@ public class BatchExtensionDictionnaryTest { final Sensor sensor1 = new FakeSensor(); final Sensor sensor2 = new FakeSensor(); - BatchExtensionDictionnary selector = newSelector(sensor1, sensor2); + ScannerExtensionDictionnary selector = newSelector(sensor1, sensor2); Collection<Sensor> sensors = selector.select(Sensor.class, null, true, new ExtensionMatcher() { @Override public boolean accept(Object extension) { @@ -81,7 +81,7 @@ public class BatchExtensionDictionnaryTest { Sensor sensor2 = new FakeSensor(); Decorator decorator = mock(Decorator.class); - BatchExtensionDictionnary selector = newSelector(sensor1, sensor2, decorator); + ScannerExtensionDictionnary selector = newSelector(sensor1, sensor2, decorator); Collection<Sensor> sensors = selector.select(Sensor.class, null, true, null); assertThat(sensors).containsOnly(sensor1, sensor2); @@ -102,7 +102,7 @@ public class BatchExtensionDictionnaryTest { ComponentContainer child = parent.createChild(); child.addSingleton(c); - BatchExtensionDictionnary dictionnary = new BatchExtensionDictionnary(child, mock(DefaultSensorContext.class), mock(SensorOptimizer.class), mock(PostJobContext.class), + ScannerExtensionDictionnary dictionnary = new ScannerExtensionDictionnary(child, mock(DefaultSensorContext.class), mock(SensorOptimizer.class), mock(PostJobContext.class), mock(PostJobOptimizer.class)); assertThat(dictionnary.select(Sensor.class, null, true, null)).containsOnly(a, b, c); } @@ -113,7 +113,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension b = new MethodDependentOf(a); BatchExtension c = new MethodDependentOf(b); - BatchExtensionDictionnary selector = newSelector(b, c, a); + ScannerExtensionDictionnary selector = newSelector(b, c, a); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(3); @@ -127,7 +127,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension a = new GeneratesSomething("foo"); BatchExtension b = new MethodDependentOf("foo"); - BatchExtensionDictionnary selector = newSelector(a, b); + ScannerExtensionDictionnary selector = newSelector(a, b); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions.size()).isEqualTo(2); @@ -148,7 +148,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension a = new GeneratesSomething("foo"); BatchExtension b = new MethodDependentOf(Arrays.asList("foo")); - BatchExtensionDictionnary selector = newSelector(a, b); + ScannerExtensionDictionnary selector = newSelector(a, b); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(2); @@ -169,7 +169,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension a = new GeneratesSomething("foo"); BatchExtension b = new MethodDependentOf(new String[] {"foo"}); - BatchExtensionDictionnary selector = newSelector(a, b); + ScannerExtensionDictionnary selector = newSelector(a, b); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(2); @@ -190,7 +190,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension a = new ClassDependedUpon(); BatchExtension b = new ClassDependsUpon(); - BatchExtensionDictionnary selector = newSelector(a, b); + ScannerExtensionDictionnary selector = newSelector(a, b); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(2); @@ -213,7 +213,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension b = new InterfaceDependsUpon() { }; - BatchExtensionDictionnary selector = newSelector(a, b); + ScannerExtensionDictionnary selector = newSelector(a, b); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(2); @@ -234,7 +234,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension ok = new CheckProjectOK(); BatchExtension ko = new CheckProjectKO(); - BatchExtensionDictionnary selector = newSelector(ok, ko); + ScannerExtensionDictionnary selector = newSelector(ok, ko); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, new Project("key"), true, null)); assertThat(extensions).hasSize(1); @@ -246,7 +246,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension a = new SubClass("foo"); BatchExtension b = new MethodDependentOf("foo"); - BatchExtensionDictionnary selector = newSelector(b, a); + ScannerExtensionDictionnary selector = newSelector(b, a); List<BatchExtension> extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(2); @@ -264,7 +264,7 @@ public class BatchExtensionDictionnaryTest { @Test(expected = IllegalStateException.class) public void annotatedMethodsCanNotBePrivate() { - BatchExtensionDictionnary selector = newSelector(); + ScannerExtensionDictionnary selector = newSelector(); BatchExtension wrong = new BatchExtension() { @DependsUpon private Object foo() { @@ -280,7 +280,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension analyze = new GeneratesSomething("something"); BatchExtension post = new PostSensor(); - BatchExtensionDictionnary selector = newSelector(analyze, post, pre); + ScannerExtensionDictionnary selector = newSelector(analyze, post, pre); List extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(3); @@ -295,7 +295,7 @@ public class BatchExtensionDictionnaryTest { BatchExtension analyze = new GeneratesSomething("something"); BatchExtension post = new PostSensorSubclass(); - BatchExtensionDictionnary selector = newSelector(analyze, post, pre); + ScannerExtensionDictionnary selector = newSelector(analyze, post, pre); List extensions = Lists.newArrayList(selector.select(BatchExtension.class, null, true, null)); assertThat(extensions).hasSize(3); @@ -311,7 +311,7 @@ public class BatchExtensionDictionnaryTest { } }; - BatchExtensionDictionnary selector = newSelector(new FakePostJob(), checker, new FakePostJob()); + ScannerExtensionDictionnary selector = newSelector(new FakePostJob(), checker, new FakePostJob()); List extensions = Lists.newArrayList(selector.select(PostJob.class, null, true, null)); assertThat(extensions).hasSize(3); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginInstallerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginInstallerTest.java index 26ce5733907..f4e8706c987 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginInstallerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginInstallerTest.java @@ -37,7 +37,7 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class BatchPluginInstallerTest { +public class ScannerPluginInstallerTest { @Rule public TemporaryFolder temp = new TemporaryFolder(); @@ -46,18 +46,18 @@ public class BatchPluginInstallerTest { public ExpectedException thrown = ExpectedException.none(); private FileCache fileCache = mock(FileCache.class); - private BatchWsClient wsClient; - private BatchPluginPredicate pluginPredicate = mock(BatchPluginPredicate.class); + private ScannerWsClient wsClient; + private ScannerPluginPredicate pluginPredicate = mock(ScannerPluginPredicate.class); @Before public void setUp() { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); } @Test public void listRemotePlugins() { WsTestUtil.mockReader(wsClient, "/deploy/plugins/index.txt", new StringReader("checkstyle\nsqale")); - BatchPluginInstaller underTest = new BatchPluginInstaller(wsClient, fileCache, pluginPredicate); + ScannerPluginInstaller underTest = new ScannerPluginInstaller(wsClient, fileCache, pluginPredicate); List<RemotePlugin> remotePlugins = underTest.listRemotePlugins(); assertThat(remotePlugins).extracting("key").containsOnly("checkstyle", "sqale"); @@ -68,7 +68,7 @@ public class BatchPluginInstallerTest { File pluginJar = temp.newFile(); when(fileCache.get(eq("checkstyle-plugin.jar"), eq("fakemd5_1"), any(FileCache.Downloader.class))).thenReturn(pluginJar); - BatchPluginInstaller underTest = new BatchPluginInstaller(wsClient, fileCache, pluginPredicate); + ScannerPluginInstaller underTest = new ScannerPluginInstaller(wsClient, fileCache, pluginPredicate); RemotePlugin remote = new RemotePlugin("checkstyle").setFile("checkstyle-plugin.jar", "fakemd5_1"); File file = underTest.download(remote); @@ -81,6 +81,6 @@ public class BatchPluginInstallerTest { WsTestUtil.mockException(wsClient, "/deploy/plugins/index.txt", new IllegalStateException()); thrown.expect(IllegalStateException.class); - new BatchPluginInstaller(wsClient, fileCache, pluginPredicate).installRemotes(); + new ScannerPluginInstaller(wsClient, fileCache, pluginPredicate).installRemotes(); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginJarExploderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java index 2230f8cf739..38dba3eadd7 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginJarExploderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest.java @@ -30,24 +30,24 @@ import org.sonar.core.platform.ExplodedPlugin; import org.sonar.core.platform.PluginInfo; import org.sonar.home.cache.FileCache; import org.sonar.home.cache.FileCacheBuilder; -import org.sonar.scanner.bootstrap.BatchPluginJarExploder; +import org.sonar.scanner.bootstrap.ScannerPluginJarExploder; import org.sonar.scanner.bootstrap.Slf4jLogger; import static org.assertj.core.api.Assertions.assertThat; -public class BatchPluginJarExploderTest { +public class ScannerPluginJarExploderTest { @ClassRule public static TemporaryFolder temp = new TemporaryFolder(); File userHome; - BatchPluginJarExploder underTest; + ScannerPluginJarExploder underTest; @Before public void setUp() throws IOException { userHome = temp.newFolder(); FileCache fileCache = new FileCacheBuilder(new Slf4jLogger()).setUserHome(userHome).build(); - underTest = new BatchPluginJarExploder(fileCache); + underTest = new ScannerPluginJarExploder(fileCache); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginPredicateTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java index 01f32880499..6722a6e6fb0 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginPredicateTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginPredicateTest.java @@ -28,14 +28,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class BatchPluginPredicateTest { +public class ScannerPluginPredicateTest { Settings settings = new MapSettings(); GlobalMode mode = mock(GlobalMode.class); @Test public void accept_if_no_inclusions_nor_exclusions() { - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.getWhites()).isEmpty(); assertThat(predicate.getBlacks()).isEmpty(); assertThat(predicate.apply("pmd")).isTrue(); @@ -45,7 +45,7 @@ public class BatchPluginPredicateTest { @Test public void exclude_buildbreaker_in_preview_mode() { when(mode.isPreview()).thenReturn(true); - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.apply("buildbreaker")).isFalse(); } @@ -55,7 +55,7 @@ public class BatchPluginPredicateTest { settings .setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle,pmd,findbugs") .setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura,pmd"); - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.apply("pmd")).isTrue(); } @@ -65,7 +65,7 @@ public class BatchPluginPredicateTest { settings .setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle,pmd,findbugs") .setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura"); - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.apply("checkstyle")).isTrue(); assertThat(predicate.apply("pmd")).isTrue(); assertThat(predicate.apply("cobertura")).isFalse(); @@ -77,7 +77,7 @@ public class BatchPluginPredicateTest { settings .setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle,pmd,findbugs") .setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura"); - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.apply("checkstyle")).isTrue(); assertThat(predicate.apply("pmd")).isTrue(); assertThat(predicate.apply("cobertura")).isFalse(); @@ -87,7 +87,7 @@ public class BatchPluginPredicateTest { public void test_exclusions_without_any_inclusions() { when(mode.isPreview()).thenReturn(true); settings.setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "checkstyle,pmd,findbugs"); - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.apply("checkstyle")).isFalse(); assertThat(predicate.apply("pmd")).isFalse(); assertThat(predicate.apply("cobertura")).isTrue(); @@ -98,7 +98,7 @@ public class BatchPluginPredicateTest { settings .setProperty(CoreProperties.PREVIEW_INCLUDE_PLUGINS, "checkstyle, pmd, findbugs") .setProperty(CoreProperties.PREVIEW_EXCLUDE_PLUGINS, "cobertura, pmd"); - BatchPluginPredicate predicate = new BatchPluginPredicate(settings, mode); + ScannerPluginPredicate predicate = new ScannerPluginPredicate(settings, mode); assertThat(predicate.apply("pmd")).isTrue(); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginRepositoryTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java index 9ccbcf6c52e..3048a4bddb3 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchPluginRepositoryTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerPluginRepositoryTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.sonar.api.Plugin; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginLoader; -import org.sonar.scanner.bootstrap.BatchPluginRepository; +import org.sonar.scanner.bootstrap.ScannerPluginRepository; import org.sonar.scanner.bootstrap.PluginInstaller; import static org.assertj.core.api.Assertions.assertThat; @@ -34,11 +34,11 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class BatchPluginRepositoryTest { +public class ScannerPluginRepositoryTest { PluginInstaller installer = mock(PluginInstaller.class); PluginLoader loader = mock(PluginLoader.class); - BatchPluginRepository underTest = new BatchPluginRepository(installer, loader); + ScannerPluginRepository underTest = new ScannerPluginRepository(installer, loader); @Test public void install_and_load_plugins() { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchWsClientProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerWsClientProviderTest.java index 5719c8b65a7..add977916aa 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchWsClientProviderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerWsClientProviderTest.java @@ -19,6 +19,7 @@ */ package org.sonar.scanner.bootstrap; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.junit.Test; @@ -27,16 +28,16 @@ import org.sonarqube.ws.client.HttpConnector; import static org.assertj.core.api.Assertions.assertThat; -public class BatchWsClientProviderTest { +public class ScannerWsClientProviderTest { - private BatchWsClientProvider underTest = new BatchWsClientProvider(); + private ScannerWsClientProvider underTest = new ScannerWsClientProvider(); private EnvironmentInformation env = new EnvironmentInformation("Maven Plugin", "2.3"); @Test public void provide_client_with_default_settings() { GlobalProperties settings = new GlobalProperties(new HashMap<>()); - BatchWsClient client = underTest.provide(settings, env); + ScannerWsClient client = underTest.provide(settings, env, new GlobalMode(new GlobalProperties(Collections.emptyMap()))); assertThat(client).isNotNull(); assertThat(client.baseUrl()).isEqualTo("http://localhost:9000/"); @@ -56,7 +57,7 @@ public class BatchWsClientProviderTest { props.put("sonar.ws.timeout", "42"); GlobalProperties settings = new GlobalProperties(props); - BatchWsClient client = underTest.provide(settings, env); + ScannerWsClient client = underTest.provide(settings, env, new GlobalMode(new GlobalProperties(Collections.emptyMap()))); assertThat(client).isNotNull(); HttpConnector httpConnector = (HttpConnector) client.wsConnector(); @@ -67,8 +68,8 @@ public class BatchWsClientProviderTest { @Test public void build_singleton() { GlobalProperties settings = new GlobalProperties(new HashMap<>()); - BatchWsClient first = underTest.provide(settings, env); - BatchWsClient second = underTest.provide(settings, env); + ScannerWsClient first = underTest.provide(settings, env, new GlobalMode(new GlobalProperties(Collections.emptyMap()))); + ScannerWsClient second = underTest.provide(settings, env, new GlobalMode(new GlobalProperties(Collections.emptyMap()))); assertThat(first).isSameAs(second); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchWsClientTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerWsClientTest.java index bc1459e6924..d0e4cea59db 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/BatchWsClientTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ScannerWsClientTest.java @@ -19,6 +19,7 @@ */ package org.sonar.scanner.bootstrap; +import java.util.Collections; import java.util.List; import org.junit.Rule; import org.junit.Test; @@ -27,7 +28,6 @@ import org.mockito.Mockito; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.scanner.bootstrap.BatchWsClient; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.MockWsResponse; import org.sonarqube.ws.client.WsClient; @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class BatchWsClientTest { +public class ScannerWsClientTest { @Rule public LogTester logTester = new LogTester(); @@ -55,7 +55,7 @@ public class BatchWsClientTest { when(wsClient.wsConnector().call(request)).thenReturn(response); logTester.setLevel(LoggerLevel.DEBUG); - BatchWsClient underTest = new BatchWsClient(wsClient, false); + ScannerWsClient underTest = new ScannerWsClient(wsClient, false, new GlobalMode(new GlobalProperties(Collections.emptyMap()))); WsResponse result = underTest.call(request); @@ -78,7 +78,7 @@ public class BatchWsClientTest { WsResponse response = newResponse().setCode(401); when(wsClient.wsConnector().call(request)).thenReturn(response); - new BatchWsClient(wsClient, false).call(request); + new ScannerWsClient(wsClient, false, new GlobalMode(new GlobalProperties(Collections.emptyMap()))).call(request); } @Test @@ -90,7 +90,7 @@ public class BatchWsClientTest { WsResponse response = newResponse().setCode(401); when(wsClient.wsConnector().call(request)).thenReturn(response); - new BatchWsClient(wsClient, /* credentials are configured */true).call(request); + new ScannerWsClient(wsClient, /* credentials are configured */true, new GlobalMode(new GlobalProperties(Collections.emptyMap()))).call(request); } @Test @@ -104,7 +104,7 @@ public class BatchWsClientTest { .setContent("{\"errors\":[{\"msg\":\"missing scan permission\"}, {\"msg\":\"missing another permission\"}]}"); when(wsClient.wsConnector().call(request)).thenReturn(response); - new BatchWsClient(wsClient, true).call(request); + new ScannerWsClient(wsClient, true, new GlobalMode(new GlobalProperties(Collections.emptyMap()))).call(request); } @Test @@ -118,7 +118,7 @@ public class BatchWsClientTest { .setContent("{\"errors\":[{\"msg\":\"Boo! bad request! bad!\"}]}"); when(wsClient.wsConnector().call(request)).thenReturn(response); - new BatchWsClient(wsClient, true).call(request); + new ScannerWsClient(wsClient, true, new GlobalMode(new GlobalProperties(Collections.emptyMap()))).call(request); } private MockWsResponse newResponse() { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoaderTest.java index 3d57fc54334..b1cb6126f08 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/tracking/DefaultServerLineHashesLoaderTest.java @@ -28,20 +28,20 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.utils.HttpDownloader; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; public class DefaultServerLineHashesLoaderTest { - private BatchWsClient wsClient; + private ScannerWsClient wsClient; @Rule public ExpectedException thrown = ExpectedException.none(); @Before public void before() { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/BatchMediumTester.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java index 4c5f93bad41..c64259117c0 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/BatchMediumTester.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/ScannerMediumTester.java @@ -19,38 +19,9 @@ */ package org.sonar.scanner.mediumtest; -import org.sonar.api.rule.RuleKey; -import org.sonar.api.utils.DateUtils; -import org.sonar.batch.bootstrapper.Batch; -import org.sonar.batch.bootstrapper.EnvironmentInformation; -import org.sonar.batch.bootstrapper.IssueListener; -import org.sonar.batch.bootstrapper.LogOutput; -import com.google.common.collect.Table; -import com.google.common.collect.HashBasedTable; -import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; -import org.apache.commons.io.FileUtils; - -import javax.annotation.Nullable; - -import org.sonarqube.ws.Rules.ListResponse.Rule; -import org.sonar.api.server.rule.RulesDefinition.Repository; -import org.sonar.api.server.rule.RulesDefinition; -import org.sonar.scanner.issue.tracking.ServerLineHashesLoader; -import org.sonar.scanner.mediumtest.FakePluginInstaller; -import org.sonar.scanner.mediumtest.TaskResult; -import org.sonar.scanner.protocol.input.GlobalRepositories; -import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; -import org.sonar.scanner.report.ReportPublisher; -import org.sonar.scanner.repository.FileData; -import org.sonar.scanner.repository.GlobalRepositoriesLoader; -import org.sonar.scanner.repository.ProjectRepositories; -import org.sonar.scanner.repository.ProjectRepositoriesLoader; -import org.sonar.scanner.repository.QualityProfileLoader; -import org.sonar.scanner.repository.ServerIssuesLoader; -import org.sonar.scanner.rule.ActiveRulesLoader; -import org.sonar.scanner.rule.LoadedActiveRule; -import org.sonar.scanner.rule.RulesLoader; import com.google.common.base.Function; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -65,19 +36,44 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; +import javax.annotation.Nullable; +import org.apache.commons.io.FileUtils; import org.sonar.api.CoreProperties; import org.sonar.api.Plugin; import org.sonar.api.batch.debt.internal.DefaultDebtModel; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; +import org.sonar.api.rule.RuleKey; +import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.api.server.rule.RulesDefinition.Repository; +import org.sonar.api.utils.DateUtils; +import org.sonar.batch.bootstrapper.Batch; +import org.sonar.batch.bootstrapper.EnvironmentInformation; +import org.sonar.batch.bootstrapper.IssueListener; +import org.sonar.batch.bootstrapper.LogOutput; +import org.sonar.scanner.bootstrap.GlobalMode; +import org.sonar.scanner.issue.tracking.ServerLineHashesLoader; +import org.sonar.scanner.protocol.input.GlobalRepositories; +import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; +import org.sonar.scanner.report.ReportPublisher; +import org.sonar.scanner.repository.FileData; +import org.sonar.scanner.repository.GlobalRepositoriesLoader; +import org.sonar.scanner.repository.ProjectRepositories; +import org.sonar.scanner.repository.ProjectRepositoriesLoader; +import org.sonar.scanner.repository.QualityProfileLoader; +import org.sonar.scanner.repository.ServerIssuesLoader; +import org.sonar.scanner.rule.ActiveRulesLoader; +import org.sonar.scanner.rule.LoadedActiveRule; +import org.sonar.scanner.rule.RulesLoader; +import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; +import org.sonarqube.ws.Rules.ListResponse.Rule; /** - * Main utility class for writing batch medium tests. + * Main utility class for writing scanner medium tests. * */ -public class BatchMediumTester { +public class ScannerMediumTester { - public static final String MEDIUM_TEST_ENABLED = "sonar.mediumTest.enabled"; private Batch batch; private static Path workingDir = null; private static Path globalWorkingDir = null; @@ -110,7 +106,7 @@ public class BatchMediumTester { } BatchMediumTesterBuilder builder = new BatchMediumTesterBuilder().registerCoreMetrics(); - builder.bootstrapProperties.put(MEDIUM_TEST_ENABLED, "true"); + builder.bootstrapProperties.put(GlobalMode.MEDIUM_TEST_ENABLED, "true"); builder.bootstrapProperties.put(ReportPublisher.KEEP_REPORT_PROP_KEY, "true"); builder.bootstrapProperties.put(CoreProperties.WORKING_DIRECTORY, workingDir.toString()); builder.bootstrapProperties.put("sonar.userHome", globalWorkingDir.toString()); @@ -130,8 +126,8 @@ public class BatchMediumTester { private boolean associated = true; private LogOutput logOutput = null; - public BatchMediumTester build() { - return new BatchMediumTester(this); + public ScannerMediumTester build() { + return new ScannerMediumTester(this); } public BatchMediumTesterBuilder setAssociated(boolean associated) { @@ -276,7 +272,7 @@ public class BatchMediumTester { batch.syncProject(projectKey); } - private BatchMediumTester(BatchMediumTesterBuilder builder) { + private ScannerMediumTester(BatchMediumTesterBuilder builder) { Batch.Builder batchBuilder = Batch.builder() .setEnableLoggingConfiguration(true) .addComponents( @@ -319,10 +315,10 @@ public class BatchMediumTester { public static class TaskBuilder { private final Map<String, String> taskProperties = new HashMap<>(); - private BatchMediumTester tester; + private ScannerMediumTester tester; private IssueListener issueListener = null; - public TaskBuilder(BatchMediumTester tester) { + public TaskBuilder(ScannerMediumTester tester) { this.tester = tester; } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java index 0422dc07f57..ba3e5e03284 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java @@ -32,7 +32,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -46,7 +46,7 @@ public class BranchMediumTest { @Rule public ExpectedException thrown = ExpectedException.none(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java index f2bc435c8fb..81484d6be3c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java @@ -31,7 +31,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.CoreMetrics; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -43,7 +43,7 @@ public class CoverageMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java index f14e6c73286..16a6428dab2 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/GenericCoverageMediumTest.java @@ -26,7 +26,7 @@ import org.junit.Before; import org.junit.Test; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.CoreMetrics; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.tuple; public class GenericCoverageMediumTest { - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java index 81f3c2b451d..49c8056ff3e 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java @@ -37,7 +37,7 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.fs.internal.DefaultInputFile; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.xoo.XooPlugin; @@ -61,7 +61,7 @@ public class CpdMediumTest { @Rule public ExpectedException thrown = ExpectedException.none(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/deprecated/DeprecatedApiMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/deprecated/DeprecatedApiMediumTest.java index e8b8fa07735..56b5ee7604e 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/deprecated/DeprecatedApiMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/deprecated/DeprecatedApiMediumTest.java @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; @@ -40,7 +40,7 @@ public class DeprecatedApiMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addRules(new XooRulesDefinition()) .addDefaultQProfile("xoo", "Sonar Way") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java index 29052149ea8..a47c22d7456 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/FileSystemMediumTest.java @@ -31,7 +31,7 @@ import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.System2; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -48,7 +48,7 @@ public class FileSystemMediumTest { @Rule public ExpectedException thrown = ExpectedException.none(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java index c1e156e8af2..9a5db0698e3 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/NoLanguagesPluginsMediumTest.java @@ -30,7 +30,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.Rule; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.issuesmode.IssueModeAndReportsMediumTest; public class NoLanguagesPluginsMediumTest { @@ -40,7 +40,7 @@ public class NoLanguagesPluginsMediumTest { @Rule public ExpectedException exception = ExpectedException.none(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .setPreviousAnalysisDate(null) .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java index 3dd0661bcdf..cb8bdc8a2bb 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java @@ -40,7 +40,7 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.bootstrap.ProjectBuilder; import org.sonar.api.utils.MessageException; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport.Issue; import org.sonar.xoo.XooPlugin; @@ -59,7 +59,7 @@ public class ProjectBuilderMediumTest { private ProjectBuilder projectBuilder = mock(ProjectBuilder.class); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPluginWithBuilder(projectBuilder)) .addRules(new XooRulesDefinition()) .addDefaultQProfile("xoo", "Sonar Way") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java index e44b7085951..1f4389dcce6 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/highlighting/HighlightingMediumTest.java @@ -33,7 +33,7 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.batch.sensor.highlighting.TypeOfText; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -47,7 +47,7 @@ public class HighlightingMediumTest { @Rule public ExpectedException exception = ExpectedException.none(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java index ac429a5ae9a..6c4066433b2 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/ChecksMediumTest.java @@ -32,7 +32,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.rule.RuleKey; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport.Issue; import org.sonar.scanner.rule.LoadedActiveRule; @@ -47,7 +47,7 @@ public class ChecksMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addRules(new XooRulesDefinition()) .addDefaultQProfile("xoo", "Sonar Way") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java index e126fd6e471..6716a5a58f0 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesIssuesModeMediumTest.java @@ -25,7 +25,7 @@ import org.junit.Before; import com.google.common.collect.ImmutableMap; import org.sonar.api.CoreProperties; import org.sonar.batch.bootstrapper.IssueListener; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; @@ -42,7 +42,7 @@ public class IssuesIssuesModeMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester testerPreview = BatchMediumTester.builder() + public ScannerMediumTester testerPreview = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addRules(new XooRulesDefinition()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java index ffa97e299f5..ababb9c1897 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesMediumTest.java @@ -30,7 +30,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.batch.bootstrapper.IssueListener; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport.Issue; import org.sonar.xoo.XooPlugin; @@ -44,7 +44,7 @@ public class IssuesMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addRules(new XooRulesDefinition()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java index e9ee9fa2bef..e64ea131571 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnDirMediumTest.java @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; @@ -39,7 +39,7 @@ public class IssuesOnDirMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addRules(new XooRulesDefinition()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java index eb35142bd4a..784332c52e8 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/IssuesOnModuleMediumTest.java @@ -27,7 +27,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; @@ -39,7 +39,7 @@ public class IssuesOnModuleMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addRules(new XooRulesDefinition()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java index fcb00486a56..2f3c36a3a38 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issues/MultilineIssuesMediumTest.java @@ -26,7 +26,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport.Flow; import org.sonar.scanner.protocol.output.ScannerReport.Issue; @@ -41,7 +41,7 @@ public class MultilineIssuesMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addRules(new XooRulesDefinition()) .addDefaultQProfile("xoo", "Sonar Way") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java index 9bd3670e6bb..1a01975fbdb 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/EmptyFileTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.CoreProperties; import org.sonar.api.utils.log.LogTester; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.issue.tracking.TrackedIssue; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -48,7 +48,7 @@ public class EmptyFileTest { @Rule public LogTester logTester = new LogTester(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) .registerPlugin("xoo", new XooPlugin()) .addRules(new XooRulesDefinition()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java index 031c2cf4472..be6739793c6 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/IssueModeAndReportsMediumTest.java @@ -40,7 +40,7 @@ import org.sonar.api.CoreProperties; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.batch.bootstrapper.IssueListener; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.issue.tracking.TrackedIssue; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.Constants.Severity; @@ -69,7 +69,7 @@ public class IssueModeAndReportsMediumTest { } } - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java index 00762818175..65af30784e9 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/NoPreviousAnalysisTest.java @@ -34,7 +34,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.CoreProperties; import org.sonar.api.utils.log.LogTester; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; import org.sonar.xoo.rule.XooRulesDefinition; @@ -46,7 +46,7 @@ public class NoPreviousAnalysisTest { @Rule public LogTester logTester = new LogTester(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) .registerPlugin("xoo", new XooPlugin()) .addRules(new XooRulesDefinition()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java index d67d035627f..ee821cf8ac5 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/issuesmode/ScanOnlyChangedTest.java @@ -36,7 +36,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.CoreProperties; import org.sonar.api.utils.log.LogTester; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.issue.tracking.TrackedIssue; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.Constants.Severity; @@ -56,7 +56,7 @@ public class ScanOnlyChangedTest { private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - private BatchMediumTester tester; + private ScannerMediumTester tester; private static Long date(String date) { try { @@ -72,7 +72,7 @@ public class ScanOnlyChangedTest { String md5sum = DigestUtils.md5Hex(FileUtils.readFileToString(new File( Resources.getResource("mediumtest/xoo/sample/" + filePath).getPath()))); - tester = BatchMediumTester.builder() + tester = ScannerMediumTester.builder() .bootstrapProperties(ImmutableMap.of(CoreProperties.ANALYSIS_MODE, CoreProperties.ANALYSIS_MODE_ISSUES)) .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java index b695744dce0..42f4aa010da 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/log/LogListenerTest.java @@ -39,7 +39,7 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.batch.bootstrapper.LogOutput; import org.sonar.batch.bootstrapper.LogOutput.Level; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.xoo.XooPlugin; import static org.assertj.core.api.Assertions.assertThat; @@ -60,7 +60,7 @@ public class LogListenerTest { private static PrintStream savedStdOut; private static PrintStream savedStdErr; - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .setLogOutput(new SimpleLogListener()) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java index 11da3d60ee2..de4ecaac496 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/measures/MeasuresMediumTest.java @@ -33,7 +33,7 @@ import org.junit.rules.TemporaryFolder; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport.Measure; import org.sonar.xoo.XooPlugin; @@ -53,7 +53,7 @@ public class MeasuresMediumTest { private File baseDir; private File srcDir; - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java index 9adf9ad9c34..f0462e6206b 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/scm/ScmMediumTest.java @@ -32,8 +32,8 @@ import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.sonar.api.utils.PathUtils; import org.sonar.api.utils.log.LogTester; -import org.sonar.scanner.mediumtest.BatchMediumTester; -import org.sonar.scanner.mediumtest.BatchMediumTester.TaskBuilder; +import org.sonar.scanner.mediumtest.ScannerMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester.TaskBuilder; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.protocol.output.ScannerReport.Changesets.Changeset; import org.sonar.scanner.repository.FileData; @@ -61,7 +61,7 @@ public class ScmMediumTest { @Rule public LogTester logTester = new LogTester(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .addFileData("com.foo.project", CHANGED_CONTENT_SCM_ON_SERVER_XOO, new FileData(DigestUtils.md5Hex(SAMPLE_XOO_CONTENT), null)) diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java index 7988dd42542..493a2530163 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/symbol/SymbolMediumTest.java @@ -28,7 +28,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.xoo.XooPlugin; @@ -40,7 +40,7 @@ public class SymbolMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java index 735d5ed0b43..fb32b2e4b41 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tasks/TasksMediumTest.java @@ -33,7 +33,7 @@ import org.sonar.api.task.TaskDefinition; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.LogTester; import org.sonar.scanner.bootstrap.MockHttpServer; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import static org.assertj.core.api.Assertions.assertThat; @@ -45,7 +45,7 @@ public class TasksMediumTest { @Rule public LogTester logTester = new LogTester(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("faketask", new FakeTaskPlugin()) .build(); @@ -96,7 +96,7 @@ public class TasksMediumTest { @Test(expected = MessageException.class) public void unsupportedTask() throws Exception { - tester = BatchMediumTester.builder() + tester = ScannerMediumTester.builder() .build(); tester.start(); tester.newTask() diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java index bc32a1c5ac6..5be87117ae9 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/CoveragePerTestMediumTest.java @@ -31,7 +31,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.xoo.XooPlugin; @@ -48,7 +48,7 @@ public class CoveragePerTestMediumTest { @Rule public ExpectedException exception = ExpectedException.none(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java index 4fbc46d350e..1f9ba8326a5 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/GenericTestExecutionMediumTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.CoreMetrics; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.protocol.output.ScannerReport.Test.TestStatus; @@ -43,7 +43,7 @@ public class GenericTestExecutionMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/TestExecutionMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/TestExecutionMediumTest.java index afd1f77ed06..5649bf6e16c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/TestExecutionMediumTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/tests/TestExecutionMediumTest.java @@ -28,7 +28,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.batch.fs.InputFile; -import org.sonar.scanner.mediumtest.BatchMediumTester; +import org.sonar.scanner.mediumtest.ScannerMediumTester; import org.sonar.scanner.mediumtest.TaskResult; import org.sonar.scanner.protocol.output.ScannerReport.Test.TestStatus; import org.sonar.xoo.XooPlugin; @@ -40,7 +40,7 @@ public class TestExecutionMediumTest { @org.junit.Rule public TemporaryFolder temp = new TemporaryFolder(); - public BatchMediumTester tester = BatchMediumTester.builder() + public ScannerMediumTester tester = ScannerMediumTester.builder() .registerPlugin("xoo", new XooPlugin()) .addDefaultQProfile("xoo", "Sonar Way") .build(); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java index fff15a158d9..4c5f4210d54 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/PostJobsExecutorTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.sonar.api.batch.PostJob; 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 org.sonar.scanner.phases.PostJobsExecutor; import java.util.Arrays; @@ -37,7 +37,7 @@ public class PostJobsExecutorTest { PostJobsExecutor executor; Project project = new Project("project"); - BatchExtensionDictionnary selector = mock(BatchExtensionDictionnary.class); + ScannerExtensionDictionnary selector = mock(ScannerExtensionDictionnary.class); PostJob job1 = mock(PostJob.class); PostJob job2 = mock(PostJob.class); SensorContext context = mock(SensorContext.class); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java index e743714e568..d887bf3f920 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/platform/DefaultServerTest.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.sonar.api.CoreProperties; import org.sonar.api.config.Settings; import org.sonar.api.config.MapSettings; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -38,7 +38,7 @@ public class DefaultServerTest { settings.setProperty(CoreProperties.SERVER_VERSION, "2.2"); settings.setProperty(CoreProperties.SERVER_STARTTIME, "2010-05-18T17:59:00+0000"); settings.setProperty(CoreProperties.PERMANENT_SERVER_ID, "abcde"); - BatchWsClient client = mock(BatchWsClient.class); + ScannerWsClient client = mock(ScannerWsClient.class); when(client.baseUrl()).thenReturn("http://foo.com"); DefaultServer metadata = new DefaultServer(settings, client); @@ -59,7 +59,7 @@ public class DefaultServerTest { @Test public void publicRootUrl() { Settings settings = new MapSettings(); - BatchWsClient client = mock(BatchWsClient.class); + ScannerWsClient client = mock(ScannerWsClient.class); when(client.baseUrl()).thenReturn("http://foo.com/"); DefaultServer metadata = new DefaultServer(settings, client); @@ -74,7 +74,7 @@ public class DefaultServerTest { public void invalid_startup_date_throws_exception() { Settings settings = new MapSettings(); settings.setProperty(CoreProperties.SERVER_STARTTIME, "invalid"); - BatchWsClient client = mock(BatchWsClient.class); + ScannerWsClient client = mock(ScannerWsClient.class); DefaultServer metadata = new DefaultServer(settings, client); metadata.getStartedAt(); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java index 67a4906f974..48515e786b1 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java @@ -35,7 +35,7 @@ import org.sonar.api.utils.System2; import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; 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.report.AnalysisContextReportPublisher; @@ -60,7 +60,7 @@ public class AnalysisContextReportPublisherTest { @Rule public TemporaryFolder temp = new TemporaryFolder(); - private BatchPluginRepository pluginRepo = mock(BatchPluginRepository.class); + private ScannerPluginRepository pluginRepo = mock(ScannerPluginRepository.class); private AnalysisContextReportPublisher publisher; private AnalysisMode analysisMode = mock(AnalysisMode.class); private System2 system2; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java index 7ff2e9403b1..35e4c6a986e 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java @@ -40,7 +40,7 @@ import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.core.config.CorePropertyDefinitions; import org.sonar.scanner.analysis.DefaultAnalysisMode; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.scan.ImmutableProjectReactor; import static org.apache.commons.io.FileUtils.readFileToString; @@ -61,7 +61,7 @@ public class ReportPublisherTest { DefaultAnalysisMode mode = mock(DefaultAnalysisMode.class); Settings settings = new MapSettings(new PropertyDefinitions(CorePropertyDefinitions.all())); - BatchWsClient wsClient = mock(BatchWsClient.class, Mockito.RETURNS_DEEP_STUBS); + ScannerWsClient wsClient = mock(ScannerWsClient.class, Mockito.RETURNS_DEEP_STUBS); Server server = mock(Server.class); ImmutableProjectReactor reactor = mock(ImmutableProjectReactor.class); ProjectDefinition root; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoaderTest.java index 32294620a05..3dc7cf3f337 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultGlobalRepositoriesLoaderTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.GlobalRepositories; import static org.mockito.Matchers.any; @@ -38,7 +38,7 @@ import static org.mockito.Mockito.when; public class DefaultGlobalRepositoriesLoaderTest { private static final String BATCH_GLOBAL_URL = "/batch/global"; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; private DefaultGlobalRepositoriesLoader globalRepositoryLoader; @Rule @@ -46,7 +46,7 @@ public class DefaultGlobalRepositoriesLoaderTest { @Before public void setUp() { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); WsTestUtil.mockReader(wsClient, BATCH_GLOBAL_URL, new StringReader(new GlobalRepositories().toJson())); globalRepositoryLoader = new DefaultGlobalRepositoriesLoader(wsClient); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java index 3259d288083..a9821224fb1 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultProjectRepositoriesLoaderTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.utils.MessageException; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonarqube.ws.WsBatch.WsProjectResponse; import org.sonarqube.ws.client.HttpException; import org.sonarqube.ws.client.WsRequest; @@ -46,11 +46,11 @@ public class DefaultProjectRepositoriesLoaderTest { public ExpectedException thrown = ExpectedException.none(); private DefaultProjectRepositoriesLoader loader; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; @Before public void prepare() throws IOException { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); InputStream is = mockData(); WsTestUtil.mockStream(wsClient, "/batch/project.protobuf?key=foo%3F", is); loader = new DefaultProjectRepositoriesLoader(wsClient); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java index 448b47c1426..378adda80a1 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultQualityProfileLoaderTest.java @@ -25,7 +25,7 @@ import org.sonarqube.ws.QualityProfiles; import com.google.common.io.Resources; import org.sonarqube.ws.QualityProfiles.SearchWsResponse.QualityProfile; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.repository.DefaultQualityProfileLoader; import org.junit.Rule; import org.junit.rules.ExpectedException; @@ -48,12 +48,12 @@ public class DefaultQualityProfileLoaderTest { public ExpectedException exception = ExpectedException.none(); private DefaultQualityProfileLoader qpLoader; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; private InputStream is; @Before public void setUp() throws IOException { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); is = mock(InputStream.class); when(is.read()).thenReturn(-1); WsTestUtil.mockStream(wsClient, "/api/qualityprofiles/search.protobuf?projectKey=foo%232&profileName=my-profile%232", is); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java index 1eade771f6a..00351ef8e61 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/DefaultServerIssuesLoaderTest.java @@ -20,7 +20,7 @@ package org.sonar.scanner.repository; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.ScannerInput; import org.sonar.scanner.protocol.input.ScannerInput.ServerIssue; import org.sonar.scanner.repository.DefaultServerIssuesLoader; @@ -40,11 +40,11 @@ import static org.mockito.Mockito.when; public class DefaultServerIssuesLoaderTest { private DefaultServerIssuesLoader loader; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; @Before public void prepare() { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); loader = new DefaultServerIssuesLoader(wsClient); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/user/UserRepositoryLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/user/UserRepositoryLoaderTest.java index 3195a904e68..40c944ee8d8 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/user/UserRepositoryLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/repository/user/UserRepositoryLoaderTest.java @@ -20,7 +20,7 @@ package org.sonar.scanner.repository.user; import org.assertj.core.util.Lists; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.input.ScannerInput; import org.sonar.scanner.repository.user.UserRepositoryLoader; import org.sonar.scanner.WsTestUtil; @@ -45,12 +45,12 @@ public class UserRepositoryLoaderTest { @Rule public final ExpectedException exception = ExpectedException.none(); - private BatchWsClient wsClient; + private ScannerWsClient wsClient; private UserRepositoryLoader userRepo; @Before public void setUp() { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); userRepo = new UserRepositoryLoader(wsClient); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java index 5b7f1b6bc61..18d6081f02c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultActiveRulesLoaderTest.java @@ -21,7 +21,7 @@ package org.sonar.scanner.rule; import org.sonar.api.rule.RuleKey; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.rule.DefaultActiveRulesLoader; import org.sonar.scanner.rule.LoadedActiveRule; import com.google.common.io.Resources; @@ -38,11 +38,11 @@ import org.junit.Before; public class DefaultActiveRulesLoaderTest { private DefaultActiveRulesLoader loader; - private BatchWsClient wsClient; + private ScannerWsClient wsClient; @Before public void setUp() { - wsClient = mock(BatchWsClient.class); + wsClient = mock(ScannerWsClient.class); loader = new DefaultActiveRulesLoader(wsClient); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java index e289211e79f..7adc768ec35 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/rule/DefaultRulesLoaderTest.java @@ -27,7 +27,7 @@ import java.util.List; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.scanner.WsTestUtil; -import org.sonar.scanner.bootstrap.BatchWsClient; +import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonarqube.ws.Rules.ListResponse.Rule; import static org.assertj.core.api.Assertions.assertThat; @@ -39,7 +39,7 @@ public class DefaultRulesLoaderTest { @Test public void testParseServerResponse() throws IOException { - BatchWsClient wsClient = mock(BatchWsClient.class); + ScannerWsClient wsClient = mock(ScannerWsClient.class); InputStream is = Resources.asByteSource(this.getClass().getResource("DefaultRulesLoaderTest/response.protobuf")).openBufferedStream(); WsTestUtil.mockStream(wsClient, is); DefaultRulesLoader loader = new DefaultRulesLoader(wsClient); @@ -49,7 +49,7 @@ public class DefaultRulesLoaderTest { @Test public void testError() throws IOException { - BatchWsClient wsClient = mock(BatchWsClient.class); + ScannerWsClient wsClient = mock(ScannerWsClient.class); InputStream is = ByteSource.wrap(new String("trash").getBytes()).openBufferedStream(); WsTestUtil.mockStream(wsClient, is); DefaultRulesLoader loader = new DefaultRulesLoader(wsClient); diff --git a/sonar-scanner-engine/src/test/resources/org/sonar/scanner/bootstrap/BatchPluginJarExploderTest/sonar-checkstyle-plugin-2.8.jar b/sonar-scanner-engine/src/test/resources/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest/sonar-checkstyle-plugin-2.8.jar Binary files differindex f937399bec5..f937399bec5 100644 --- a/sonar-scanner-engine/src/test/resources/org/sonar/scanner/bootstrap/BatchPluginJarExploderTest/sonar-checkstyle-plugin-2.8.jar +++ b/sonar-scanner-engine/src/test/resources/org/sonar/scanner/bootstrap/ScannerPluginJarExploderTest/sonar-checkstyle-plugin-2.8.jar |