From 8cccbf3051fbbbe22f57642cf6a36f5b30f24924 Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 3 Sep 2020 09:45:37 -0500 Subject: [PATCH] SONAR-13844 Rename repositories from 'SonarAnalyzer' to 'SonarQube' --- .../api/server/rule/internal/DefaultNewRepository.java | 4 +++- .../org/sonar/api/server/rule/RulesDefinitionTest.java | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java index e0bcc3df6af..e63a5e795f6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/internal/DefaultNewRepository.java @@ -69,7 +69,9 @@ public class DefaultNewRepository implements RulesDefinition.NewRepository { @Override public DefaultNewRepository setName(@Nullable String s) { - if (StringUtils.isNotEmpty(s)) { + if ("SonarAnalyzer".equals(s)) { + this.name = "SonarQube"; + } else if (StringUtils.isNotEmpty(s)) { this.name = s; } return this; diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java index 342b83c2d0d..3c8f2c1cd7c 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/server/rule/RulesDefinitionTest.java @@ -86,6 +86,14 @@ public class RulesDefinitionTest { assertThat(findbugs.hashCode()).isEqualTo(findbugs.hashCode()); } + @Test + public void override_sonaranalyzer_repositories_name() { + context.createRepository("k", "java").setName("SonarAnalyzer").done(); + RulesDefinition.Repository repo = context.repository("k"); + assertThat(repo).isNotNull(); + assertThat(repo.name()).isEqualTo("SonarQube"); + } + @Test public void define_rules() { RulesDefinition.NewRepository newRepo = context.createRepository("findbugs", "java"); -- 2.39.5