From e4c0b858c7e6807801c6481d995ca11682c58fad Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 19 Nov 2018 11:08:59 +0100 Subject: [PATCH] SONAR-11488 Stop loading module level settings in scanner --- .../main/java/org/sonar/xoo/XooPlugin.java | 6 +- .../java/org/sonar/xoo/XooPluginTest.java | 8 +- .../org/sonar/db/property/PropertiesDao.java | 5 - .../sonar/db/property/PropertiesMapper.java | 3 - .../sonar/db/property/PropertiesMapper.xml | 11 - .../sonar/db/property/PropertiesDaoTest.java | 41 -- .../select_module_properties_tree.xml | 184 ------- .../org/sonar/server/batch/ProjectAction.java | 25 +- .../sonar/server/batch/ProjectDataLoader.java | 134 +---- .../sonar/server/batch/ProjectDataQuery.java | 10 +- .../sonar/server/batch/project-example.json | 1 - .../sonar/server/batch/ProjectActionTest.java | 5 +- .../server/batch/ProjectDataLoaderTest.java | 512 +----------------- .../server/setting/ws/ValuesActionTest.java | 5 +- .../bootstrap/GlobalConfiguration.java | 4 - .../scanner/bootstrap/ScannerWsClient.java | 6 +- .../AnalysisContextReportPublisher.java | 60 +- .../DefaultProjectRepositoriesLoader.java | 11 +- .../repository/ProjectRepositories.java | 15 +- .../settings/DefaultSettingsLoader.java | 10 +- .../scan/ModuleConfigurationProvider.java | 20 +- .../scanner/scan/MutableModuleSettings.java | 46 +- .../scanner/scan/MutableProjectSettings.java | 18 +- .../scan/ProjectConfigurationProvider.java | 10 +- .../scanner/scan/ProjectScanContainer.java | 1 + .../scanner/scan/ProjectServerSettings.java | 46 ++ .../scan/ProjectServerSettingsProvider.java | 38 ++ .../branch/BranchConfigurationProvider.java | 16 +- .../scan/filesystem/InputComponentStore.java | 12 +- .../bootstrap/ScannerWsClientTest.java | 5 +- .../mediumtest/ScannerMediumTester.java | 3 +- .../AnalysisContextReportPublisherTest.java | 150 +++-- .../ProjectRepositoriesProviderTest.java | 3 +- .../scan/MutableModuleSettingsTest.java | 161 ------ .../scan/MutableProjectSettingsTest.java | 141 ----- .../BranchConfigurationProviderTest.java | 38 +- .../scan/filesystem/StatusDetectionTest.java | 9 +- .../protocol/input/ProjectRepositories.java | 29 - sonar-ws/src/main/protobuf/ws-batch.proto | 5 - 39 files changed, 343 insertions(+), 1464 deletions(-) delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/property/PropertiesDaoTest/select_module_properties_tree.xml create mode 100644 sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettings.java create mode 100644 sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectServerSettingsProvider.java delete mode 100644 sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableModuleSettingsTest.java delete mode 100644 sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/MutableProjectSettingsTest.java diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java index ba3c4ef0528..cc8689f5a12 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java @@ -92,11 +92,15 @@ public class XooPlugin implements Plugin { .subCategory("General") .onQualifiers(Qualifiers.PROJECT) .build(), - // Used by DuplicationsTest. If not declared it is not returned by api/settings + // Used by DuplicationsTest and IssueFilterOnCommonRulesTest. If not declared it is not returned by api/settings PropertyDefinition.builder("sonar.cpd.xoo.minimumTokens") .onQualifiers(Qualifiers.PROJECT) .type(PropertyType.INTEGER) .build(), + PropertyDefinition.builder("sonar.cpd.xoo.minimumLines") + .onQualifiers(Qualifiers.PROJECT) + .type(PropertyType.INTEGER) + .build(), Xoo.class, Xoo2.class, XooRulesDefinition.class, diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java index 3e4c6aa5a82..27bfe063894 100644 --- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java +++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/XooPluginTest.java @@ -40,7 +40,7 @@ public class XooPluginTest { Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(runtime).build(); new XooPlugin().define(context); assertThat(getExtensions(context)) - .hasSize(47) + .hasSize(48) .doesNotContain(XooBuiltInQualityProfilesDefinition.class); } @@ -50,7 +50,7 @@ public class XooPluginTest { Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(runtime).build(); new XooPlugin().define(context); assertThat(getExtensions(context)) - .hasSize(50) + .hasSize(51) .contains(XooBuiltInQualityProfilesDefinition.class); } @@ -60,7 +60,7 @@ public class XooPluginTest { Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(runtime).build(); new XooPlugin().define(context); assertThat(getExtensions(context)) - .hasSize(54) + .hasSize(55) .contains(OneExternalIssuePerLineSensor.class); } @@ -70,7 +70,7 @@ public class XooPluginTest { Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(runtime).build(); new XooPlugin().define(context); assertThat(getExtensions(context)) - .hasSize(55) + .hasSize(56) .contains(OneExternalIssuePerLineSensor.class); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java index a91a50f3354..04ac22cb459 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.Set; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.api.resources.Scopes; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; import org.sonar.db.Dao; @@ -128,10 +127,6 @@ public class PropertiesDao implements Dao { } } - public List selectEnabledDescendantModuleProperties(String moduleUuid, DbSession session) { - return getMapper(session).selectDescendantModuleProperties(moduleUuid, Scopes.PROJECT, true); - } - @CheckForNull public PropertyDto selectProjectProperty(long componentId, String propertyKey) { try (DbSession session = mybatis.openSession(false)) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java index be2215d2412..7221069be0e 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesMapper.java @@ -44,9 +44,6 @@ public interface PropertiesMapper { List selectByKeyAndMatchingValue(@Param("key") String key, @Param("value") String value); - List selectDescendantModuleProperties(@Param("moduleUuid") String moduleUuid, @Param(value = "scope") String scope, - @Param(value = "excludeDisabled") boolean excludeDisabled); - List selectIdsByOrganizationAndUser(@Param("organizationUuid") String organizationUuid, @Param("userId") int userId); List selectIdsByOrganizationAndMatchingLogin(@Param("organizationUuid") String organizationUuid, @Param("login") String login, diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml index 246bc8090d1..f1d4344765e 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml @@ -62,17 +62,6 @@ and r.kee=#{resourceKey,jdbcType=VARCHAR} - -