diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2018-01-24 17:40:23 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2018-02-08 13:41:00 +0100 |
commit | 146023677fc6d6964e261a7fb4f3cdd5065b55ad (patch) | |
tree | c0352fe2ade3a55f7aa89236a177ad3461ac8005 /tests | |
parent | eb4a773da108157e48998c84cb0477434fd4add5 (diff) | |
download | sonarqube-146023677fc6d6964e261a7fb4f3cdd5065b55ad.tar.gz sonarqube-146023677fc6d6964e261a7fb4f3cdd5065b55ad.zip |
SONAR-10304 use NewRule#addDeprecatedRuleKey in QP notification IT
Diffstat (limited to 'tests')
5 files changed, 34 insertions, 21 deletions
diff --git a/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooBasicProfile.java b/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooBasicProfile.java index 56f50661909..88b940a0401 100644 --- a/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooBasicProfile.java +++ b/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooBasicProfile.java @@ -49,6 +49,8 @@ public class FooBasicProfile extends ProfileDefinition { activateRule(profile, FOO_REPOSITORY, "RuleWithChangedParameter", MAJOR); activateRule(profile, FOO_REPOSITORY, "RuleWithRemovedParameter", MAJOR); activateRule(profile, FOO_REPOSITORY, "RuleWithAddedParameter", MAJOR); + activateRule(profile, FOO_REPOSITORY, "ToBeRenamed", MAJOR); + activateRule(profile, FOO_REPOSITORY, "ToBeRenamedAndMoved", MAJOR); return profile; } diff --git a/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java b/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java index 12f81a58490..3000c39baa4 100644 --- a/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java +++ b/tests/plugins/foo-plugin-v1/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java @@ -32,16 +32,18 @@ public class FooRulesDefinition implements RulesDefinition { } private static void defineRulesXoo(Context context) { - NewRepository repo = context.createRepository(FOO_REPOSITORY, Foo.KEY).setName("Foo"); - createRule(repo, "UnchangedRule"); - createRule(repo, "ChangedRule"); - createRule(repo, "ToBeDeactivatedRule"); - createRule(repo, "ToBeRemovedRule"); - createRule(repo, "RuleWithUnchangedParameter").createParam("unchanged").setDefaultValue("10"); - createRule(repo, "RuleWithChangedParameter").createParam("toBeChanged").setDefaultValue("10"); - createRule(repo, "RuleWithRemovedParameter").createParam("toBeRemoved").setDefaultValue("10"); - createRule(repo, "RuleWithAddedParameter").createParam("added"); - repo.done(); + NewRepository repoFoo1 = context.createRepository(FOO_REPOSITORY, Foo.KEY).setName("Foo"); + createRule(repoFoo1, "UnchangedRule"); + createRule(repoFoo1, "ChangedRule"); + createRule(repoFoo1, "ToBeDeactivatedRule"); + createRule(repoFoo1, "ToBeRemovedRule"); + createRule(repoFoo1, "RuleWithUnchangedParameter").createParam("unchanged").setDefaultValue("10"); + createRule(repoFoo1, "RuleWithChangedParameter").createParam("toBeChanged").setDefaultValue("10"); + createRule(repoFoo1, "RuleWithRemovedParameter").createParam("toBeRemoved").setDefaultValue("10"); + createRule(repoFoo1, "RuleWithAddedParameter").createParam("added"); + createRule(repoFoo1, "ToBeRenamed"); + createRule(repoFoo1, "ToBeRenamedAndMoved"); + repoFoo1.done(); } private static NewRule createRule(NewRepository repo, String key) { diff --git a/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooBasicProfile.java b/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooBasicProfile.java index 9c31db02314..45293bf3998 100644 --- a/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooBasicProfile.java +++ b/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooBasicProfile.java @@ -30,6 +30,7 @@ import static org.sonar.api.rules.RulePriority.MAJOR; import static org.sonar.api.rules.RulePriority.MINOR; import static org.sonar.foo.Foo.KEY; import static org.sonar.foo.rule.FooRulesDefinition.FOO_REPOSITORY; +import static org.sonar.foo.rule.FooRulesDefinition.FOO_REPOSITORY_2; public class FooBasicProfile extends ProfileDefinition { @@ -51,6 +52,8 @@ public class FooBasicProfile extends ProfileDefinition { activateRule(profile, FOO_REPOSITORY, "RuleWithChangedParameter", MAJOR).setParameter("toBeChanged", "20"); activateRule(profile, FOO_REPOSITORY, "RuleWithRemovedParameter", MAJOR); activateRule(profile, FOO_REPOSITORY, "RuleWithAddedParameter", MAJOR); + activateRule(profile, FOO_REPOSITORY, "Renamed", MAJOR); + activateRule(profile, FOO_REPOSITORY_2, "RenamedAndMoved", MAJOR); return profile; } diff --git a/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java b/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java index 6054d1d55c4..2de82d5dc66 100644 --- a/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java +++ b/tests/plugins/foo-plugin-v2/src/main/java/org/sonar/foo/rule/FooRulesDefinition.java @@ -25,6 +25,7 @@ import org.sonar.foo.Foo; public class FooRulesDefinition implements RulesDefinition { public static final String FOO_REPOSITORY = "foo"; + public static final String FOO_REPOSITORY_2 = "foo2"; @Override public void define(Context context) { @@ -32,17 +33,22 @@ public class FooRulesDefinition implements RulesDefinition { } private static void defineRulesXoo(Context context) { - NewRepository repo = context.createRepository(FOO_REPOSITORY, Foo.KEY).setName("Foo"); - createRule(repo, "UnchangedRule"); - createRule(repo, "ChangedRule"); - createRule(repo, "NewRule"); - createRule(repo, "ToBeDeactivatedRule"); - createRule(repo, "RuleWithUnchangedParameter").createParam("unchanged").setDefaultValue("10"); + NewRepository repoFoo1 = context.createRepository(FOO_REPOSITORY, Foo.KEY).setName("Foo"); + createRule(repoFoo1, "UnchangedRule"); + createRule(repoFoo1, "ChangedRule"); + createRule(repoFoo1, "NewRule"); + createRule(repoFoo1, "ToBeDeactivatedRule"); + createRule(repoFoo1, "RuleWithUnchangedParameter").createParam("unchanged").setDefaultValue("10"); // Update of the default value of a parameter is not taken into account in quality profile as long as it's not also explicitly set in the quality profile - createRule(repo, "RuleWithChangedParameter").createParam("toBeChanged").setDefaultValue("20"); - createRule(repo, "RuleWithRemovedParameter"); - createRule(repo, "RuleWithAddedParameter").createParam("added").setDefaultValue("10"); - repo.done(); + createRule(repoFoo1, "RuleWithChangedParameter").createParam("toBeChanged").setDefaultValue("20"); + createRule(repoFoo1, "RuleWithRemovedParameter"); + createRule(repoFoo1, "RuleWithAddedParameter").createParam("added").setDefaultValue("10"); + createRule(repoFoo1, "Renamed").addDeprecatedRuleKey(FOO_REPOSITORY, "ToBeRenamed"); + repoFoo1.done(); + + NewRepository repoFoo2 = context.createRepository(FOO_REPOSITORY_2, Foo.KEY).setName("Foo2"); + createRule(repoFoo2, "RenamedAndMoved").addDeprecatedRuleKey(FOO_REPOSITORY, "ToBeRenamedAndMoved"); + repoFoo2.done(); } private static NewRule createRule(NewRepository repo, String key) { diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java index 042430e63b2..3f81750e2db 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java @@ -136,7 +136,7 @@ public class BuiltInQualityProfilesNotificationTest { .containsSubsequence( "The following built-in profiles have been updated:", "\"Basic\" - Foo: " + url + "/profiles/changelog?language=foo&name=Basic&since=", "&to=", - " 1 new rule", + " 3 new rules", " 3 rules have been updated", " 1 rule removed", "This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + url + "/profiles") |