From ca82e028bcea55ea71253691414dd4d0a0275ece Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 16 Nov 2021 15:42:45 +0100 Subject: [PATCH] SONAR-14907 Update WebAPI examples --- .../main/java/org/sonar/server/issue/ws/SearchAction.java | 2 +- .../server/qualityprofile/ws/DeactivateRuleAction.java | 2 +- .../main/java/org/sonar/server/rule/ws/DeleteAction.java | 2 +- .../java/org/sonar/server/rule/ws/RepositoriesAction.java | 2 +- .../main/java/org/sonar/server/rule/ws/RuleWsSupport.java | 4 ++-- .../org/sonar/server/rule/ws/repositories-example.json | 2 +- .../resources/org/sonar/server/user/ws/search-example.json | 2 +- .../java/org/sonar/server/user/ws/SearchActionTest.java | 2 +- .../rule/ws/RuleSearchWsHandlerTest/search_rules.json | 6 +++--- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 4113f7b8b2c..127348186d8 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -245,7 +245,7 @@ public class SearchAction implements IssuesWsAction { .setBooleanPossibleValues(); action.createParam(PARAM_RULES) .setDescription("Comma-separated list of coding rule keys. Format is <repository>:<rule>") - .setExampleValue("squid:AvoidCycles"); + .setExampleValue("java:S1144"); action.createParam(PARAM_TAGS) .setDescription("Comma-separated list of tags.") .setExampleValue("security,convention"); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRuleAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRuleAction.java index 6931dc3c309..3f0dc34e15f 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRuleAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/qualityprofile/ws/DeactivateRuleAction.java @@ -71,7 +71,7 @@ public class DeactivateRuleAction implements QProfileWsAction { deactivate.createParam(PARAM_RULE) .setDescription("Rule key") .setRequired(true) - .setExampleValue("squid:AvoidCycles"); + .setExampleValue("java:S1144"); } @Override diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/DeleteAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/DeleteAction.java index ed6121a53b9..9abbb686498 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/DeleteAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/DeleteAction.java @@ -65,7 +65,7 @@ public class DeleteAction implements RulesWsAction { .createParam(PARAM_KEY) .setDescription("Rule key") .setRequired(true) - .setExampleValue("squid:XPath_1402065390816"); + .setExampleValue("java:S1144"); } @Override diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RepositoriesAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RepositoriesAction.java index 8a552e328c5..0e93d10b568 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RepositoriesAction.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RepositoriesAction.java @@ -60,7 +60,7 @@ public class RepositoriesAction implements RulesWsAction { action.createParam(Param.TEXT_QUERY) .setDescription("A pattern to match repository keys/names against") - .setExampleValue("squid"); + .setExampleValue("java"); action.createParam(LANGUAGE) .setDescription("A language key; if provided, only repositories for the given language will be returned") .setExampleValue("java"); diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java index 62c62ad9f7a..d4df19efffb 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/rule/ws/RuleWsSupport.java @@ -101,12 +101,12 @@ public class RuleWsSupport { action .createParam(PARAM_RULE_KEY) .setDescription("Key of rule to search for") - .setExampleValue("squid:S001"); + .setExampleValue("java:S1144"); action .createParam(PARAM_REPOSITORIES) .setDescription("Comma-separated list of repositories") - .setExampleValue("checkstyle,findbugs"); + .setExampleValue("java,html"); action .createParam(PARAM_SEVERITIES) diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/repositories-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/repositories-example.json index e73c41171c5..38cc010343c 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/repositories-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/rule/ws/repositories-example.json @@ -21,7 +21,7 @@ {"key": "javascript", "name": "SonarQube", "language": "js"}, {"key": "objc", "name": "SonarQube", "language": "objc"}, {"key": "php", "name": "SonarQube", "language": "php"}, - {"key": "squid", "name": "SonarQube", "language": "java"}, + {"key": "java", "name": "SonarQube", "language": "java"}, {"key": "stylecop", "name": "StyleCop", "language": "cs"} ] } diff --git a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/search-example.json b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/search-example.json index 1666ecb556a..60705dbb5ac 100644 --- a/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/search-example.json +++ b/server/sonar-webserver-webapi/src/main/resources/org/sonar/server/user/ws/search-example.json @@ -35,7 +35,7 @@ "tokensCount": 3, "local": false, "externalIdentity": "sbrandhof@ldap.com", - "externalProvider": "LDAP", + "externalProvider": "sonarqube", "avatar": "3930ad855bc7fe48db8e9a663174cdd3" } ] diff --git a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SearchActionTest.java b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SearchActionTest.java index f01bf06fc1d..c8b84af9a96 100644 --- a/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SearchActionTest.java +++ b/server/sonar-webserver-webapi/src/test/java/org/sonar/server/user/ws/SearchActionTest.java @@ -353,7 +353,7 @@ public class SearchActionTest { UserDto simon = db.users().insertUser(u -> u.setLogin("sbrandhof").setName("Simon").setEmail("s.brandhof@company.tld") .setLocal(false) .setExternalLogin("sbrandhof@ldap.com") - .setExternalIdentityProvider("LDAP") + .setExternalIdentityProvider("sonarqube") .setScmAccounts(asList("simon.brandhof", "s.brandhof@company.tld"))); GroupDto sonarUsers = db.users().insertGroup("sonar-users"); GroupDto sonarAdministrators = db.users().insertGroup("sonar-administrators"); diff --git a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RuleSearchWsHandlerTest/search_rules.json b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RuleSearchWsHandlerTest/search_rules.json index ebd42c46b97..d5ac32e0f52 100644 --- a/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RuleSearchWsHandlerTest/search_rules.json +++ b/server/sonar-webserver-webapi/src/test/resources/org/sonar/server/rule/ws/RuleSearchWsHandlerTest/search_rules.json @@ -1,9 +1,9 @@ {"more": false, "total": 1, "results": [ { - "key": "squid:AvoidCycle", - "repository": "squid", - "name": "Avoid cycle", + "key": "java:S1144", + "repository": "java", + "name": "Unused \"private\" methods should be removed", "language": "Java", "status": "READY", "debtCharacteristic": "REUSABILITY", -- 2.39.5