aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2023-12-22 10:28:22 +0100
committersonartech <sonartech@sonarsource.com>2023-12-22 20:03:01 +0000
commit6c6de5ad4fac7a44abcc6a0ae7d9cb5c7a53da51 (patch)
tree43710bdc5975d01b9336c229d0aa68a0fa66f4e2 /sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest
parent83fe248f66dcc3a909eb411f917795c054445723 (diff)
downloadsonarqube-6c6de5ad4fac7a44abcc6a0ae7d9cb5c7a53da51.tar.gz
sonarqube-6c6de5ad4fac7a44abcc6a0ae7d9cb5c7a53da51.zip
Revert "SONAR-21195 Enhance scanner engine to download only required plugins"
This reverts commit 981e6b85954f413666e8608a4e2f46fa2e4089cc.
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest')
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakeLanguagesRepository.java83
-rw-r--r--sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakePluginInstaller.java13
2 files changed, 1 insertions, 95 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakeLanguagesRepository.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakeLanguagesRepository.java
deleted file mode 100644
index 7443db29fa3..00000000000
--- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/mediumtest/FakeLanguagesRepository.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info 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.mediumtest;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Priority;
-import org.jetbrains.annotations.Nullable;
-import org.sonar.api.resources.Languages;
-import org.sonar.scanner.repository.language.Language;
-import org.sonar.scanner.repository.language.LanguagesRepository;
-import org.sonar.scanner.repository.language.SupportedLanguageDto;
-
-@Priority(1)
-public class FakeLanguagesRepository implements LanguagesRepository {
-
- private final Map<String, Language> languageMap = new HashMap<>();
-
- public FakeLanguagesRepository() {
- languageMap.put("xoo", new Language(new FakeLanguage("xoo", "xoo", new String[] { ".xoo" }, new String[0], true)));
- }
-
- public FakeLanguagesRepository(Languages languages) {
- for (org.sonar.api.resources.Language language : languages.all()) {
- languageMap.put(language.getKey(), new Language(new FakeLanguage(language.getKey(), language.getName(), language.getFileSuffixes(), language.filenamePatterns(), true)));
- }
- }
-
- @Nullable
- @Override
- public Language get(String languageKey) {
- return languageMap.get(languageKey);
- }
-
- @Override
- public Collection<Language> all() {
- return languageMap.values().stream()
- // sorted for test consistency
- .sorted(Comparator.comparing(Language::key)).toList();
- }
-
- public void addLanguage(String key, String name, String[] suffixes, String[] filenamePatterns) {
- languageMap.put(key, new Language(new FakeLanguage(key, name, suffixes, filenamePatterns, true)));
- }
-
- public void addLanguage(String key, String name, String[] suffixes, String[] filenamePatterns, boolean publishAllFiles) {
- languageMap.put(key, new Language(new FakeLanguage(key, name, suffixes, filenamePatterns, publishAllFiles)));
- }
-
- private static class FakeLanguage extends SupportedLanguageDto {
-
- private final boolean publishAllFiles;
-
- public FakeLanguage(String key, String name, String[] fileSuffixes, String[] filenamePatterns, boolean publishAllFiles) {
- super(key, name, fileSuffixes, filenamePatterns);
- this.publishAllFiles = publishAllFiles;
- }
-
- @Override
- public boolean publishAllFiles() {
- return publishAllFiles;
- }
- }
-}
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 fb48e11b424..06e4e066c22 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
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.annotation.Priority;
import org.sonar.api.Plugin;
import org.sonar.core.platform.PluginInfo;
@@ -49,17 +48,7 @@ public class FakePluginInstaller implements PluginInstaller {
}
@Override
- public Map<String, ScannerPlugin> installAllPlugins() {
- return pluginsByKeys;
- }
-
- @Override
- public Map<String, ScannerPlugin> installRequiredPlugins() {
- return pluginsByKeys;
- }
-
- @Override
- public Map<String, ScannerPlugin> installPluginsForLanguages(Set<String> languageKeys) {
+ public Map<String, ScannerPlugin> installRemotes() {
return pluginsByKeys;
}