From 31be229d3a4cce43aeee5e2c7561fcfb6d10a2be Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Fri, 18 Mar 2016 16:21:56 +0100 Subject: [PATCH] SONAR-7375 WS api/rules/search rename PARAM_KEY to PARAM_RULE_KEY --- .../main/java/org/sonar/server/rule/ws/SearchAction.java | 6 +++--- .../org/sonar/server/rule/ws/SearchActionMediumTest.java | 6 +++--- .../java/org/sonarqube/ws/client/rule/RulesService.java | 4 ++-- .../org/sonarqube/ws/client/rule/RulesWsParameters.java | 2 +- .../java/org/sonarqube/ws/client/rule/RulesServiceTest.java | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java index 59fa1927687..de8b5c54def 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java @@ -79,7 +79,7 @@ import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVE_SEVERI import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_AVAILABLE_SINCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_INHERITANCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_IS_TEMPLATE; -import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_KEY; +import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_RULE_KEY; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_LANGUAGES; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_QPROFILE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_REPOSITORIES; @@ -212,7 +212,7 @@ public class SearchAction implements RulesWsAction { .setExampleValue("xpath"); action - .createParam(PARAM_KEY) + .createParam(PARAM_RULE_KEY) .setDescription("Key of rule to search for") .setExampleValue("squid:S001"); @@ -321,7 +321,7 @@ public class SearchAction implements RulesWsAction { query.setIsTemplate(request.paramAsBoolean(PARAM_IS_TEMPLATE)); query.setTemplateKey(request.param(PARAM_TEMPLATE_KEY)); query.setTypes(request.paramAsEnums(PARAM_TYPES, RuleType.class)); - query.setKey(request.param(PARAM_KEY)); + query.setKey(request.param(PARAM_RULE_KEY)); String sortParam = request.param(Param.SORT); if (sortParam != null) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/SearchActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/SearchActionMediumTest.java index 76d558ff0fb..52075e11499 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/SearchActionMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/SearchActionMediumTest.java @@ -58,7 +58,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVATION; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_AVAILABLE_SINCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_IS_TEMPLATE; -import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_KEY; +import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_RULE_KEY; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_QPROFILE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_STATUSES; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_TAGS; @@ -116,13 +116,13 @@ public class SearchActionMediumTest { ruleIndexer.index(); WsTester.TestRequest request = tester.wsTester().newGetRequest(API_ENDPOINT, API_SEARCH_METHOD); - request.setParam(PARAM_KEY, RuleTesting.XOO_X1.toString()); + request.setParam(PARAM_RULE_KEY, RuleTesting.XOO_X1.toString()); request.setParam(WebService.Param.FIELDS, "actives"); WsTester.Result result = request.execute(); result.assertJson("{\"total\":1,\"p\":1,\"ps\":100,\"rules\":[{\"key\":\"xoo:x1\"}]}"); request = tester.wsTester().newGetRequest(API_ENDPOINT, API_SEARCH_METHOD); - request.setParam(PARAM_KEY, RuleKey.of("xoo", "unknown").toString()); + request.setParam(PARAM_RULE_KEY, RuleKey.of("xoo", "unknown").toString()); request.setParam(WebService.Param.FIELDS, "actives"); result = request.execute(); result.assertJson("{\"total\":0,\"p\":1,\"ps\":100,\"rules\":[],\"actives\":{}}"); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java index 4dcbdf521e2..3fa569bfcca 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesService.java @@ -30,7 +30,7 @@ import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVE_SEVERI import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_AVAILABLE_SINCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_INHERITANCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_IS_TEMPLATE; -import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_KEY; +import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_RULE_KEY; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_LANGUAGES; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_QPROFILE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_REPOSITORIES; @@ -63,7 +63,7 @@ public class RulesService extends BaseService { .setParam("q", request.getQuery()) .setParam(PARAM_QPROFILE, request.getQProfile()) .setParam(PARAM_REPOSITORIES, inlineMultipleParamValue(request.getRepositories())) - .setParam(PARAM_KEY, request.getRuleKey()) + .setParam(PARAM_RULE_KEY, request.getRuleKey()) .setParam("s", request.getSort()) .setParam(PARAM_SEVERITIES, inlineMultipleParamValue(request.getSeverities())) .setParam(PARAM_STATUSES, inlineMultipleParamValue(request.getStatuses())) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesWsParameters.java index 3060d43fc50..e69b3d52e3d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/RulesWsParameters.java @@ -25,7 +25,7 @@ import java.util.Set; public class RulesWsParameters { public static final String PARAM_REPOSITORIES = "repositories"; - public static final String PARAM_KEY = "rule_key"; + public static final String PARAM_RULE_KEY = "rule_key"; public static final String PARAM_ACTIVATION = "activation"; public static final String PARAM_QPROFILE = "qprofile"; public static final String PARAM_SEVERITIES = "severities"; diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java index d07af4d26ad..211de126eb0 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/rule/RulesServiceTest.java @@ -37,7 +37,7 @@ import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVE_SEVERI import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_AVAILABLE_SINCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_INHERITANCE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_IS_TEMPLATE; -import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_KEY; +import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_RULE_KEY; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_LANGUAGES; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_QPROFILE; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_REPOSITORIES; @@ -127,7 +127,7 @@ public class RulesServiceTest { .hasParam("q", QUERY_VALUE) .hasParam(PARAM_QPROFILE, QPROFILE_VALUE) .hasParam(PARAM_REPOSITORIES, REPOSITORIES_VALUE_INLINED) - .hasParam(PARAM_KEY, RULE_KEY_VALUE) + .hasParam(PARAM_RULE_KEY, RULE_KEY_VALUE) .hasParam(PARAM_LANGUAGES, LANGUAGES_VALUE_INLINED) .hasParam("s", SORT_VALUE) .hasParam(PARAM_SEVERITIES, SEVERITIES_VALUE_INLINED) -- 2.39.5