From eb399b126dfedc97ac95b9e96080c0c18f7f4f4f Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 4 Apr 2019 17:48:22 +0200 Subject: [PATCH] SONAR-11876 Remove ws deprecated in SonarQube 5.X --- .../sonar/server/ce/ws/ActivityAction.java | 43 ++++---- .../sonar/server/ce/ws/CeWsParameters.java | 1 - .../component/ws/ComponentsWsModule.java | 1 - .../server/component/ws/ResourcesWs.java | 51 ---------- .../server/issue/index/IssueQueryFactory.java | 5 +- .../sonar/server/issue/ws/AssignAction.java | 16 +-- .../server/issue/ws/BulkChangeAction.java | 6 +- .../sonar/server/issue/ws/SearchAction.java | 30 +----- .../platformlevel/PlatformLevel4.java | 6 -- .../server/qualityprofile/ws/ProfilesWs.java | 62 ------------ .../sonar/server/rule/ws/CreateAction.java | 6 -- .../sonar/server/rule/ws/UpdateAction.java | 20 +--- .../org/sonar/server/test/ws/TestsWs.java | 54 ---------- .../sonar/server/test/ws/package-info.java | 23 ----- .../sonar/server/user/ws/SearchAction.java | 81 ++++----------- .../server/ce/ws/ActivityActionTest.java | 12 +-- .../component/ws/ComponentsWsModuleTest.java | 2 +- .../server/component/ws/ResourcesWsTest.java | 57 ----------- .../issue/index/IssueQueryFactoryTest.java | 12 +-- .../server/issue/ws/AssignActionTest.java | 19 +--- .../server/issue/ws/BulkChangeActionTest.java | 2 +- .../issue/ws/SearchActionComponentsTest.java | 5 +- .../server/issue/ws/SearchActionTest.java | 6 +- .../qualityprofile/ws/ProfilesWsTest.java | 73 -------------- .../server/rule/ws/UpdateActionTest.java | 46 +-------- .../user/ws/ChangePasswordActionTest.java | 9 ++ .../server/user/ws/CreateActionTest.java | 9 ++ .../server/user/ws/SearchActionTest.java | 59 ++++------- .../server/user/ws/UpdateActionTest.java | 9 ++ .../org/sonar/server/user/ws/UsersWsTest.java | 98 ------------------- .../sonarqube/ws/client/DefaultWsClient.java | 16 --- .../org/sonarqube/ws/client/WsClient.java | 6 -- .../ws/client/ce/ActivityRequest.java | 29 ------ .../org/sonarqube/ws/client/ce/CeService.java | 2 - .../ws/client/issue/IssuesWsParameters.java | 22 ----- .../ws/client/issues/AssignRequest.java | 21 ---- .../ws/client/issues/BulkChangeRequest.java | 14 --- .../ws/client/issues/IssuesService.java | 7 +- .../ws/client/issues/SearchRequest.java | 42 -------- .../ws/client/profiles/ProfilesService.java | 71 -------------- .../ws/client/profiles/package-info.java | 26 ----- .../ws/client/resources/ResourcesService.java | 53 ---------- .../ws/client/resources/package-info.java | 26 ----- .../ws/client/rules/CreateRequest.java | 15 --- .../ws/client/rules/RulesService.java | 13 +-- .../ws/client/rules/UpdateRequest.java | 62 ------------ .../ws/client/users/SearchRequest.java | 27 ----- .../ws/client/users/UsersService.java | 1 - 48 files changed, 121 insertions(+), 1155 deletions(-) delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsWs.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/test/ws/package-info.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java index c956af8c87d..b7fc096d6b7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java @@ -55,14 +55,12 @@ import static java.lang.String.format; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import static org.apache.commons.lang.StringUtils.defaultString; import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; import static org.sonar.api.utils.DateUtils.parseEndingDateOrDateTime; import static org.sonar.api.utils.DateUtils.parseStartingDateOrDateTime; import static org.sonar.core.util.stream.MoreCollectors.toList; import static org.sonar.db.Pagination.forPage; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; -import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_ONLY_CURRENTS; @@ -105,21 +103,12 @@ public class ActivityAction implements CeWsAction { new Change("6.1", "field \"logs\" is deprecated and its value is always false"), new Change("6.6", "fields \"branch\" and \"branchType\" added"), new Change("7.1", "field \"pullRequest\" added"), - new Change("7.6", String.format("The use of module keys in parameters '%s' and '%s' is deprecated", TEXT_QUERY, PARAM_COMPONENT_QUERY))) + new Change("7.6", format("The use of module keys in parameters '%s' is deprecated", TEXT_QUERY))) .setSince("5.2"); action.createParam(PARAM_COMPONENT_ID) .setDescription("Id of the component (project) to filter on") .setExampleValue(Uuids.UUID_EXAMPLE_03); - action.createParam(PARAM_COMPONENT_QUERY) - .setDescription(format("Limit search to: " + - "Must not be set together with %s.
" + - "Deprecated and replaced by '%s'", PARAM_COMPONENT_ID, TEXT_QUERY)) - .setExampleValue("Apache") - .setDeprecatedSince("5.5"); action.createParam(TEXT_QUERY) .setDescription(format("Limit search to: */ - private Request setStatus(List status) { + private Request setStatus(@Nullable List status) { this.status = status; return this; } + @CheckForNull private List getStatus() { return status; } @@ -419,11 +413,12 @@ public class ActivityAction implements CeWsAction { *
  • "REPORT"
  • * */ - private Request setType(String type) { + private Request setType(@Nullable String type) { this.type = type; return this; } + @CheckForNull private String getType() { return type; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java index 5b88b6377ef..6ee0856c486 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java @@ -26,7 +26,6 @@ public class CeWsParameters { public static final String PARAM_COMPONENT_ID = "componentId"; public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey"; public static final String PARAM_COMPONENT = "component"; - public static final String PARAM_COMPONENT_QUERY = "componentQuery"; public static final String PARAM_TYPE = "type"; public static final String PARAM_STATUS = "status"; public static final String PARAM_ONLY_CURRENTS = "onlyCurrents"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java index d594f0b4771..ce1d5b8c298 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java @@ -25,7 +25,6 @@ public class ComponentsWsModule extends Module { @Override protected void configureModule() { add( - ResourcesWs.class, ComponentsWs.class, // actions AppAction.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java deleted file mode 100644 index 1fadc7b7d05..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ResourcesWs.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.component.ws; - -import org.sonar.api.server.ws.WebService; -import org.sonar.server.ws.RemovedWebServiceHandler; - -public class ResourcesWs implements WebService { - - @Override - public void define(Context context) { - NewController controller = context.createController("api/resources") - .setDescription("Removed since 6.3, please use api/components and api/measures instead") - .setSince("2.10"); - defineIndexAction(controller); - controller.done(); - } - - private static void defineIndexAction(NewController controller) { - controller.createAction("index") - .setDescription("The web service is removed and you're invited to use the alternatives: " + - "
      " + - "
    • if you need one component without measures: api/components/show
    • " + - "
    • if you need one component with measures: api/measures/component
    • " + - "
    • if you need several components without measures: api/components/tree
    • " + - "
    • if you need several components with measures: api/measures/component_tree
    • " + - "
    ") - .setSince("2.10") - .setDeprecatedSince("5.4") - .setHandler(RemovedWebServiceHandler.INSTANCE) - .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample()); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java index 361b43b9300..863e2967a14 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueQueryFactory.java @@ -67,9 +67,7 @@ import static org.sonar.core.util.stream.MoreCollectors.toHashSet; import static org.sonar.core.util.stream.MoreCollectors.toList; import static org.sonar.core.util.stream.MoreCollectors.toSet; import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_ROOTS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_UUIDS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AFTER; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_IN_LAST; @@ -187,8 +185,7 @@ public class IssueQueryFactory { boolean effectiveOnComponentOnly = false; checkArgument(atMostOneNonNullElement(components, componentUuids, componentKeys, componentRootUuids, componentRoots), - "At most one of the following parameters can be provided: %s, %s, %s, %s, %s", - PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS, PARAM_COMPONENTS, PARAM_COMPONENT_ROOTS, PARAM_COMPONENT_UUIDS); + "At most one of the following parameters can be provided: %s and %s", PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS); if (componentRootUuids != null) { allComponents.addAll(getComponentsFromUuids(session, componentRootUuids)); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java index a071fdbb4f2..07074faed34 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/AssignAction.java @@ -22,10 +22,8 @@ package org.sonar.server.issue.ws; import com.google.common.base.Strings; import com.google.common.io.Resources; import java.util.Date; -import java.util.Optional; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.apache.commons.lang.BooleanUtils; import org.sonar.api.rules.RuleType; import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; @@ -56,7 +54,6 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNEE; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ISSUE; public class AssignAction implements IssuesWsAction { - private static final String DEPRECATED_PARAM_ME = "me"; private static final String ASSIGN_TO_ME_VALUE = "_me"; private final System2 system2; @@ -97,10 +94,6 @@ public class AssignAction implements IssuesWsAction { action.createParam(PARAM_ASSIGNEE) .setDescription("Login of the assignee. When not set, it will unassign the issue. Use '%s' to assign to current user", ASSIGN_TO_ME_VALUE) .setExampleValue("admin"); - action.createParam(DEPRECATED_PARAM_ME) - .setDescription("(deprecated) Assign the issue to the logged-in user. Replaced by the parameter assignee=_me") - .setDeprecatedSince("5.2") - .setBooleanPossibleValues(); } @Override @@ -116,7 +109,7 @@ public class AssignAction implements IssuesWsAction { try (DbSession dbSession = dbClient.openSession(false)) { IssueDto issueDto = issueFinder.getByKey(dbSession, issueKey); DefaultIssue issue = issueDto.toDefaultIssue(); - checkArgument(issue.type() != RuleType.SECURITY_HOTSPOT,"It is not allowed to assign a security hotspot"); + checkArgument(issue.type() != RuleType.SECURITY_HOTSPOT, "Assigning security hotspots is not allowed"); UserDto user = getUser(dbSession, login); if (user != null) { checkMembership(dbSession, issueDto, user); @@ -132,10 +125,7 @@ public class AssignAction implements IssuesWsAction { @CheckForNull private String getAssignee(Request request) { String assignee = emptyToNull(request.param(PARAM_ASSIGNEE)); - if (ASSIGN_TO_ME_VALUE.equals(assignee) || BooleanUtils.isTrue(request.paramAsBoolean(DEPRECATED_PARAM_ME))) { - return userSession.getLogin(); - } - return assignee; + return ASSIGN_TO_ME_VALUE.equals(assignee) ? userSession.getLogin() : assignee; } @CheckForNull @@ -148,7 +138,7 @@ public class AssignAction implements IssuesWsAction { private void checkMembership(DbSession dbSession, IssueDto issueDto, UserDto user) { String projectUuid = requireNonNull(issueDto.getProjectUuid()); - ComponentDto project = Optional.ofNullable(dbClient.componentDao().selectByUuid(dbSession, projectUuid).orElse(null)) + ComponentDto project = dbClient.componentDao().selectByUuid(dbSession, projectUuid) .orElseThrow(() -> new IllegalStateException(format("Unknown project %s", projectUuid))); OrganizationDto organizationDto = dbClient.organizationDao().selectByUuid(dbSession, project.getOrganizationUuid()) .orElseThrow(() -> new IllegalStateException(format("Unknown organizationMember %s", project.getOrganizationUuid()))); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java index 31e2af39618..d3fba0d5bc2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/BulkChangeAction.java @@ -55,8 +55,8 @@ import org.sonar.server.issue.Action; import org.sonar.server.issue.AddTagsAction; import org.sonar.server.issue.AssignAction; import org.sonar.server.issue.IssueChangePostProcessor; -import org.sonar.server.issue.WebIssueStorage; import org.sonar.server.issue.RemoveTagsAction; +import org.sonar.server.issue.WebIssueStorage; import org.sonar.server.issue.notification.IssueChangeNotification; import org.sonar.server.notification.NotificationManager; import org.sonar.server.user.UserSession; @@ -94,7 +94,6 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGN; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMMENT; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DO_TRANSITION; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ISSUES; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PLAN; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_REMOVE_TAGS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SEND_NOTIFICATIONS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_SET_SEVERITY; @@ -155,9 +154,6 @@ public class BulkChangeAction implements IssuesWsAction { .setPossibleValues(RuleType.names()) .setSince("5.5") .setDeprecatedKey("set_type.type", "6.2"); - action.createParam(PARAM_PLAN) - .setDescription("In 5.5, action plans are dropped. Has no effect. To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan") - .setDeprecatedSince("5.5"); action.createParam(PARAM_DO_TRANSITION) .setDescription("Transition") .setExampleValue(REOPEN) diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java index 326a3689ce4..1ee42083bcf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/ws/SearchAction.java @@ -85,7 +85,6 @@ import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.server.ws.KeyExamples.KEY_PULL_REQUEST_EXAMPLE_001; import static org.sonar.server.ws.WsUtils.writeProtobuf; import static org.sonarqube.ws.client.issue.IssuesWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.DEPRECATED_PARAM_ACTION_PLANS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.DEPRECATED_PARAM_AUTHORS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.FACET_MODE; import static org.sonarqube.ws.client.issue.IssuesWsParameters.FACET_MODE_COUNT; @@ -96,10 +95,7 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNED; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ASSIGNEES; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_AUTHOR; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_ROOTS; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_ROOT_UUIDS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_UUIDS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AFTER; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AT; @@ -117,7 +113,6 @@ import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_OWASP_TOP_1 import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PROJECTS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PROJECT_KEYS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PULL_REQUEST; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_REPORTERS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLUTIONS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RESOLVED; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_RULES; @@ -140,10 +135,8 @@ public class SearchAction implements IssuesWsAction, Startable { PARAM_SEVERITIES, PARAM_STATUSES, PARAM_RESOLUTIONS, - DEPRECATED_PARAM_ACTION_PLANS, PARAM_RULES, PARAM_ASSIGNEES, - PARAM_REPORTERS, DEPRECATED_PARAM_AUTHORS, PARAM_AUTHOR, PARAM_DIRECTORIES, @@ -188,9 +181,9 @@ public class SearchAction implements IssuesWsAction, Startable { .setHandler(this) .setDescription( "Search for issues.
    " + - "At most one of the following parameters can be provided at the same time: %s, %s, %s, %s, %s.
    " + + "At most one of the following parameters can be provided at the same time: %s and %s.
    " + "Requires the 'Browse' permission on the specified project(s).", - PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS, PARAM_COMPONENTS, PARAM_COMPONENT_ROOT_UUIDS, PARAM_COMPONENT_ROOTS) + PARAM_COMPONENT_KEYS, PARAM_COMPONENT_UUIDS) .setSince("3.6") .setChangelog( new Change("7.7", format("Value '%s' in parameter '%s' is deprecated, please use '%s' instead", DEPRECATED_PARAM_AUTHORS, FACETS, PARAM_AUTHOR)), @@ -307,9 +300,7 @@ public class SearchAction implements IssuesWsAction, Startable { private static void addComponentRelatedParams(WebService.NewAction action) { action.createParam(PARAM_ON_COMPONENT_ONLY) .setDescription("Return only issues at a component's level, not on its descendants (modules, directories, files, etc). " + - "This parameter is only considered when componentKeys or componentUuids is set. " + - "Using the deprecated componentRoots or componentRootUuids parameters will set this parameter to false. " + - "Using the deprecated components parameter will set this parameter to true.") + "This parameter is only considered when componentKeys or componentUuids is set.") .setBooleanPossibleValues() .setDefaultValue("false"); @@ -318,10 +309,6 @@ public class SearchAction implements IssuesWsAction, Startable { "A component can be a portfolio, project, module, directory or file.") .setExampleValue(KEY_PROJECT_EXAMPLE_001); - action.createParam(PARAM_COMPONENTS) - .setDeprecatedSince("5.1") - .setDescription("If used, will have the same meaning as componentKeys AND onComponentOnly=true."); - action.createParam(PARAM_COMPONENT_UUIDS) .setDescription("To retrieve issues associated to a specific list of components their sub-components (comma-separated list of component IDs). " + INTERNAL_PARAMETER_DISCLAIMER + @@ -329,14 +316,6 @@ public class SearchAction implements IssuesWsAction, Startable { .setDeprecatedSince("6.5") .setExampleValue("584a89f2-8037-4f7b-b82c-8b45d2d63fb2"); - action.createParam(PARAM_COMPONENT_ROOTS) - .setDeprecatedSince("5.1") - .setDescription("If used, will have the same meaning as componentKeys AND onComponentOnly=false."); - - action.createParam(PARAM_COMPONENT_ROOT_UUIDS) - .setDeprecatedSince("5.1") - .setDescription("If used, will have the same meaning as componentUuids AND onComponentOnly=false."); - action.createParam(PARAM_PROJECTS) .setDescription("To retrieve issues associated to a specific list of projects (comma-separated list of project keys). " + INTERNAL_PARAMETER_DISCLAIMER + @@ -532,10 +511,7 @@ public class SearchAction implements IssuesWsAction, Startable { .setAssigneesUuid(getLogins(dbSession, request.paramAsStrings(PARAM_ASSIGNEES))) .setAuthors(request.hasParam(PARAM_AUTHOR) ? request.multiParam(PARAM_AUTHOR) : request.paramAsStrings(DEPRECATED_PARAM_AUTHORS)) .setComponentKeys(request.paramAsStrings(PARAM_COMPONENT_KEYS)) - .setComponentRootUuids(request.paramAsStrings(PARAM_COMPONENT_ROOT_UUIDS)) - .setComponentRoots(request.paramAsStrings(PARAM_COMPONENT_ROOTS)) .setComponentUuids(request.paramAsStrings(PARAM_COMPONENT_UUIDS)) - .setComponents(request.paramAsStrings(PARAM_COMPONENTS)) .setCreatedAfter(request.param(PARAM_CREATED_AFTER)) .setCreatedAt(request.param(PARAM_CREATED_AT)) .setCreatedBefore(request.param(PARAM_CREATED_BEFORE)) diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 01ca67bc742..6a595e18ffa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -166,7 +166,6 @@ import org.sonar.server.qualityprofile.QProfileRulesImpl; import org.sonar.server.qualityprofile.QProfileTreeImpl; import org.sonar.server.qualityprofile.RuleActivator; import org.sonar.server.qualityprofile.index.ActiveRuleIndexer; -import org.sonar.server.qualityprofile.ws.ProfilesWs; import org.sonar.server.qualityprofile.ws.QProfilesWsModule; import org.sonar.server.root.ws.RootWsModule; import org.sonar.server.rule.CommonRuleDefinitionsImpl; @@ -198,7 +197,6 @@ import org.sonar.server.startup.LogServerId; import org.sonar.server.telemetry.TelemetryClient; import org.sonar.server.telemetry.TelemetryDaemon; import org.sonar.server.telemetry.TelemetryDataLoader; -import org.sonar.server.test.ws.TestsWs; import org.sonar.server.text.MacroInterpreter; import org.sonar.server.ui.DeprecatedViews; import org.sonar.server.ui.PageDecorations; @@ -288,7 +286,6 @@ public class PlatformLevel4 extends PlatformLevel { XMLProfileSerializer.class, AnnotationProfileParser.class, QProfileComparison.class, - ProfilesWs.class, QProfileTreeImpl.class, QProfileRulesImpl.class, RuleActivator.class, @@ -471,9 +468,6 @@ public class PlatformLevel4 extends PlatformLevel { NotificationWsModule.class, EmailsWsModule.class, - // Tests - TestsWs.class, - // Settings PersistentSettings.class, PropertiesWs.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java deleted file mode 100644 index fe7190ba41c..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.qualityprofile.ws; - -import org.sonar.api.server.ws.WebService; -import org.sonar.server.ws.RemovedWebServiceHandler; - -/** - * List of quality profiles WS implemented in Rails. - * New WS on quality profiles MUST be declared in {@link org.sonar.server.qualityprofile.ws.QProfilesWs} - */ -public class ProfilesWs implements WebService { - - public static final String API_ENDPOINT = "api/profiles"; - - @Override - public void define(Context context) { - NewController controller = context.createController(API_ENDPOINT) - .setDescription("Removed since 6.3, please use api/qualityprofiles instead") - .setSince("4.4"); - defineListAction(controller); - defineIndexAction(controller); - controller.done(); - } - - private static void defineIndexAction(NewController controller) { - controller.createAction("index") - .setDescription("Get a profile.
    " + - "The web service is removed and you're invited to use api/qualityprofiles/search instead") - .setSince("3.3") - .setDeprecatedSince("5.2") - .setHandler(RemovedWebServiceHandler.INSTANCE) - .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample()); - } - - private static void defineListAction(NewController controller) { - controller.createAction("list") - .setDescription("Get a list of profiles.
    " + - "The web service is removed and you're invited to use api/qualityprofiles/search instead") - .setSince("3.3") - .setDeprecatedSince("5.2") - .setHandler(RemovedWebServiceHandler.INSTANCE) - .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample()); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/CreateAction.java index 79abe984374..6cae5e46adf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/CreateAction.java @@ -95,12 +95,6 @@ public class CreateAction implements RulesWsAction { .setDescription("Key of the custom rule") .setExampleValue("Todo_should_not_be_used"); - action - .createParam("manual_key") - .setDescription("Manual rules are no more supported. This parameter is ignored") - .setExampleValue("Error_handling") - .setDeprecatedSince("5.5"); - action .createParam(PARAM_TEMPLATE_KEY) .setDescription("Key of the template rule in order to create a custom rule (mandatory for custom rule)") diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/UpdateAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/UpdateAction.java index 3f4d47dfd64..40278e60e52 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/UpdateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/UpdateAction.java @@ -50,7 +50,6 @@ import static com.google.common.collect.Sets.newHashSet; import static java.lang.String.format; import static java.util.Collections.singletonList; import static java.util.Optional.ofNullable; -import static org.apache.commons.lang.StringUtils.defaultIfEmpty; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES; import static org.sonar.server.rule.ws.CreateAction.KEY_MAXIMUM_LENGTH; import static org.sonar.server.rule.ws.CreateAction.NAME_MAXIMUM_LENGTH; @@ -62,11 +61,8 @@ public class UpdateAction implements RulesWsAction { public static final String PARAM_TAGS = "tags"; public static final String PARAM_MARKDOWN_NOTE = "markdown_note"; public static final String PARAM_REMEDIATION_FN_TYPE = "remediation_fn_type"; - public static final String DEPRECATED_PARAM_REMEDIATION_FN_TYPE = "debt_remediation_fn_type"; public static final String PARAM_REMEDIATION_FN_BASE_EFFORT = "remediation_fn_base_effort"; - public static final String DEPRECATED_PARAM_REMEDIATION_FN_OFFSET = "debt_remediation_fn_offset"; public static final String PARAM_REMEDIATION_FN_GAP_MULTIPLIER = "remediation_fy_gap_multiplier"; - public static final String DEPRECATED_PARAM_REMEDIATION_FN_COEFF = "debt_remediation_fy_coeff"; public static final String PARAM_NAME = "name"; public static final String PARAM_DESCRIPTION = "markdown_description"; public static final String PARAM_SEVERITY = "severity"; @@ -124,26 +120,16 @@ public class UpdateAction implements RulesWsAction { .setPossibleValues(DebtRemediationFunction.Type.values()) .setSince("5.5"); - action.createParam(DEPRECATED_PARAM_REMEDIATION_FN_TYPE) - .setDeprecatedSince("5.5") - .setPossibleValues(DebtRemediationFunction.Type.values()); - action.createParam(PARAM_REMEDIATION_FN_BASE_EFFORT) .setDescription("Base effort of the remediation function of the rule") .setExampleValue("1d") .setSince("5.5"); - action.createParam(DEPRECATED_PARAM_REMEDIATION_FN_OFFSET) - .setDeprecatedSince("5.5"); - action.createParam(PARAM_REMEDIATION_FN_GAP_MULTIPLIER) .setDescription("Gap multiplier of the remediation function of the rule") .setExampleValue("3min") .setSince("5.5"); - action.createParam(DEPRECATED_PARAM_REMEDIATION_FN_COEFF) - .setDeprecatedSince("5.5"); - action .createParam(PARAM_NAME) .setMaximumLength(NAME_MAXIMUM_LENGTH) @@ -251,15 +237,15 @@ public class UpdateAction implements RulesWsAction { } private static void readDebt(Request request, RuleUpdate update) { - String value = defaultIfEmpty(request.param(PARAM_REMEDIATION_FN_TYPE), request.param(DEPRECATED_PARAM_REMEDIATION_FN_TYPE)); + String value = request.param(PARAM_REMEDIATION_FN_TYPE); if (value != null) { if (StringUtils.isBlank(value)) { update.setDebtRemediationFunction(null); } else { DebtRemediationFunction fn = new DefaultDebtRemediationFunction( DebtRemediationFunction.Type.valueOf(value), - defaultIfEmpty(request.param(PARAM_REMEDIATION_FN_GAP_MULTIPLIER), request.param(DEPRECATED_PARAM_REMEDIATION_FN_COEFF)), - defaultIfEmpty(request.param(PARAM_REMEDIATION_FN_BASE_EFFORT), request.param(DEPRECATED_PARAM_REMEDIATION_FN_OFFSET))); + request.param(PARAM_REMEDIATION_FN_GAP_MULTIPLIER), + request.param(PARAM_REMEDIATION_FN_BASE_EFFORT)); update.setDebtRemediationFunction(fn); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsWs.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsWs.java deleted file mode 100644 index fb477f7b9dc..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/TestsWs.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.test.ws; - -import org.sonar.api.server.ws.Change; -import org.sonar.api.server.ws.WebService; -import org.sonar.server.ws.RemovedWebServiceHandler; - -public class TestsWs implements WebService { - - @Override - public void define(Context context) { - NewController controller = context.createController("api/tests") - .setSince("4.4") - .setDescription("Removed in 7.6"); - - controller.createAction("covered_files") - .setDescription("This web API is no longer supported") - .setSince("4.4") - .setDeprecatedSince("5.6") - .setChangelog(new Change("7.6", "This action has been removed")) - .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample()) - .setHandler(RemovedWebServiceHandler.INSTANCE); - - controller - .createAction("list") - .setDescription("This web API is no longer supported") - .setSince("5.2") - .setDeprecatedSince("5.6") - .setChangelog(new Change("7.6", "This action has been removed")) - .setResponseExample(RemovedWebServiceHandler.INSTANCE.getResponseExample()) - .setHandler(RemovedWebServiceHandler.INSTANCE); - - controller.done(); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/package-info.java deleted file mode 100644 index a06b3220d5a..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -@ParametersAreNonnullByDefault -package org.sonar.server.test.ws; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java index d1c996b0e1f..1fc93cb4f1a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/SearchAction.java @@ -20,12 +20,10 @@ package org.sonar.server.user.ws; import com.google.common.collect.Multimap; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.function.Function; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.server.ws.Change; @@ -50,7 +48,6 @@ import static com.google.common.base.MoreObjects.firstNonNull; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Strings.emptyToNull; import static java.util.Optional.ofNullable; -import static org.sonar.api.server.ws.WebService.Param.FIELDS; import static org.sonar.api.server.ws.WebService.Param.PAGE; import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; @@ -58,16 +55,6 @@ import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.api.utils.Paging.forPageIndex; import static org.sonar.core.util.stream.MoreCollectors.toList; import static org.sonar.server.es.SearchOptions.MAX_LIMIT; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_ACTIVE; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_AVATAR; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_EMAIL; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_EXTERNAL_IDENTITY; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_EXTERNAL_PROVIDER; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_GROUPS; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_LOCAL; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_NAME; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_SCM_ACCOUNTS; -import static org.sonar.server.user.ws.UserJsonWriter.FIELD_TOKENS_COUNT; import static org.sonar.server.ws.WsUtils.writeProtobuf; import static org.sonarqube.ws.Users.SearchWsResponse.Groups; import static org.sonarqube.ws.Users.SearchWsResponse.ScmAccounts; @@ -114,8 +101,6 @@ public class SearchAction implements UsersWsAction { .setHandler(this) .setResponseExample(getClass().getResource("search-example.json")); - action.createFieldsParam(UserJsonWriter.FIELDS) - .setDeprecatedSince("5.4"); action.addPagingParams(50, MAX_LIMIT); action.createParam(TEXT_QUERY) @@ -131,7 +116,6 @@ public class SearchAction implements UsersWsAction { private Users.SearchWsResponse doHandle(SearchRequest request) { SearchOptions options = new SearchOptions().setPage(request.getPage(), request.getPageSize()); - List fields = request.getPossibleFields(); SearchResult result = userIndex.search(UserQuery.builder().setTextQuery(request.getQuery()).build(), options); try (DbSession dbSession = dbClient.openSession(false)) { List logins = result.getDocs().stream().map(UserDoc::login).collect(toList()); @@ -139,14 +123,13 @@ public class SearchAction implements UsersWsAction { List users = dbClient.userDao().selectByOrderedLogins(dbSession, logins); Map tokenCountsByLogin = dbClient.userTokenDao().countTokensByUsers(dbSession, users); Paging paging = forPageIndex(request.getPage()).withPageSize(request.getPageSize()).andTotal((int) result.getTotal()); - return buildResponse(users, groupsByLogin, tokenCountsByLogin, fields, paging); + return buildResponse(users, groupsByLogin, tokenCountsByLogin, paging); } } - private SearchWsResponse buildResponse(List users, Multimap groupsByLogin, Map tokenCountsByLogin, - @Nullable List fields, Paging paging) { + private SearchWsResponse buildResponse(List users, Multimap groupsByLogin, Map tokenCountsByLogin, Paging paging) { SearchWsResponse.Builder responseBuilder = newBuilder(); - users.forEach(user -> responseBuilder.addUsers(towsUser(user, firstNonNull(tokenCountsByLogin.get(user.getUuid()), 0), groupsByLogin.get(user.getLogin()), fields))); + users.forEach(user -> responseBuilder.addUsers(towsUser(user, firstNonNull(tokenCountsByLogin.get(user.getUuid()), 0), groupsByLogin.get(user.getLogin())))); responseBuilder.getPagingBuilder() .setPageIndex(paging.pageIndex()) .setPageSize(paging.pageSize()) @@ -155,43 +138,30 @@ public class SearchAction implements UsersWsAction { return responseBuilder.build(); } - private User towsUser(UserDto user, @Nullable Integer tokensCount, Collection groups, @Nullable Collection fields) { - User.Builder userBuilder = User.newBuilder() - .setLogin(user.getLogin()); - setIfNeeded(FIELD_NAME, fields, user.getName(), userBuilder::setName); + private User towsUser(UserDto user, @Nullable Integer tokensCount, Collection groups) { + User.Builder userBuilder = User.newBuilder().setLogin(user.getLogin()); + ofNullable(user.getName()).ifPresent(userBuilder::setName); if (userSession.isLoggedIn()) { - setIfNeeded(FIELD_AVATAR, fields, emptyToNull(user.getEmail()), u -> userBuilder.setAvatar(avatarResolver.create(user))); - setIfNeeded(FIELD_ACTIVE, fields, user.isActive(), userBuilder::setActive); - setIfNeeded(FIELD_LOCAL, fields, user.isLocal(), userBuilder::setLocal); - setIfNeeded(FIELD_EXTERNAL_PROVIDER, fields, user.getExternalIdentityProvider(), userBuilder::setExternalProvider); - setIfNeeded(isNeeded(FIELD_SCM_ACCOUNTS, fields) && !user.getScmAccountsAsList().isEmpty(), user.getScmAccountsAsList(), - scm -> userBuilder.setScmAccounts(ScmAccounts.newBuilder().addAllScmAccounts(scm))); + ofNullable(emptyToNull(user.getEmail())).ifPresent(u -> userBuilder.setAvatar(avatarResolver.create(user))); + userBuilder.setActive(user.isActive()); + userBuilder.setLocal(user.isLocal()); + ofNullable(user.getExternalIdentityProvider()).ifPresent(userBuilder::setExternalProvider); + if (!user.getScmAccountsAsList().isEmpty()) { + userBuilder.setScmAccounts(ScmAccounts.newBuilder().addAllScmAccounts(user.getScmAccountsAsList())); + } } if (userSession.isSystemAdministrator() || Objects.equals(userSession.getUuid(), user.getUuid())) { - setIfNeeded(FIELD_EMAIL, fields, user.getEmail(), userBuilder::setEmail); - setIfNeeded(isNeeded(FIELD_GROUPS, fields) && !groups.isEmpty(), groups, - g -> userBuilder.setGroups(Groups.newBuilder().addAllGroups(g))); - setIfNeeded(FIELD_EXTERNAL_IDENTITY, fields, user.getExternalLogin(), userBuilder::setExternalIdentity); - setIfNeeded(FIELD_TOKENS_COUNT, fields, tokensCount, userBuilder::setTokensCount); + ofNullable(user.getEmail()).ifPresent(userBuilder::setEmail); + if (!groups.isEmpty()) { + userBuilder.setGroups(Groups.newBuilder().addAllGroups(groups)); + } + ofNullable(user.getExternalLogin()).ifPresent(userBuilder::setExternalIdentity); + ofNullable(tokensCount).ifPresent(userBuilder::setTokensCount); ofNullable(user.getLastConnectionDate()).ifPresent(date -> userBuilder.setLastConnectionDate(formatDateTime(date))); } return userBuilder.build(); } - private static void setIfNeeded(String field, @Nullable Collection fields, @Nullable PARAM parameter, Function setter) { - setIfNeeded(isNeeded(field, fields), parameter, setter); - } - - private static void setIfNeeded(boolean condition, @Nullable PARAM parameter, Function setter) { - if (parameter != null && condition) { - setter.apply(parameter); - } - } - - private static boolean isNeeded(String field, @Nullable Collection fields) { - return fields == null || fields.isEmpty() || fields.contains(field); - } - private static SearchRequest toSearchRequest(Request request) { int pageSize = request.mandatoryParamAsInt(PAGE_SIZE); checkArgument(pageSize <= MAX_PAGE_SIZE, "The '%s' parameter must be less than %s", PAGE_SIZE, MAX_PAGE_SIZE); @@ -199,7 +169,6 @@ public class SearchAction implements UsersWsAction { .setQuery(request.param(TEXT_QUERY)) .setPage(request.mandatoryParamAsInt(PAGE)) .setPageSize(pageSize) - .setPossibleFields(request.paramAsStrings(FIELDS)) .build(); } @@ -208,13 +177,11 @@ public class SearchAction implements UsersWsAction { private final Integer page; private final Integer pageSize; private final String query; - private final List possibleFields; private SearchRequest(Builder builder) { this.page = builder.page; this.pageSize = builder.pageSize; this.query = builder.query; - this.possibleFields = builder.additionalFields; } @CheckForNull @@ -232,10 +199,6 @@ public class SearchAction implements UsersWsAction { return query; } - public List getPossibleFields() { - return possibleFields; - } - public static Builder builder() { return new Builder(); } @@ -245,7 +208,6 @@ public class SearchAction implements UsersWsAction { private Integer page; private Integer pageSize; private String query; - private List additionalFields = new ArrayList<>(); private Builder() { // enforce factory method use @@ -266,11 +228,6 @@ public class SearchAction implements UsersWsAction { return this; } - public Builder setPossibleFields(List possibleFields) { - this.additionalFields = possibleFields; - return this; - } - public SearchRequest build() { return new SearchRequest(this); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java index aaa1d871f14..8df62cca4f7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java @@ -63,6 +63,7 @@ import static java.util.Collections.emptyList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; import static org.mockito.Mockito.mock; +import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; import static org.sonar.api.utils.DateUtils.formatDate; import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.db.ce.CeActivityDto.Status.FAILED; @@ -74,7 +75,6 @@ import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY; import static org.sonar.db.ce.CeTaskCharacteristicDto.PULL_REQUEST; import static org.sonar.db.component.BranchType.LONG; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; -import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT; import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS; @@ -290,7 +290,7 @@ public class ActivityActionTest { insertActivity("T2", zookeeper, SUCCESS); insertActivity("T3", eclipse, SUCCESS); - ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac")); + ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac")); assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T1", "T2"); } @@ -302,7 +302,7 @@ public class ActivityActionTest { logInAsSystemAdministrator(); insertActivity("T2", apacheView, SUCCESS); - ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac")); + ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac")); assertThat(activityResponse.getTasksList()).extracting("id").containsOnly("T2"); } @@ -314,7 +314,7 @@ public class ActivityActionTest { logInAsSystemAdministrator(); insertActivity("T2", apacheApp, SUCCESS); - ActivityResponse activityResponse = call(ws.newRequest().setParam(PARAM_COMPONENT_QUERY, "apac")); + ActivityResponse activityResponse = call(ws.newRequest().setParam(TEXT_QUERY, "apac")); assertThat(activityResponse.getTasksList()).extracting(Task::getId).containsOnly("T2"); } @@ -459,11 +459,11 @@ public class ActivityActionTest { @Test public void fail_if_both_filters_on_component_id_and_name() { expectedException.expect(BadRequestException.class); - expectedException.expectMessage("componentId and componentQuery must not be set at the same time"); + expectedException.expectMessage("componentId and q must not be set at the same time"); ws.newRequest() .setParam("componentId", "ID1") - .setParam("componentQuery", "apache") + .setParam("q", "apache") .setMediaType(MediaTypes.PROTOBUF) .execute(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java index a575f36e9d7..f209f3c21b5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java @@ -30,6 +30,6 @@ public class ComponentsWsModuleTest { public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new ComponentsWsModule().configure(container); - assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 8); + assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 7); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java deleted file mode 100644 index dc838e85173..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ResourcesWsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.component.ws; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.server.ws.WebService; -import org.sonar.server.ws.RemovedWebServiceHandler; -import org.sonar.server.ws.WsTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ResourcesWsTest { - - WebService.Controller controller; - - @Before - public void setUp() { - WsTester tester = new WsTester(new ResourcesWs()); - controller = tester.controller("api/resources"); - } - - @Test - public void define_controller() { - assertThat(controller).isNotNull(); - assertThat(controller.since()).isEqualTo("2.10"); - assertThat(controller.description()).isNotEmpty(); - assertThat(controller.actions()).hasSize(1); - } - - @Test - public void define_index_action() { - WebService.Action action = controller.action("index"); - assertThat(action).isNotNull(); - assertThat(action.handler()).isInstanceOf(RemovedWebServiceHandler.class); - assertThat(action.responseExampleAsString()).isNotEmpty(); - assertThat(action.params()).isEmpty(); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java index 4c262bee499..2a321a15480 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueQueryFactoryTest.java @@ -212,11 +212,11 @@ public class IssueQueryFactoryTest { @Test public void fail_if_components_and_components_uuid_params_are_set_at_the_same_time() { SearchRequest request = new SearchRequest() - .setComponentKeys(asList("foo")) - .setComponentUuids(asList("bar")); + .setComponentKeys(singletonList("foo")) + .setComponentUuids(singletonList("bar")); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys, componentUuids, components, componentRoots, componentUuids"); + expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys and componentUuids"); underTest.create(request); } @@ -224,11 +224,11 @@ public class IssueQueryFactoryTest { @Test public void fail_if_both_componentRoots_and_componentRootUuids_params_are_set() { SearchRequest request = new SearchRequest() - .setComponentRoots(asList("foo")) - .setComponentRootUuids(asList("bar")); + .setComponentRoots(singletonList("foo")) + .setComponentRootUuids(singletonList("bar")); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys, componentUuids, components, componentRoots, componentUuids"); + expectedException.expectMessage("At most one of the following parameters can be provided: componentKeys and componentUuids"); underTest.create(request); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java index d901f322ed8..7943f9e5f20 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/AssignActionTest.java @@ -38,9 +38,9 @@ import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.issue.IssueFieldsSetter; import org.sonar.server.issue.IssueFinder; -import org.sonar.server.issue.WebIssueStorage; import org.sonar.server.issue.IssueUpdater; import org.sonar.server.issue.TestIssueChangePostProcessor; +import org.sonar.server.issue.WebIssueStorage; import org.sonar.server.issue.index.IssueIndexer; import org.sonar.server.issue.index.IssueIteratorFactory; import org.sonar.server.notification.NotificationManager; @@ -123,21 +123,6 @@ public class AssignActionTest { assertThat(issueChangePostProcessor.wasCalled()).isFalse(); } - @Test - public void assign_to_me_using_deprecated_me_param() { - IssueDto issue = newIssueWithBrowsePermission(); - - ws.newRequest() - .setParam("issue", issue.getKey()) - .setParam("me", "true") - .execute(); - - checkIssueAssignee(issue.getKey(), CURRENT_USER_UUID); - Optional optionalIssueDto = dbClient.issueDao().selectByKey(session, issue.getKey()); - assertThat(optionalIssueDto).isPresent(); - assertThat(optionalIssueDto.get().getAssigneeUuid()).isEqualTo(CURRENT_USER_UUID); - } - @Test public void unassign() { IssueDto issue = newIssueWithBrowsePermission(); @@ -205,7 +190,7 @@ public class AssignActionTest { UserDto arthur = insertUser("arthur"); expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("It is not allowed to assign a security hotspot"); + expectedException.expectMessage("Assigning security hotspots is not allowed"); ws.newRequest() .setParam("issue", issueDto.getKey()) diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java index 82b76d30674..4af1280a204 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/BulkChangeActionTest.java @@ -649,7 +649,7 @@ public class BulkChangeActionTest { assertThat(action.key()).isEqualTo("bulk_change"); assertThat(action.isPost()).isTrue(); assertThat(action.isInternal()).isFalse(); - assertThat(action.params()).hasSize(10); + assertThat(action.params()).hasSize(9); assertThat(action.responseExample()).isNotNull(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsTest.java index 9b30a5b98a3..9a4bacc317d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionComponentsTest.java @@ -75,7 +75,6 @@ import static org.sonar.db.component.ComponentTesting.newSubView; import static org.sonar.db.component.ComponentTesting.newView; import static org.sonar.db.issue.IssueTesting.newIssue; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_UUIDS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_DIRECTORIES; @@ -289,12 +288,12 @@ public class SearchActionComponentsTest { indexIssues(); ws.newRequest() - .setParam(PARAM_COMPONENTS, file.getDbKey()) + .setParam(PARAM_COMPONENT_KEYS, file.getKey()) .execute() .assertJson(this.getClass(), "search_by_file_key.json"); ws.newRequest() - .setParam(PARAM_COMPONENTS, unitTest.getDbKey()) + .setParam(PARAM_COMPONENT_KEYS, unitTest.getKey()) .execute() .assertJson(this.getClass(), "search_by_test_key.json"); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java index 2a5a338f4f0..1f44c178677 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionTest.java @@ -92,7 +92,7 @@ import static org.sonar.db.issue.IssueTesting.newDto; import static org.sonar.server.tester.UserSessionRule.standalone; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_BRANCH; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_ADDITIONAL_FIELDS; -import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENTS; +import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_COMPONENT_KEYS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_CREATED_AFTER; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_HIDE_COMMENTS; import static org.sonarqube.ws.client.issue.IssuesWsParameters.PARAM_PAGE_INDEX; @@ -430,7 +430,7 @@ public class SearchActionTest { session.commit(); indexIssues(); - ws.newRequest().setParam(PARAM_COMPONENTS, file.getDbKey()).execute() + ws.newRequest().setParam(PARAM_COMPONENT_KEYS, file.getKey()).execute() .assertJson(this.getClass(), "apply_paging_with_one_component.json"); } @@ -850,7 +850,7 @@ public class SearchActionTest { assertThat(def.responseExampleAsString()).isNotEmpty(); assertThat(def.params()).extracting("key").containsExactlyInAnyOrder( - "additionalFields", "asc", "assigned", "assignees", "authors", "author", "componentKeys", "componentRootUuids", "componentRoots", "componentUuids", "components", "branch", + "additionalFields", "asc", "assigned", "assignees", "authors", "author", "componentKeys", "componentUuids", "branch", "pullRequest", "organization", "createdAfter", "createdAt", "createdBefore", "createdInLast", "directories", "facetMode", "facets", "fileUuids", "issues", "languages", "moduleUuids", "onComponentOnly", "p", "projects", "ps", "resolutions", "resolved", "rules", "s", "severities", "sinceLeakPeriod", diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java deleted file mode 100644 index 9aeb479686e..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.qualityprofile.ws; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.server.ws.WebService; -import org.sonar.server.ws.RemovedWebServiceHandler; -import org.sonar.server.ws.WsTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ProfilesWsTest { - - private WsTester ws; - - @Before - public void setUp() { - ws = new WsTester(new ProfilesWs()); - } - - @Test - public void define_controller() { - WebService.Controller controller = controller(); - assertThat(controller).isNotNull(); - assertThat(controller.path()).isEqualTo("api/profiles"); - assertThat(controller.description()).isNotEmpty(); - assertThat(controller.actions()).hasSize(2); - } - - @Test - public void define_index_action() { - WebService.Controller controller = ws.controller("api/profiles"); - - WebService.Action restoreProfiles = controller.action("index"); - assertThat(restoreProfiles).isNotNull(); - assertThat(restoreProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class); - assertThat(restoreProfiles.responseExampleAsString()).isNotEmpty(); - assertThat(restoreProfiles.params()).isEmpty(); - } - - @Test - public void define_list_action() { - WebService.Controller controller = controller(); - - WebService.Action listProfiles = controller.action("list"); - assertThat(listProfiles).isNotNull(); - assertThat(listProfiles.handler()).isInstanceOf(RemovedWebServiceHandler.class); - assertThat(listProfiles.responseExampleAsString()).isNotEmpty(); - assertThat(listProfiles.params()).isEmpty(); - } - - private WebService.Controller controller() { - return ws.controller("api/profiles"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionTest.java index 786e22c5288..a11505feed6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/rule/ws/UpdateActionTest.java @@ -32,7 +32,6 @@ import org.sonar.db.DbTester; import org.sonar.db.organization.OrganizationDto; import org.sonar.db.rule.RuleDefinitionDto; import org.sonar.db.rule.RuleMetadataDto; -import org.sonar.db.rule.RuleTesting; import org.sonar.db.user.UserDto; import org.sonar.server.es.EsClient; import org.sonar.server.es.EsTester; @@ -60,9 +59,6 @@ import static org.sonar.api.server.debt.DebtRemediationFunction.Type.LINEAR_OFFS import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_PROFILES; import static org.sonar.db.rule.RuleTesting.setSystemTags; import static org.sonar.db.rule.RuleTesting.setTags; -import static org.sonar.server.rule.ws.UpdateAction.DEPRECATED_PARAM_REMEDIATION_FN_COEFF; -import static org.sonar.server.rule.ws.UpdateAction.DEPRECATED_PARAM_REMEDIATION_FN_OFFSET; -import static org.sonar.server.rule.ws.UpdateAction.DEPRECATED_PARAM_REMEDIATION_FN_TYPE; import static org.sonar.server.rule.ws.UpdateAction.PARAM_KEY; import static org.sonar.server.rule.ws.UpdateAction.PARAM_MARKDOWN_NOTE; import static org.sonar.server.rule.ws.UpdateAction.PARAM_ORGANIZATION; @@ -106,7 +102,7 @@ public class UpdateActionTest { assertThat(ws.getDef().responseExampleAsString()).isNotNull(); assertThat(ws.getDef().description()).isNotNull(); } - + @Test public void update_custom_rule() { logInAsQProfileAdministrator(); @@ -249,46 +245,6 @@ public class UpdateActionTest { assertThat(metadataOfSpecificOrg.getRemediationBaseEffort()).isEqualTo(newEffort); } - @Test - public void update_custom_rule_with_deprecated_remediation_function_parameters() { - logInAsQProfileAdministrator(); - - RuleDefinitionDto rule = RuleTesting.newRule() - .setDefRemediationFunction(LINEAR_OFFSET.toString()) - .setDefRemediationGapMultiplier("10d") - .setDefRemediationBaseEffort("5min"); - db.rules().insert(rule); - - String newType = LINEAR_OFFSET.toString(); - String newCoeff = "11d"; - String newOffset = "6min"; - - Rules.UpdateResponse result = ws.newRequest().setMethod("POST") - .setParam(PARAM_KEY, rule.getKey().toString()) - .setParam(DEPRECATED_PARAM_REMEDIATION_FN_TYPE, newType) - .setParam(DEPRECATED_PARAM_REMEDIATION_FN_COEFF, newCoeff) - .setParam(DEPRECATED_PARAM_REMEDIATION_FN_OFFSET, newOffset) - .executeProtobuf(Rules.UpdateResponse.class); - - Rules.Rule updatedRule = result.getRule(); - assertThat(updatedRule).isNotNull(); - - assertThat(updatedRule.getKey()).isEqualTo(rule.getKey().toString()); - assertThat(updatedRule.getDefaultRemFnType()).isEqualTo(rule.getDefRemediationFunction()); - assertThat(updatedRule.getDefaultRemFnGapMultiplier()).isEqualTo(rule.getDefRemediationGapMultiplier()); - assertThat(updatedRule.getDefaultRemFnBaseEffort()).isEqualTo(rule.getDefRemediationBaseEffort()); - assertThat(updatedRule.getEffortToFixDescription()).isEqualTo(rule.getGapDescription()); - - assertThat(updatedRule.getRemFnType()).isEqualTo(newType); - assertThat(updatedRule.getDebtRemFnCoeff()).isEqualTo(newCoeff); - assertThat(updatedRule.getDebtRemFnOffset()).isEqualTo(newOffset); - - assertThat(updatedRule.getRemFnType()).isEqualTo(newType); - assertThat(updatedRule.getRemFnGapMultiplier()).isEqualTo(newCoeff); - assertThat(updatedRule.getRemFnBaseEffort()).isEqualTo(newOffset); - assertThat(updatedRule.getGapDescription()).isEqualTo(rule.getGapDescription()); - } - @Test public void update_note() { OrganizationDto organization = db.organizations().insert(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java index 37edde0c6f8..a20573fc2ca 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java @@ -24,6 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.config.internal.MapSettings; +import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.api.utils.internal.AlwaysIncreasingSystem2; import org.sonar.db.DbTester; @@ -196,6 +197,14 @@ public class ChangePasswordActionTest { .execute(); } + @Test + public void test_definition() { + WebService.Action action = tester.getDef(); + assertThat(action).isNotNull(); + assertThat(action.isPost()).isTrue(); + assertThat(action.params()).hasSize(3); + } + private void createLocalUser() { db.users().insertUser(newLocalUser("john", "John", "john@email.com")); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java index e01fb412b8c..b8c693cc283 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java @@ -27,6 +27,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; import org.sonar.api.config.internal.MapSettings; +import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.api.utils.internal.AlwaysIncreasingSystem2; import org.sonar.core.config.CorePropertyDefinitions; @@ -379,6 +380,14 @@ public class CreateActionTest { executeRequest("john"); } + @Test + public void test_definition() { + WebService.Action action = tester.getDef(); + assertThat(action).isNotNull(); + assertThat(action.isPost()).isTrue(); + assertThat(action.params()).hasSize(7); + } + private CreateWsResponse executeRequest(String login) { return call(CreateRequest.builder() .setLogin(login) diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java index 8e820541c6d..ff98570dbdf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/SearchActionTest.java @@ -22,6 +22,7 @@ package org.sonar.server.user.ws; import java.util.stream.IntStream; import org.junit.Rule; import org.junit.Test; +import org.sonar.api.server.ws.WebService; import org.sonar.api.server.ws.WebService.Param; import org.sonar.api.utils.System2; import org.sonar.db.DbTester; @@ -289,51 +290,18 @@ public class SearchActionTest { userSession.logIn(user); assertThat(ws.newRequest().setParam("q", user.getLogin()) .executeProtobuf(SearchWsResponse.class).getUsersList()) - .extracting(User::getLogin, User::getName, User::getEmail, User::getExternalIdentity, User::getExternalProvider, - User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::getTokensCount, User::hasLastConnectionDate) - .containsExactlyInAnyOrder( - tuple(user.getLogin(), user.getName(), user.getEmail(), user.getExternalLogin(), user.getExternalIdentityProvider(), true, true, true, 2, true)); + .extracting(User::getLogin, User::getName, User::getEmail, User::getExternalIdentity, User::getExternalProvider, + User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::getTokensCount, User::hasLastConnectionDate) + .containsExactlyInAnyOrder( + tuple(user.getLogin(), user.getName(), user.getEmail(), user.getExternalLogin(), user.getExternalIdentityProvider(), true, true, true, 2, true)); userSession.logIn(otherUser); assertThat(ws.newRequest().setParam("q", user.getLogin()) .executeProtobuf(SearchWsResponse.class).getUsersList()) - .extracting(User::getLogin, User::getName, User::hasEmail, User::hasExternalIdentity, User::hasExternalProvider, - User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::hasTokensCount, User::hasLastConnectionDate) - .containsExactlyInAnyOrder( - tuple(user.getLogin(), user.getName(), false, false, true, true, true, false, false, false)); - } - - @Test - public void search_with_fields() { - UserDto user = db.users().insertUser(); - GroupDto group = db.users().insertGroup(db.getDefaultOrganization()); - db.users().insertMember(group, user); - userIndexer.indexOnStartup(null); - userSession.logIn().setSystemAdministrator(); - - assertThat(ws.newRequest() - .setParam(Param.FIELDS, "scmAccounts") - .executeProtobuf(SearchWsResponse.class) - .getUsersList()) - .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups) - .containsExactlyInAnyOrder(tuple(user.getLogin(), false, true, false, false)); - assertThat(ws.newRequest() - .setParam(Param.FIELDS, "groups") - .executeProtobuf(SearchWsResponse.class) - .getUsersList()) - .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups) - .containsExactlyInAnyOrder(tuple(user.getLogin(), false, false, false, true)); - assertThat(ws.newRequest() - .setParam(Param.FIELDS, "") - .executeProtobuf(SearchWsResponse.class) - .getUsersList()) - .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups) - .containsExactlyInAnyOrder(tuple(user.getLogin(), true, true, true, true)); - assertThat(ws.newRequest() - .executeProtobuf(SearchWsResponse.class) - .getUsersList()) - .extracting(User::getLogin, User::hasName, User::hasScmAccounts, User::hasAvatar, User::hasGroups) - .containsExactlyInAnyOrder(tuple(user.getLogin(), true, true, true, true)); + .extracting(User::getLogin, User::getName, User::hasEmail, User::hasExternalIdentity, User::hasExternalProvider, + User::hasScmAccounts, User::hasAvatar, User::hasGroups, User::hasTokensCount, User::hasLastConnectionDate) + .containsExactlyInAnyOrder( + tuple(user.getLogin(), user.getName(), false, false, true, true, true, false, false, false)); } @Test @@ -404,4 +372,13 @@ public class SearchActionTest { assertJson(response).isSimilarTo(getClass().getResource("search-example.json")); } + @Test + public void test_definition() { + WebService.Action action = ws.getDef(); + assertThat(action).isNotNull(); + assertThat(action.isPost()).isFalse(); + assertThat(action.responseExampleAsString()).isNotEmpty(); + assertThat(action.params()).hasSize(3); + } + } diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java index 47adf248ac9..efab9c999c0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UpdateActionTest.java @@ -25,6 +25,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.config.internal.MapSettings; +import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.db.DbClient; import org.sonar.db.DbSession; @@ -273,6 +274,14 @@ public class UpdateActionTest { .execute(); } + @Test + public void test_definition() { + WebService.Action action = ws.getDef(); + assertThat(action).isNotNull(); + assertThat(action.isPost()).isTrue(); + assertThat(action.params()).hasSize(5); + } + private void createUser() { UserDto userDto = newUserDto() .setEmail("john@email.com") diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java deleted file mode 100644 index a8c6d6c0380..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.user.ws; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.server.ws.WebService; -import org.sonar.db.DbClient; -import org.sonar.db.DbTester; -import org.sonar.server.authentication.CredentialsLocalAuthentication; -import org.sonar.server.issue.ws.AvatarResolver; -import org.sonar.server.tester.UserSessionRule; -import org.sonar.server.user.UserUpdater; -import org.sonar.server.user.index.UserIndex; -import org.sonar.server.ws.WsTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -public class UsersWsTest { - @Rule - public UserSessionRule userSessionRule = UserSessionRule.standalone(); - @Rule - public DbTester db = DbTester.create(); - - private WebService.Controller controller; - private CredentialsLocalAuthentication localAuthentication = new CredentialsLocalAuthentication(db.getDbClient()); - - @Before - public void setUp() { - WsTester tester = new WsTester(new UsersWs( - new CreateAction(mock(DbClient.class), mock(UserUpdater.class), userSessionRule), - new UpdateAction(mock(UserUpdater.class), userSessionRule, mock(UserJsonWriter.class), mock(DbClient.class)), - new ChangePasswordAction(mock(DbClient.class), mock(UserUpdater.class), userSessionRule, localAuthentication), - new SearchAction(userSessionRule, mock(UserIndex.class), mock(DbClient.class), mock(AvatarResolver.class)))); - controller = tester.controller("api/users"); - } - - @Test - public void define_controller() { - assertThat(controller).isNotNull(); - assertThat(controller.description()).isNotEmpty(); - assertThat(controller.since()).isEqualTo("3.6"); - assertThat(controller.actions()).hasSize(4); - } - - @Test - public void define_search_action() { - WebService.Action action = controller.action("search"); - assertThat(action).isNotNull(); - assertThat(action.isPost()).isFalse(); - assertThat(action.responseExampleAsString()).isNotEmpty(); - assertThat(action.params()).hasSize(4); - } - - @Test - public void define_create_action() { - WebService.Action action = controller.action("create"); - assertThat(action).isNotNull(); - assertThat(action.isPost()).isTrue(); - assertThat(action.params()).hasSize(7); - } - - @Test - public void define_update_action() { - WebService.Action action = controller.action("update"); - assertThat(action).isNotNull(); - assertThat(action.isPost()).isTrue(); - assertThat(action.params()).hasSize(5); - } - - @Test - public void define_change_password_action() { - WebService.Action action = controller.action("change_password"); - assertThat(action).isNotNull(); - assertThat(action.isPost()).isTrue(); - assertThat(action.params()).hasSize(3); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java index d83de740725..587899c7824 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java @@ -44,7 +44,6 @@ import org.sonarqube.ws.client.notifications.NotificationsService; import org.sonarqube.ws.client.organizations.OrganizationsService; import org.sonarqube.ws.client.permissions.PermissionsService; import org.sonarqube.ws.client.plugins.PluginsService; -import org.sonarqube.ws.client.profiles.ProfilesService; import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService; import org.sonarqube.ws.client.projectbadges.ProjectBadgesService; import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; @@ -56,7 +55,6 @@ import org.sonarqube.ws.client.projecttags.ProjectTagsService; import org.sonarqube.ws.client.properties.PropertiesService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService; -import org.sonarqube.ws.client.resources.ResourcesService; import org.sonarqube.ws.client.roots.RootsService; import org.sonarqube.ws.client.rules.RulesService; import org.sonarqube.ws.client.securityreports.SecurityReportsService; @@ -109,7 +107,6 @@ class DefaultWsClient implements WsClient { private final OrganizationsService organizationsService; private final PermissionsService permissionsService; private final PluginsService pluginsService; - private final ProfilesService profilesService; private final ProjectAnalysesService projectAnalysesService; private final ProjectBadgesService projectBadgesService; private final ProjectBranchesService projectBranchesService; @@ -121,7 +118,6 @@ class DefaultWsClient implements WsClient { private final PropertiesService propertiesService; private final QualitygatesService qualitygatesService; private final QualityprofilesService qualityprofilesService; - private final ResourcesService resourcesService; private final RootsService rootsService; private final RulesService rulesService; private final ServerService serverService; @@ -167,7 +163,6 @@ class DefaultWsClient implements WsClient { this.organizationsService = new OrganizationsService(wsConnector); this.permissionsService = new PermissionsService(wsConnector); this.pluginsService = new PluginsService(wsConnector); - this.profilesService = new ProfilesService(wsConnector); this.projectAnalysesService = new ProjectAnalysesService(wsConnector); this.projectBadgesService = new ProjectBadgesService(wsConnector); this.projectBranchesService = new ProjectBranchesService(wsConnector); @@ -179,7 +174,6 @@ class DefaultWsClient implements WsClient { this.propertiesService = new PropertiesService(wsConnector); this.qualitygatesService = new QualitygatesService(wsConnector); this.qualityprofilesService = new QualityprofilesService(wsConnector); - this.resourcesService = new ResourcesService(wsConnector); this.rootsService = new RootsService(wsConnector); this.rulesService = new RulesService(wsConnector); this.serverService = new ServerService(wsConnector); @@ -321,11 +315,6 @@ class DefaultWsClient implements WsClient { return pluginsService; } - @Override - public ProfilesService profiles() { - return profilesService; - } - @Override public ProjectAnalysesService projectAnalyses() { return projectAnalysesService; @@ -381,11 +370,6 @@ class DefaultWsClient implements WsClient { return qualityprofilesService; } - @Override - public ResourcesService resources() { - return resourcesService; - } - @Override public RootsService roots() { return rootsService; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java index 30df290cd00..5fdba68259d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java @@ -44,7 +44,6 @@ import org.sonarqube.ws.client.notifications.NotificationsService; import org.sonarqube.ws.client.organizations.OrganizationsService; import org.sonarqube.ws.client.permissions.PermissionsService; import org.sonarqube.ws.client.plugins.PluginsService; -import org.sonarqube.ws.client.profiles.ProfilesService; import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService; import org.sonarqube.ws.client.projectbadges.ProjectBadgesService; import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; @@ -56,7 +55,6 @@ import org.sonarqube.ws.client.projecttags.ProjectTagsService; import org.sonarqube.ws.client.properties.PropertiesService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService; -import org.sonarqube.ws.client.resources.ResourcesService; import org.sonarqube.ws.client.roots.RootsService; import org.sonarqube.ws.client.rules.RulesService; import org.sonarqube.ws.client.securityreports.SecurityReportsService; @@ -144,8 +142,6 @@ public interface WsClient { PluginsService plugins(); - ProfilesService profiles(); - ProjectAnalysesService projectAnalyses(); ProjectBadgesService projectBadges(); @@ -168,8 +164,6 @@ public interface WsClient { QualityprofilesService qualityprofiles(); - ResourcesService resources(); - RootsService roots(); RulesService rules(); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java index ad47a8c0a8b..9b4cafe70ae 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/ActivityRequest.java @@ -32,11 +32,9 @@ import javax.annotation.Generated; public class ActivityRequest { private String componentId; - private String componentQuery; private String maxExecutedAt; private String minSubmittedAt; private String onlyCurrents; - private String p; private String ps; private String q; private List status; @@ -54,20 +52,6 @@ public class ActivityRequest { return componentId; } - /** - * Example value: "Apache" - * @deprecated since 5.5 - */ - @Deprecated - public ActivityRequest setComponentQuery(String componentQuery) { - this.componentQuery = componentQuery; - return this; - } - - public String getComponentQuery() { - return componentQuery; - } - /** * Example value: "2017-10-19T13:00:00+0200" */ @@ -110,19 +94,6 @@ public class ActivityRequest { return onlyCurrents; } - /** - * @deprecated since 5.5 - */ - @Deprecated - public ActivityRequest setP(String p) { - this.p = p; - return this; - } - - public String getP() { - return p; - } - /** * Example value: "20" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java index 2269d55f60f..030f8d30c83 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java @@ -57,11 +57,9 @@ public class CeService extends BaseService { return call( new GetRequest(path("activity")) .setParam("componentId", request.getComponentId()) - .setParam("componentQuery", request.getComponentQuery()) .setParam("maxExecutedAt", request.getMaxExecutedAt()) .setParam("minSubmittedAt", request.getMinSubmittedAt()) .setParam("onlyCurrents", request.getOnlyCurrents()) - .setParam("p", request.getP()) .setParam("ps", request.getPs()) .setParam("q", request.getQ()) .setParam("status", request.getStatus() == null ? null : request.getStatus().stream().collect(Collectors.joining(","))) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesWsParameters.java index 041813066b1..551ee1e4130 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issue/IssuesWsParameters.java @@ -52,11 +52,8 @@ public class IssuesWsParameters { public static final String PARAM_STATUSES = "statuses"; public static final String PARAM_RESOLUTIONS = "resolutions"; public static final String PARAM_RESOLVED = "resolved"; - public static final String PARAM_COMPONENTS = "components"; public static final String PARAM_COMPONENT_KEYS = "componentKeys"; public static final String PARAM_COMPONENT_UUIDS = "componentUuids"; - public static final String PARAM_COMPONENT_ROOTS = "componentRoots"; - public static final String PARAM_COMPONENT_ROOT_UUIDS = "componentRootUuids"; public static final String PARAM_MODULE_UUIDS = "moduleUuids"; public static final String PARAM_PROJECTS = "projects"; public static final String PARAM_PROJECT_KEYS = "projectKeys"; @@ -70,23 +67,10 @@ public class IssuesWsParameters { public static final String PARAM_ASSIGN = "assign"; public static final String PARAM_SET_SEVERITY = "set_severity"; public static final String PARAM_SET_TYPE = "set_type"; - public static final String PARAM_PLAN = "plan"; public static final String PARAM_DO_TRANSITION = "do_transition"; public static final String PARAM_ADD_TAGS = "add_tags"; public static final String PARAM_REMOVE_TAGS = "remove_tags"; public static final String PARAM_SEND_NOTIFICATIONS = "sendNotifications"; - - /** - * @deprecated since 5.5, action plan feature has been removed - */ - @Deprecated - public static final String DEPRECATED_PARAM_ACTION_PLANS = "actionPlans"; - - /** - * @deprecated since 5.5, manual issue feature has been dropped. - */ - @Deprecated - public static final String PARAM_REPORTERS = "reporters"; public static final String PARAM_ASSIGNEES = "assignees"; /** @@ -103,12 +87,6 @@ public class IssuesWsParameters { public static final String PARAM_SANS_TOP_25 = "sansTop25"; public static final String PARAM_CWE = "cwe"; public static final String PARAM_ASSIGNED = "assigned"; - - /** - * @deprecated since 5.5, action plan feature has been removed - */ - @Deprecated - public static final String PARAM_PLANNED = "planned"; public static final String PARAM_HIDE_COMMENTS = "hideComments"; public static final String PARAM_CREATED_AFTER = "createdAfter"; public static final String PARAM_CREATED_AT = "createdAt"; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java index 525b7878ccd..ba49a1378ef 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/AssignRequest.java @@ -19,7 +19,6 @@ */ package org.sonarqube.ws.client.issues; -import java.util.List; import javax.annotation.Generated; /** @@ -33,7 +32,6 @@ public class AssignRequest { private String assignee; private String issue; - private String me; /** * Example value: "admin" @@ -60,23 +58,4 @@ public class AssignRequest { return issue; } - /** - * Possible values: - *
      - *
    • "true"
    • - *
    • "false"
    • - *
    • "yes"
    • - *
    • "no"
    • - *
    - * @deprecated since 5.2 - */ - @Deprecated - public AssignRequest setMe(String me) { - this.me = me; - return this; - } - - public String getMe() { - return me; - } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java index 29a2305259b..cc9a67ef188 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/BulkChangeRequest.java @@ -36,7 +36,6 @@ public class BulkChangeRequest { private List comment; private String doTransition; private List issues; - private List plan; private String removeTags; private String sendNotifications; private List setSeverity; @@ -113,19 +112,6 @@ public class BulkChangeRequest { return issues; } - /** - * @deprecated since 5.5 - */ - @Deprecated - public BulkChangeRequest setPlan(List plan) { - this.plan = plan; - return this; - } - - public List getPlan() { - return plan; - } - /** * Example value: "security,java8" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java index bd898f434d9..5ba7108f346 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java @@ -75,8 +75,7 @@ public class IssuesService extends BaseService { return call( new PostRequest(path("assign")) .setParam("assignee", request.getAssignee()) - .setParam("issue", request.getIssue()) - .setParam("me", request.getMe()), + .setParam("issue", request.getIssue()), AssignResponse.parser()); } @@ -112,7 +111,6 @@ public class IssuesService extends BaseService { .setParam("comment", request.getComment() == null ? null : request.getComment().stream().collect(Collectors.joining(","))) .setParam("do_transition", request.getDoTransition()) .setParam("issues", request.getIssues() == null ? null : request.getIssues().stream().collect(Collectors.joining(","))) - .setParam("plan", request.getPlan() == null ? null : request.getPlan().stream().collect(Collectors.joining(","))) .setParam("remove_tags", request.getRemoveTags()) .setParam("sendNotifications", request.getSendNotifications()) .setParam("set_severity", request.getSetSeverity() == null ? null : request.getSetSeverity().stream().collect(Collectors.joining(","))) @@ -214,10 +212,7 @@ public class IssuesService extends BaseService { .setParam("authors", request.getAuthors() == null ? null : request.getAuthors().stream().collect(Collectors.joining(","))) .setParam("branch", request.getBranch()) .setParam("componentKeys", request.getComponentKeys() == null ? null : request.getComponentKeys().stream().collect(Collectors.joining(","))) - .setParam("componentRootUuids", request.getComponentRootUuids()) - .setParam("componentRoots", request.getComponentRoots()) .setParam("componentUuids", request.getComponentUuids() == null ? null : request.getComponentUuids().stream().collect(Collectors.joining(","))) - .setParam("components", request.getComponents()) .setParam("createdAfter", request.getCreatedAfter()) .setParam("createdAt", request.getCreatedAt()) .setParam("createdBefore", request.getCreatedBefore()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java index 08407bcda0e..8d2c4cd012d 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/SearchRequest.java @@ -39,10 +39,7 @@ public class SearchRequest { private List authors; private String branch; private List componentKeys; - private String componentRootUuids; - private String componentRoots; private List componentUuids; - private String components; private String createdAfter; private String createdAt; private String createdBefore; @@ -194,32 +191,6 @@ public class SearchRequest { return componentKeys; } - /** - * @deprecated since 5.1 - */ - @Deprecated - public SearchRequest setComponentRootUuids(String componentRootUuids) { - this.componentRootUuids = componentRootUuids; - return this; - } - - public String getComponentRootUuids() { - return componentRootUuids; - } - - /** - * @deprecated since 5.1 - */ - @Deprecated - public SearchRequest setComponentRoots(String componentRoots) { - this.componentRoots = componentRoots; - return this; - } - - public String getComponentRoots() { - return componentRoots; - } - /** * Example value: "584a89f2-8037-4f7b-b82c-8b45d2d63fb2" * @deprecated since 6.5 @@ -234,19 +205,6 @@ public class SearchRequest { return componentUuids; } - /** - * @deprecated since 5.1 - */ - @Deprecated - public SearchRequest setComponents(String components) { - this.components = components; - return this; - } - - public String getComponents() { - return components; - } - /** * Example value: "2017-10-19 or 2017-10-19T13:00:00+0200" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java deleted file mode 100644 index c1b2f9cb5a2..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/ProfilesService.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.profiles; - -import java.util.stream.Collectors; -import javax.annotation.Generated; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; - -/** - * @see Further information about this web service online - */ -@Generated("sonar-ws-generator") -public class ProfilesService extends BaseService { - - public ProfilesService(WsConnector wsConnector) { - super(wsConnector, "api/profiles"); - } - - /** - * - * This is part of the internal API. - * This is a GET request. - * @see Further information about this action online (including a response example) - * @since 3.3 - * @deprecated since 5.2 - */ - @Deprecated - public String index() { - return call( - new GetRequest(path("index")) - .setMediaType(MediaTypes.JSON) - ).content(); - } - - /** - * - * This is part of the internal API. - * This is a GET request. - * @see Further information about this action online (including a response example) - * @since 3.3 - * @deprecated since 5.2 - */ - @Deprecated - public String list() { - return call( - new GetRequest(path("list")) - .setMediaType(MediaTypes.JSON) - ).content(); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java deleted file mode 100644 index 006b0a0e14c..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/profiles/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -@ParametersAreNonnullByDefault -@Generated("sonar-ws-generator") -package org.sonarqube.ws.client.profiles; - -import javax.annotation.ParametersAreNonnullByDefault; -import javax.annotation.Generated; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java deleted file mode 100644 index 1fb3839586f..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/ResourcesService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarqube.ws.client.resources; - -import javax.annotation.Generated; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.WsConnector; - -/** - * @see Further information about this web service online - */ -@Generated("sonar-ws-generator") -public class ResourcesService extends BaseService { - - public ResourcesService(WsConnector wsConnector) { - super(wsConnector, "api/resources"); - } - - /** - * - * This is part of the internal API. - * This is a GET request. - * @see Further information about this action online (including a response example) - * @since 2.10 - * @deprecated since 5.4 - */ - @Deprecated - public String index() { - return call( - new GetRequest(path("index")) - .setMediaType(MediaTypes.JSON) - ).content(); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java deleted file mode 100644 index 889693352d6..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/resources/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2019 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -@ParametersAreNonnullByDefault -@Generated("sonar-ws-generator") -package org.sonarqube.ws.client.resources; - -import javax.annotation.ParametersAreNonnullByDefault; -import javax.annotation.Generated; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java index 4f4258db45f..12ee49ce9f2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/CreateRequest.java @@ -32,7 +32,6 @@ import javax.annotation.Generated; public class CreateRequest { private String customKey; - private String manualKey; private String markdownDescription; private String name; private List params; @@ -55,20 +54,6 @@ public class CreateRequest { return customKey; } - /** - * Example value: "Error_handling" - * @deprecated since 5.5 - */ - @Deprecated - public CreateRequest setManualKey(String manualKey) { - this.manualKey = manualKey; - return this; - } - - public String getManualKey() { - return manualKey; - } - /** * This is a mandatory parameter. * Example value: "Description of my custom rule" diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java index 9765e85ed3f..5ced2ae48b1 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/RulesService.java @@ -22,15 +22,15 @@ package org.sonarqube.ws.client.rules; import java.util.stream.Collectors; import javax.annotation.Generated; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; import org.sonarqube.ws.Rules.CreateResponse; import org.sonarqube.ws.Rules.ListResponse; import org.sonarqube.ws.Rules.SearchResponse; import org.sonarqube.ws.Rules.ShowResponse; import org.sonarqube.ws.Rules.UpdateResponse; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; /** * @see Further information about this web service online @@ -68,7 +68,6 @@ public class RulesService extends BaseService { call( new PostRequest(path("create")) .setParam("custom_key", request.getCustomKey()) - .setParam("manual_key", request.getManualKey()) .setParam("markdown_description", request.getMarkdownDescription()) .setParam("name", request.getName()) .setParam("params", request.getParams() == null ? null : request.getParams().stream().collect(Collectors.joining(","))) @@ -204,10 +203,6 @@ public class RulesService extends BaseService { public void update(UpdateRequest request) { call( new PostRequest(path("update")) - .setParam("debt_remediation_fn_offset", request.getDebtRemediationFnOffset()) - .setParam("debt_remediation_fn_type", request.getDebtRemediationFnType()) - .setParam("debt_remediation_fy_coeff", request.getDebtRemediationFyCoeff()) - .setParam("debt_sub_characteristic", request.getDebtSubCharacteristic()) .setParam("key", request.getKey()) .setParam("markdown_description", request.getMarkdownDescription()) .setParam("markdown_note", request.getMarkdownNote()) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java index bb36c8fbc36..c741af1eacc 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/rules/UpdateRequest.java @@ -31,10 +31,6 @@ import javax.annotation.Generated; @Generated("sonar-ws-generator") public class UpdateRequest { - private String debtRemediationFnOffset; - private String debtRemediationFnType; - private String debtRemediationFyCoeff; - private String debtSubCharacteristic; private String key; private String markdownDescription; private String markdownNote; @@ -48,64 +44,6 @@ public class UpdateRequest { private String status; private List tags; - /** - * @deprecated since 5.5 - */ - @Deprecated - public UpdateRequest setDebtRemediationFnOffset(String debtRemediationFnOffset) { - this.debtRemediationFnOffset = debtRemediationFnOffset; - return this; - } - - public String getDebtRemediationFnOffset() { - return debtRemediationFnOffset; - } - - /** - * Possible values: - *
      - *
    • "LINEAR"
    • - *
    • "LINEAR_OFFSET"
    • - *
    • "CONSTANT_ISSUE"
    • - *
    - * @deprecated since 5.5 - */ - @Deprecated - public UpdateRequest setDebtRemediationFnType(String debtRemediationFnType) { - this.debtRemediationFnType = debtRemediationFnType; - return this; - } - - public String getDebtRemediationFnType() { - return debtRemediationFnType; - } - - /** - * @deprecated since 5.5 - */ - @Deprecated - public UpdateRequest setDebtRemediationFyCoeff(String debtRemediationFyCoeff) { - this.debtRemediationFyCoeff = debtRemediationFyCoeff; - return this; - } - - public String getDebtRemediationFyCoeff() { - return debtRemediationFyCoeff; - } - - /** - * @deprecated since 5.5 - */ - @Deprecated - public UpdateRequest setDebtSubCharacteristic(String debtSubCharacteristic) { - this.debtSubCharacteristic = debtSubCharacteristic; - return this; - } - - public String getDebtSubCharacteristic() { - return debtSubCharacteristic; - } - /** * This is a mandatory parameter. * Example value: "javascript:NullCheck" diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java index e3cfead6dae..60a802258b0 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java @@ -19,7 +19,6 @@ */ package org.sonarqube.ws.client.users; -import java.util.List; import javax.annotation.Generated; /** @@ -31,36 +30,10 @@ import javax.annotation.Generated; @Generated("sonar-ws-generator") public class SearchRequest { - private List f; private String p; private String ps; private String q; - /** - * Possible values: - *
      - *
    • "name"
    • - *
    • "email"
    • - *
    • "avatart"
    • - *
    • "scmAccounts"
    • - *
    • "groups"
    • - *
    • "active"
    • - *
    • "local"
    • - *
    • "externalIdentity"
    • - *
    • "externalProvider"
    • - *
    - * @deprecated since 5.4 - */ - @Deprecated - public SearchRequest setF(List f) { - this.f = f; - return this; - } - - public List getF() { - return f; - } - /** * Example value: "42" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java index dcbda8e2c2b..c96a7aa4930 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java @@ -149,7 +149,6 @@ public class UsersService extends BaseService { public SearchWsResponse search(SearchRequest request) { return call( new GetRequest(path("search")) - .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(","))) .setParam("p", request.getP()) .setParam("ps", request.getPs()) .setParam("q", request.getQ()), -- 2.39.5