diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-06-30 10:41:56 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-07-04 16:29:36 +0200 |
commit | 5477e21cb5f5329739e5e42c2cbcfbf79174e10f (patch) | |
tree | e2675c729a2a8af90f4b8c277b5239528e79464b /sonar-ws/src | |
parent | 323bede55a00b3b6e180b3b8951aa63b639bc308 (diff) | |
download | sonarqube-5477e21cb5f5329739e5e42c2cbcfbf79174e10f.tar.gz sonarqube-5477e21cb5f5329739e5e42c2cbcfbf79174e10f.zip |
SONAR-9483 Add IT on "compare_to_profile" in rules search ws
Diffstat (limited to 'sonar-ws/src')
4 files changed, 17 insertions, 1 deletions
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 668e6ed69dc..870fd294660 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 @@ -29,6 +29,7 @@ import org.sonarqube.ws.client.WsConnector; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVATION; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVE_SEVERITIES; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_AVAILABLE_SINCE; +import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_COMPARE_TO_PROFILE; 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_LANGUAGES; @@ -63,6 +64,7 @@ public class RulesService extends BaseService { .setParam("ps", request.getPageSize()) .setParam("q", request.getQuery()) .setParam(PARAM_QPROFILE, request.getQProfile()) + .setParam(PARAM_COMPARE_TO_PROFILE, request.getCompareToProfile()) .setParam(PARAM_REPOSITORIES, inlineMultipleParamValue(request.getRepositories())) .setParam(PARAM_RULE_KEY, request.getRuleKey()) .setParam("s", request.getSort()) 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 0cbe4dc7e70..c820d8247dd 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 @@ -38,7 +38,7 @@ public class RulesWsParameters { public static final String PARAM_IS_TEMPLATE = "is_template"; public static final String PARAM_TEMPLATE_KEY = "template_key"; public static final String PARAM_ORGANIZATION = "organization"; - public static final String PARAM_COMPARE_TO_PROFILE = "compare_to_profile"; + public static final String PARAM_COMPARE_TO_PROFILE = "compareToProfile"; public static final String FIELD_REPO = "repo"; public static final String FIELD_NAME = "name"; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/SearchWsRequest.java index ac2c222a760..5e0255ed732 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/SearchWsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rule/SearchWsRequest.java @@ -37,6 +37,7 @@ public class SearchWsRequest { private Integer pageSize; private String query; private String qProfile; + private String compareToProfile; private List<String> repositories; private String ruleKey; private String sort; @@ -177,6 +178,16 @@ public class SearchWsRequest { } @CheckForNull + public String getCompareToProfile() { + return compareToProfile; + } + + public SearchWsRequest setCompareToProfile(@Nullable String compareToProfile) { + this.compareToProfile = compareToProfile; + return this; + } + + @CheckForNull public List<String> getRepositories() { return repositories; } 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 96d5eb7e5a3..ae38a45e491 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 @@ -35,6 +35,7 @@ import static org.mockito.Mockito.mock; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVATION; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_ACTIVE_SEVERITIES; import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_AVAILABLE_SINCE; +import static org.sonarqube.ws.client.rule.RulesWsParameters.PARAM_COMPARE_TO_PROFILE; 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_LANGUAGES; @@ -101,6 +102,7 @@ public class RulesServiceTest { .setPageSize(PAGE_SIZE_VALUE) .setQuery(QUERY_VALUE) .setQProfile(QPROFILE_VALUE) + .setCompareToProfile("CompareTo") .setRepositories(REPOSITORIES_VALUE) .setRuleKey(RULE_KEY_VALUE) .setSort(SORT_VALUE) @@ -126,6 +128,7 @@ public class RulesServiceTest { .hasParam("ps", PAGE_SIZE_VALUE) .hasParam("q", QUERY_VALUE) .hasParam(PARAM_QPROFILE, QPROFILE_VALUE) + .hasParam(PARAM_COMPARE_TO_PROFILE, "CompareTo") .hasParam(PARAM_REPOSITORIES, REPOSITORIES_VALUE_INLINED) .hasParam(PARAM_RULE_KEY, RULE_KEY_VALUE) .hasParam(PARAM_LANGUAGES, LANGUAGES_VALUE_INLINED) |