From 554fb67ddb958cdfafb6fcd40b7d50a298e8d147 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 22 Nov 2017 21:51:52 +0100 Subject: [PATCH] Initial generation of sonar-ws client --- .../sonar/server/branch/ws/BranchesWs.java | 6 +- .../sonar/server/branch/ws/DeleteAction.java | 6 +- .../sonar/server/branch/ws/ListAction.java | 4 +- .../branch/ws}/ProjectBranchesParameters.java | 3 +- .../sonar/server/branch/ws/RenameAction.java | 6 +- .../sonar/server/ce/ws/ActivityAction.java | 14 +-- .../server/ce/ws/ActivityStatusAction.java | 4 +- .../sonar/server/ce/ws}/CeWsParameters.java | 2 +- .../sonar/server/ce/ws/ComponentAction.java | 4 +- .../sonar/server/ce/ws/WorkerCountAction.java | 2 +- .../sonar/server/favorite/ws/AddAction.java | 2 +- .../favorite/ws}/FavoritesWsParameters.java | 2 +- .../server/favorite/ws/RemoveAction.java | 2 +- .../server/favorite/ws/SearchAction.java | 13 +-- .../server/notification/ws/AddAction.java | 31 +++--- .../server/notification/ws/ListAction.java | 4 +- .../notification/ws/NotificationsWs.java | 2 +- .../ws}/NotificationsWsParameters.java | 2 +- .../server/notification/ws/RemoveAction.java | 31 +++--- .../server/projectlink/ws/CreateAction.java | 22 ++-- .../server/projectlink/ws/DeleteAction.java | 18 ++-- .../ws}/ProjectLinksWsParameters.java | 2 +- .../server/projectlink/ws/SearchAction.java | 18 ++-- .../server/qualitygate/ws/CopyAction.java | 4 +- .../server/qualitygate/ws/CreateAction.java | 4 +- .../qualitygate/ws/CreateConditionAction.java | 14 +-- .../qualitygate/ws/DeleteConditionAction.java | 2 +- .../server/qualitygate/ws/DeselectAction.java | 4 +- .../server/qualitygate/ws/DestroyAction.java | 1 - .../qualitygate/ws/GetByProjectAction.java | 2 +- .../qualitygate/ws/ProjectStatusAction.java | 8 +- .../server/qualitygate/ws/QualityGatesWs.java | 16 +-- .../ws}/QualityGatesWsParameters.java | 2 +- .../server/qualitygate/ws/RenameAction.java | 4 +- .../server/qualitygate/ws/SearchAction.java | 1 - .../server/qualitygate/ws/SelectAction.java | 8 +- .../qualitygate/ws/SetAsDefaultAction.java | 1 - .../server/qualitygate/ws/ShowAction.java | 4 +- .../qualitygate/ws/UnsetDefaultAction.java | 1 - .../qualitygate/ws/UpdateConditionAction.java | 14 +-- .../server/usertoken/ws/GenerateAction.java | 20 ++-- .../server/usertoken/ws/RevokeAction.java | 22 ++-- .../server/usertoken/ws/SearchAction.java | 20 ++-- .../server/usertoken/ws/UserTokensWs.java | 2 +- .../usertoken/ws}/UserTokensWsParameters.java | 2 +- .../server/ce/ws/ActivityActionTest.java | 13 ++- .../ce/ws/ActivityStatusActionTest.java | 5 +- .../server/ce/ws/ComponentActionTest.java | 4 +- .../server/favorite/ws/AddActionTest.java | 2 +- .../server/favorite/ws/RemoveActionTest.java | 2 +- .../server/notification/ws/AddActionTest.java | 24 ++--- .../notification/ws/RemoveActionTest.java | 24 ++--- .../projectlink/ws/CreateActionTest.java | 8 +- .../projectlink/ws/DeleteActionTest.java | 2 +- .../projectlink/ws/SearchActionTest.java | 4 +- .../ws/CreateConditionActionTest.java | 12 +-- .../ws/DeleteConditionActionTest.java | 2 +- .../ws/ProjectStatusActionTest.java | 6 +- .../ws/UpdateConditionActionTest.java | 12 +-- .../usertoken/ws/GenerateActionTest.java | 4 +- .../server/usertoken/ws/RevokeActionTest.java | 4 +- .../server/usertoken/ws/SearchActionTest.java | 2 +- .../sonarqube/ws/client/DefaultWsClient.java | 30 ++++-- .../org/sonarqube/ws/client/WsClient.java | 17 +-- .../sonarqube/ws/client/ce/package-info.java | 24 ----- .../ws/client/favorite/FavoritesService.java | 63 ----------- .../ws/client/favorite/SearchRequest.java | 53 --------- .../ws/client/favorite/package-info.java | 24 ----- .../ws/client/notification/AddRequest.java | 98 ----------------- .../ws/client/notification/RemoveRequest.java | 98 ----------------- .../ws/client/notification/package-info.java | 24 ----- .../ProjectBranchesServiceOld.java | 71 ------------ .../client/projectbranches/package-info.java | 24 ----- .../client/projectlinks/CreateWsRequest.java | 68 ------------ .../client/projectlinks/DeleteWsRequest.java | 33 ------ .../projectlinks/ProjectLinksService.java | 64 ----------- .../client/projectlinks/SearchWsRequest.java | 50 --------- .../ws/client/projectlinks/package-info.java | 24 ----- .../ws/client/qualitygate/package-info.java | 24 ----- .../ws/client/system/SystemServiceOld.java | 53 --------- .../ws/client/system/package-info.java | 24 ----- .../client/usertoken/GenerateWsRequest.java | 47 -------- .../ws/client/usertoken/RevokeWsRequest.java | 47 -------- .../ws/client/usertoken/SearchWsRequest.java | 37 ------- .../client/usertoken/UserTokensService.java | 63 ----------- .../ws/client/usertoken/package-info.java | 24 ----- .../ws/client/webhook/DeliveriesRequest.java | 75 ------------- .../ws/client/webhook/WebhooksService.java | 51 --------- .../ws/client/webhook/package-info.java | 24 ----- .../client/favorite/FavoritesServiceTest.java | 67 ------------ .../ws/client/favorite/SearchRequestTest.java | 39 ------- .../ProjectBranchesServiceTest.java | 96 ----------------- .../projectlinks/ProjectLinksServiceTest.java | 102 ------------------ .../ws/client/system/SystemServiceTest.java | 88 --------------- .../tests/analysis/FavoriteTest.java | 2 +- .../sonarqube/tests/analysis/LinksTest.java | 6 +- .../tests/analysis/PermissionTest.java | 10 +- .../sonarqube/tests/component/BranchTest.java | 3 +- .../tests/project/ProjectLinksTest.java | 8 +- .../tests/project/ProjectsPageTest.java | 6 +- .../sonarqube/tests/user/FavoritesWsTest.java | 12 ++- .../tests/user/LocalAuthenticationTest.java | 16 +-- .../sonarqube/tests/webhook/WebhooksTest.java | 7 +- 103 files changed, 304 insertions(+), 1878 deletions(-) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches => server/sonar-server/src/main/java/org/sonar/server/branch/ws}/ProjectBranchesParameters.java (93%) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/ce => server/sonar-server/src/main/java/org/sonar/server/ce/ws}/CeWsParameters.java (97%) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/favorite => server/sonar-server/src/main/java/org/sonar/server/favorite/ws}/FavoritesWsParameters.java (96%) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/notification => server/sonar-server/src/main/java/org/sonar/server/notification/ws}/NotificationsWsParameters.java (96%) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks => server/sonar-server/src/main/java/org/sonar/server/projectlink/ws}/ProjectLinksWsParameters.java (96%) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate => server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws}/QualityGatesWsParameters.java (98%) rename {sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken => server/sonar-server/src/main/java/org/sonar/server/usertoken/ws}/UserTokensWsParameters.java (96%) delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/SearchRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/notification/AddRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/notification/RemoveRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/notification/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateWsRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteWsRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchWsRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/GenerateWsRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/RevokeWsRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/SearchWsRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/package-info.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/DeliveriesRequest.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/WebhooksService.java delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/package-info.java delete mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java delete mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/SearchRequestTest.java delete mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java delete mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java delete mode 100644 sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/BranchesWs.java b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/BranchesWs.java index 7275130e1f3..17bafb54e4f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/BranchesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/BranchesWs.java @@ -23,9 +23,9 @@ import java.util.Arrays; import org.sonar.api.server.ws.WebService; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.CONTROLLER; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_BRANCH; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT; public class BranchesWs implements WebService { private final BranchWsAction[] actions; diff --git a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/DeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/DeleteAction.java index a04f6deed31..fd461cc6dac 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/DeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/DeleteAction.java @@ -36,9 +36,9 @@ import org.sonar.server.user.UserSession; import static org.sonar.server.branch.ws.BranchesWs.addBranchParam; import static org.sonar.server.branch.ws.BranchesWs.addProjectParam; import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.ACTION_DELETE; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_BRANCH; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT; public class DeleteAction implements BranchWsAction { private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java index f82fe00936a..d337d8ca5fd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ListAction.java @@ -58,8 +58,8 @@ import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; import static org.sonar.db.component.BranchType.LONG; import static org.sonar.db.component.BranchType.SHORT; import static org.sonar.server.branch.ws.BranchesWs.addProjectParam; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.ACTION_LIST; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT; public class ListAction implements BranchWsAction { diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesParameters.java b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ProjectBranchesParameters.java similarity index 93% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/branch/ws/ProjectBranchesParameters.java index 1df51cf37d0..8dd09ac491a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/ProjectBranchesParameters.java @@ -17,7 +17,7 @@ * 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.projectbranches; +package org.sonar.server.branch.ws; public class ProjectBranchesParameters { @@ -25,7 +25,6 @@ public class ProjectBranchesParameters { // actions public static final String ACTION_LIST = "list"; - public static final String ACTION_SHOW = "show"; public static final String ACTION_DELETE = "delete"; public static final String ACTION_RENAME = "rename"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/RenameAction.java b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/RenameAction.java index a12cd80b10a..618659a1148 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/branch/ws/RenameAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/branch/ws/RenameAction.java @@ -34,9 +34,9 @@ import org.sonar.server.user.UserSession; import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.server.branch.ws.BranchesWs.addProjectParam; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.ACTION_RENAME; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_NAME; +import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT; public class RenameAction implements BranchWsAction { private final ComponentFinder componentFinder; 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 a3f773fc5ca..30febfb0af8 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 @@ -64,13 +64,13 @@ import static org.sonar.db.Pagination.forPage; import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; import static org.sonar.server.ws.WsUtils.checkRequest; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_QUERY; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE; +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; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_TYPE; public class ActivityAction implements CeWsAction { private static final int MAX_PAGE_SIZE = 1000; diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java index cbe55189827..d626c356732 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityStatusAction.java @@ -39,8 +39,8 @@ import org.sonarqube.ws.client.ce.ActivityStatusRequest; import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; +import static org.sonar.server.ce.ws.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; public class ActivityStatusAction implements CeWsAction { private final UserSession userSession; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java similarity index 97% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java index 9449526952d..a6e5647c4a5 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsParameters.java @@ -17,7 +17,7 @@ * 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.ce; +package org.sonar.server.ce.ws; public class CeWsParameters { diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java index 481164abc94..cce38feeeb7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java @@ -41,8 +41,8 @@ import org.sonarqube.ws.Ce.ComponentResponse; import static org.sonar.db.Pagination.forPage; import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; public class ComponentAction implements CeWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java index 5d0f402bec5..b4bab925277 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/WorkerCountAction.java @@ -28,7 +28,7 @@ import org.sonar.server.user.UserSession; import org.sonarqube.ws.Ce.WorkerCountResponse; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT; +import static org.sonar.server.ce.ws.CeWsParameters.ACTION_WORKER_COUNT; public class WorkerCountAction implements CeWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/AddAction.java b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/AddAction.java index 8625996ef32..ff341b13ad8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/AddAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/AddAction.java @@ -32,7 +32,7 @@ import org.sonar.server.favorite.FavoriteUpdater; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; +import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT; public class AddAction implements FavoritesWsAction { private final UserSession userSession; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavoritesWsParameters.java similarity index 96% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavoritesWsParameters.java index e38d8a70fe7..f7ee2da1478 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/FavoritesWsParameters.java @@ -17,7 +17,7 @@ * 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.favorite; +package org.sonar.server.favorite.ws; public class FavoritesWsParameters { public static final String CONTROLLER_FAVORITES = "api/favorites"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/RemoveAction.java b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/RemoveAction.java index a749e33d64f..a80f059531f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/RemoveAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/RemoveAction.java @@ -31,7 +31,7 @@ import org.sonar.server.favorite.FavoriteUpdater; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; +import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT; public class RemoveAction implements FavoritesWsAction { private final UserSession userSession; diff --git a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/SearchAction.java index a3bfca0621e..6b7b6ce40be 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/favorite/ws/SearchAction.java @@ -38,15 +38,16 @@ import org.sonar.server.user.UserSession; import org.sonarqube.ws.Common; import org.sonarqube.ws.Favorites.Favorite; import org.sonarqube.ws.Favorites.SearchResponse; -import org.sonarqube.ws.client.favorite.SearchRequest; +import org.sonarqube.ws.client.favorites.SearchRequest; import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.favorite.SearchRequest.MAX_PAGE_SIZE; +import static org.sonar.server.favorite.ws.FavoritesWsParameters.ACTION_SEARCH; public class SearchAction implements FavoritesWsAction { + private static final int MAX_PAGE_SIZE = 500; + private final FavoriteFinder favoriteFinder; private final DbClient dbClient; private final UserSession userSession; @@ -79,15 +80,15 @@ public class SearchAction implements FavoritesWsAction { private static SearchRequest toWsRequest(Request request) { return new SearchRequest() - .setPage(request.mandatoryParamAsInt(Param.PAGE)) - .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE)); + .setP(request.mandatoryParam(Param.PAGE)) + .setPs(request.mandatoryParam(Param.PAGE_SIZE)); } private SearchResults toSearchResults(SearchRequest request) { userSession.checkLoggedIn(); try (DbSession dbSession = dbClient.openSession(false)) { List authorizedFavorites = getAuthorizedFavorites(); - Paging paging = Paging.forPageIndex(request.getPage()).withPageSize(request.getPageSize()).andTotal(authorizedFavorites.size()); + Paging paging = Paging.forPageIndex(Integer.parseInt(request.getP())).withPageSize(Integer.parseInt(request.getPs())).andTotal(authorizedFavorites.size()); List displayedFavorites = authorizedFavorites.stream() .skip(paging.offset()) .limit(paging.pageSize()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/AddAction.java b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/AddAction.java index 65eab55e15a..4fac5363b70 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/AddAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/AddAction.java @@ -39,7 +39,7 @@ import org.sonar.server.notification.NotificationUpdater; import org.sonar.server.notification.email.EmailNotificationChannel; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import org.sonarqube.ws.client.notification.AddRequest; +import org.sonarqube.ws.client.notifications.AddRequest; import static java.util.Optional.empty; import static org.sonar.core.util.Protobuf.setNullable; @@ -48,11 +48,11 @@ import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBA import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; import static org.sonar.server.ws.WsUtils.checkFound; import static org.sonar.server.ws.WsUtils.checkRequest; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.ACTION_ADD; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE; +import static org.sonar.server.notification.ws.NotificationsWsParameters.ACTION_ADD; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE; public class AddAction implements NotificationsWsAction { private final NotificationCenter notificationCenter; @@ -152,25 +152,24 @@ public class AddAction implements NotificationsWsAction { } private AddRequest toWsRequest(Request request) { - AddRequest.Builder requestBuilder = AddRequest.builder() + AddRequest add = new AddRequest() .setType(request.mandatoryParam(PARAM_TYPE)) .setChannel(request.mandatoryParam(PARAM_CHANNEL)); - setNullable(request.param(PARAM_PROJECT), requestBuilder::setProject); - setNullable(request.param(PARAM_LOGIN), requestBuilder::setLogin); - AddRequest wsRequest = requestBuilder.build(); + setNullable(request.param(PARAM_PROJECT), add::setProject); + setNullable(request.param(PARAM_LOGIN), add::setLogin); - if (wsRequest.getProject() == null) { - checkRequest(globalDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s", + if (add.getProject() == null) { + checkRequest(globalDispatchers.contains(add.getType()), "Value of parameter '%s' (%s) must be one of: %s", PARAM_TYPE, - wsRequest.getType(), + add.getType(), globalDispatchers); } else { - checkRequest(projectDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s", + checkRequest(projectDispatchers.contains(add.getType()), "Value of parameter '%s' (%s) must be one of: %s", PARAM_TYPE, - wsRequest.getType(), + add.getType(), projectDispatchers); } - return wsRequest; + return add; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/ListAction.java index 3a81c95f56b..9730cac9215 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/ListAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/ListAction.java @@ -57,8 +57,8 @@ import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBA import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; import static org.sonar.server.ws.WsUtils.checkFound; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.ACTION_LIST; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN; +import static org.sonar.server.notification.ws.NotificationsWsParameters.ACTION_LIST; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN; public class ListAction implements NotificationsWsAction { private static final Splitter PROPERTY_KEY_SPLITTER = Splitter.on("."); diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWs.java b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWs.java index 30d6f5e5a15..43dbd684579 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWs.java @@ -21,7 +21,7 @@ package org.sonar.server.notification.ws; import org.sonar.api.server.ws.WebService; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.CONTROLLER; +import static org.sonar.server.notification.ws.NotificationsWsParameters.CONTROLLER; public class NotificationsWs implements WebService { private final NotificationsWsAction[] actions; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/NotificationsWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWsParameters.java similarity index 96% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/notification/NotificationsWsParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWsParameters.java index 40fe2541890..4e45e8dc854 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/NotificationsWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/NotificationsWsParameters.java @@ -17,7 +17,7 @@ * 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.notification; +package org.sonar.server.notification.ws; public class NotificationsWsParameters { public static final String CONTROLLER = "api/notifications"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/RemoveAction.java b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/RemoveAction.java index e44841a5bde..b8cd0a79ed2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/notification/ws/RemoveAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/notification/ws/RemoveAction.java @@ -39,7 +39,7 @@ import org.sonar.server.notification.NotificationUpdater; import org.sonar.server.notification.email.EmailNotificationChannel; import org.sonar.server.user.UserSession; import org.sonar.server.ws.KeyExamples; -import org.sonarqube.ws.client.notification.RemoveRequest; +import org.sonarqube.ws.client.notifications.RemoveRequest; import static java.util.Optional.empty; import static org.sonar.core.util.Protobuf.setNullable; @@ -47,11 +47,11 @@ import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBA import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; import static org.sonar.server.ws.WsUtils.checkFound; import static org.sonar.server.ws.WsUtils.checkRequest; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.ACTION_REMOVE; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE; +import static org.sonar.server.notification.ws.NotificationsWsParameters.ACTION_REMOVE; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE; public class RemoveAction implements NotificationsWsAction { private final NotificationCenter notificationCenter; @@ -150,25 +150,24 @@ public class RemoveAction implements NotificationsWsAction { } private RemoveRequest toWsRequest(Request request) { - RemoveRequest.Builder requestBuilder = RemoveRequest.builder() + RemoveRequest remove = new RemoveRequest() .setType(request.mandatoryParam(PARAM_TYPE)) .setChannel(request.mandatoryParam(PARAM_CHANNEL)); - setNullable(request.param(PARAM_PROJECT), requestBuilder::setProject); - setNullable(request.param(PARAM_LOGIN), requestBuilder::setLogin); - RemoveRequest wsRequest = requestBuilder.build(); + setNullable(request.param(PARAM_PROJECT), remove::setProject); + setNullable(request.param(PARAM_LOGIN), remove::setLogin); - if (wsRequest.getProject() == null) { - checkRequest(globalDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s", + if (remove.getProject() == null) { + checkRequest(globalDispatchers.contains(remove.getType()), "Value of parameter '%s' (%s) must be one of: %s", PARAM_TYPE, - wsRequest.getType(), + remove.getType(), globalDispatchers); } else { - checkRequest(projectDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s", + checkRequest(projectDispatchers.contains(remove.getType()), "Value of parameter '%s' (%s) must be one of: %s", PARAM_TYPE, - wsRequest.getType(), + remove.getType(), projectDispatchers); } - return wsRequest; + return remove; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java index 69fec71a4c8..11f7a31009f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/CreateAction.java @@ -31,17 +31,17 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonarqube.ws.ProjectLinks; import org.sonarqube.ws.ProjectLinks.CreateWsResponse; -import org.sonarqube.ws.client.projectlinks.CreateWsRequest; +import org.sonarqube.ws.client.projectlinks.CreateRequest; import static org.sonar.core.util.Slug.slugify; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_CREATE; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.ACTION_CREATE; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_NAME; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_URL; public class CreateAction implements ProjectLinksWsAction { private final DbClient dbClient; @@ -92,12 +92,12 @@ public class CreateAction implements ProjectLinksWsAction { @Override public void handle(Request request, Response response) throws Exception { - CreateWsRequest searchWsRequest = toCreateWsRequest(request); + CreateRequest searchWsRequest = toCreateWsRequest(request); CreateWsResponse createWsResponse = doHandle(searchWsRequest); writeProtobuf(createWsResponse, request, response); } - private CreateWsResponse doHandle(CreateWsRequest createWsRequest) { + private CreateWsResponse doHandle(CreateRequest createWsRequest) { String name = createWsRequest.getName(); String url = createWsRequest.getUrl(); @@ -127,7 +127,7 @@ public class CreateAction implements ProjectLinksWsAction { .build(); } - private ComponentDto getComponentByUuidOrKey(DbSession dbSession, CreateWsRequest request) { + private ComponentDto getComponentByUuidOrKey(DbSession dbSession, CreateRequest request) { return componentFinder.getRootComponentByUuidOrKey( dbSession, request.getProjectId(), @@ -135,8 +135,8 @@ public class CreateAction implements ProjectLinksWsAction { ComponentFinder.ParamNames.PROJECT_ID_AND_KEY); } - private static CreateWsRequest toCreateWsRequest(Request request) { - return new CreateWsRequest() + private static CreateRequest toCreateWsRequest(Request request) { + return new CreateRequest() .setProjectId(request.param(PARAM_PROJECT_ID)) .setProjectKey(request.param(PARAM_PROJECT_KEY)) .setName(request.mandatoryParam(PARAM_NAME)) diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/DeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/DeleteAction.java index 8fac8ecdb67..243aac6040c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/DeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/DeleteAction.java @@ -28,11 +28,11 @@ import org.sonar.db.DbSession; import org.sonar.db.component.ComponentLinkDto; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsUtils; -import org.sonarqube.ws.client.projectlinks.DeleteWsRequest; +import org.sonarqube.ws.client.projectlinks.DeleteRequest; import static org.sonar.db.component.ComponentLinkDto.PROVIDED_TYPES; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_DELETE; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.ACTION_DELETE; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_ID; public class DeleteAction implements ProjectLinksWsAction { private final DbClient dbClient; @@ -61,19 +61,19 @@ public class DeleteAction implements ProjectLinksWsAction { @Override public void handle(Request request, Response response) throws Exception { - DeleteWsRequest deleteWsRequest = toDeleteWsRequest(request); + DeleteRequest deleteWsRequest = toDeleteWsRequest(request); doHandle(deleteWsRequest); response.noContent(); } - private static DeleteWsRequest toDeleteWsRequest(Request request) { - return new DeleteWsRequest() - .setId(request.mandatoryParamAsLong(PARAM_ID)); + private static DeleteRequest toDeleteWsRequest(Request request) { + return new DeleteRequest() + .setId(request.mandatoryParam(PARAM_ID)); } - private void doHandle(DeleteWsRequest request) { + private void doHandle(DeleteRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { - long id = request.getId(); + long id = Long.parseLong(request.getId()); ComponentLinkDto link = dbClient.componentLinkDao().selectById(dbSession, id); link = WsUtils.checkFound(link, "Link with id '%s' not found", id); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/ProjectLinksWsParameters.java similarity index 96% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksWsParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/ProjectLinksWsParameters.java index 6b4c6482314..426fcbad289 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/ProjectLinksWsParameters.java @@ -17,7 +17,7 @@ * 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.projectlinks; +package org.sonar.server.projectlink.ws; public class ProjectLinksWsParameters { diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java index 4a66a049295..0410d9c3f01 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/projectlink/ws/SearchAction.java @@ -33,16 +33,16 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonarqube.ws.ProjectLinks.Link; import org.sonarqube.ws.ProjectLinks.SearchWsResponse; -import org.sonarqube.ws.client.projectlinks.SearchWsRequest; +import org.sonarqube.ws.client.projectlinks.SearchRequest; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.ACTION_SEARCH; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY; public class SearchAction implements ProjectLinksWsAction { private final DbClient dbClient; @@ -82,13 +82,13 @@ public class SearchAction implements ProjectLinksWsAction { @Override public void handle(Request request, Response response) throws Exception { - SearchWsRequest searchWsRequest = toSearchWsRequest(request); + SearchRequest searchWsRequest = toSearchWsRequest(request); SearchWsResponse searchWsResponse = doHandle(searchWsRequest); writeProtobuf(searchWsResponse, request, response); } - private SearchWsResponse doHandle(SearchWsRequest searchWsRequest) { + private SearchWsResponse doHandle(SearchRequest searchWsRequest) { try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto component = getComponentByUuidOrKey(dbSession, searchWsRequest); List links = dbClient.componentLinkDao() @@ -114,7 +114,7 @@ public class SearchAction implements ProjectLinksWsAction { return builder.build(); } - private ComponentDto getComponentByUuidOrKey(DbSession dbSession, SearchWsRequest request) { + private ComponentDto getComponentByUuidOrKey(DbSession dbSession, SearchRequest request) { ComponentDto component = componentFinder.getRootComponentByUuidOrKey( dbSession, request.getProjectId(), @@ -129,8 +129,8 @@ public class SearchAction implements ProjectLinksWsAction { return component; } - private static SearchWsRequest toSearchWsRequest(Request request) { - return new SearchWsRequest() + private static SearchRequest toSearchWsRequest(Request request) { + return new SearchRequest() .setProjectId(request.param(PARAM_PROJECT_ID)) .setProjectKey(request.param(PARAM_PROJECT_KEY)); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java index 5a31ccb33c6..187e71c3436 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java @@ -26,8 +26,8 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME; public class CopyAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java index e188f654036..9dae665d2d4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java @@ -32,8 +32,8 @@ import org.sonar.server.user.UserSession; import org.sonarqube.ws.Qualitygates.CreateWsResponse; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_CREATE; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME; public class CreateAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java index 14361803e3f..d54894299c6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java @@ -34,13 +34,13 @@ import org.sonarqube.ws.Qualitygates.CreateConditionWsResponse; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.server.qualitygate.ws.QualityGatesWs.addConditionParams; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE_CONDITION; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_CREATE_CONDITION; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING; public class CreateConditionAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java index 06c181b9aa4..45bc460ddb5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java @@ -28,7 +28,7 @@ import org.sonar.db.organization.OrganizationDto; import org.sonar.server.user.UserSession; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; public class DeleteConditionAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java index affdf16ab10..771287b0061 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java @@ -33,8 +33,8 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.qualitygate.QualityGates; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY; public class DeselectAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java index b068af02f1c..f2aca2ffea6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java @@ -23,7 +23,6 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters; public class DestroyAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java index 5a6af960e6b..8c89d6381d3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/GetByProjectAction.java @@ -38,7 +38,7 @@ import org.sonarqube.ws.Qualitygates.GetByProjectWsResponse; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_GET_BY_PROJECT; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_GET_BY_PROJECT; public class GetByProjectAction implements QualityGatesWsAction { private static final String PARAM_PROJECT = "project"; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java index ab79a97b456..46fbf90e8d0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java @@ -50,10 +50,10 @@ import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesEx import static org.sonar.server.ws.WsUtils.checkFoundWithOptional; import static org.sonar.server.ws.WsUtils.checkRequest; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_PROJECT_STATUS; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_PROJECT_STATUS; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ANALYSIS_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY; public class ProjectStatusAction implements QualityGatesWsAction { private static final String QG_STATUSES_ONE_LINE = Arrays.stream(ProjectStatusWsResponse.Status.values()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWs.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWs.java index 41865e75d92..df2d83fa411 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWs.java @@ -26,14 +26,14 @@ import org.sonar.db.qualitygate.QualityGateConditionDto; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.exceptions.BadRequestException; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.CONTROLLER_QUALITY_GATES; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.CONTROLLER_QUALITY_GATES; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING; public class QualityGatesWs implements WebService { diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWsParameters.java similarity index 98% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesWsParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWsParameters.java index 8764d64d3a6..b10013f0285 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/QualityGatesWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWsParameters.java @@ -17,7 +17,7 @@ * 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.qualitygate; +package org.sonar.server.qualitygate.ws; public class QualityGatesWsParameters { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java index 8f49fffc6a9..4421c21f000 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java @@ -27,8 +27,8 @@ import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; import static org.sonar.server.qualitygate.ws.CreateAction.NAME_MAXIMUM_LENGTH; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME; public class RenameAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java index a8f7407949b..285d723bec7 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java @@ -28,7 +28,6 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.ProjectQgateAssociation; import org.sonar.db.qualitygate.ProjectQgateAssociationQuery; import org.sonar.server.qualitygate.QgateProjectFinder; -import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters; public class SearchAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java index c3e33f58fcc..1002fd8d083 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java @@ -39,10 +39,10 @@ import static org.sonar.server.qualitygate.QualityGates.SONAR_QUALITYGATE_PROPER import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.server.ws.WsUtils.checkFound; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_SELECT; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_SELECT; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY; public class SelectAction implements QualityGatesWsAction { private final DbClient dbClient; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java index f9841353ec9..823d7ced164 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java @@ -23,7 +23,6 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters; public class SetAsDefaultAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java index 185941ae266..8bc6bde9463 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java @@ -31,8 +31,8 @@ import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; import static org.sonar.server.ws.WsUtils.checkRequest; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME; public class ShowAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java index 9daf27fb677..555004feb49 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java @@ -23,7 +23,6 @@ import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters; public class UnsetDefaultAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java index 8284bf3d9c4..dff97b49f94 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java @@ -34,13 +34,13 @@ import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; import static org.sonar.server.qualitygate.ws.QualityGatesWs.addConditionParams; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_UPDATE_CONDITION; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_UPDATE_CONDITION; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING; public class UpdateConditionAction implements QualityGatesWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java index cacf3c77994..02973e250cb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/GenerateAction.java @@ -33,15 +33,15 @@ import org.sonar.server.user.UserSession; import org.sonar.server.usertoken.TokenGenerator; import org.sonarqube.ws.UserTokens; import org.sonarqube.ws.UserTokens.GenerateWsResponse; -import org.sonarqube.ws.client.usertoken.GenerateWsRequest; +import org.sonarqube.ws.client.usertokens.GenerateRequest; import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; import static org.sonar.server.ws.WsUtils.checkRequest; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_GENERATE; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.ACTION_GENERATE; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME; public class GenerateAction implements UserTokensWsAction { private static final int MAX_TOKEN_NAME_LENGTH = 100; @@ -85,7 +85,7 @@ public class GenerateAction implements UserTokensWsAction { writeProtobuf(generateWsResponse, request, response); } - private UserTokens.GenerateWsResponse doHandle(GenerateWsRequest request) { + private UserTokens.GenerateWsResponse doHandle(GenerateRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { checkWsRequest(dbSession, request); TokenPermissionsValidator.validate(userSession, request.getLogin()); @@ -109,21 +109,21 @@ public class GenerateAction implements UserTokensWsAction { return tokenHash; } - private void checkWsRequest(DbSession dbSession, GenerateWsRequest request) { + private void checkWsRequest(DbSession dbSession, GenerateRequest request) { checkLoginExists(dbSession, request); Optional userTokenDto = dbClient.userTokenDao().selectByLoginAndName(dbSession, request.getLogin(), request.getName()); checkRequest(!userTokenDto.isPresent(), "A user token with login '%s' and name '%s' already exists", request.getLogin(), request.getName()); } - private void checkLoginExists(DbSession dbSession, GenerateWsRequest request) { + private void checkLoginExists(DbSession dbSession, GenerateRequest request) { UserDto user = dbClient.userDao().selectByLogin(dbSession, request.getLogin()); if (user == null) { throw insufficientPrivilegesException(); } } - private UserTokenDto insertTokenInDb(DbSession dbSession, GenerateWsRequest request, String tokenHash) { + private UserTokenDto insertTokenInDb(DbSession dbSession, GenerateRequest request, String tokenHash) { UserTokenDto userTokenDto = new UserTokenDto() .setLogin(request.getLogin()) .setName(request.getName()) @@ -135,8 +135,8 @@ public class GenerateAction implements UserTokensWsAction { return userTokenDto; } - private GenerateWsRequest toCreateWsRequest(Request request) { - GenerateWsRequest generateWsRequest = new GenerateWsRequest() + private GenerateRequest toCreateWsRequest(Request request) { + GenerateRequest generateWsRequest = new GenerateRequest() .setLogin(request.param(PARAM_LOGIN)) .setName(request.mandatoryParam(PARAM_NAME).trim()); if (generateWsRequest.getLogin() == null) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/RevokeAction.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/RevokeAction.java index 54847018688..fe828f6b411 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/RevokeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/RevokeAction.java @@ -25,11 +25,11 @@ import org.sonar.api.server.ws.WebService; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.client.usertoken.RevokeWsRequest; +import org.sonarqube.ws.client.usertokens.RevokeRequest; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_REVOKE; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.ACTION_REVOKE; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME; public class RevokeAction implements UserTokensWsAction { private final DbClient dbClient; @@ -61,11 +61,11 @@ public class RevokeAction implements UserTokensWsAction { @Override public void handle(Request request, Response response) throws Exception { - doHandle(toRevokeWsRequest(request)); + doHandle(toRevokeRequest(request)); response.noContent(); } - private void doHandle(RevokeWsRequest request) { + private void doHandle(RevokeRequest request) { TokenPermissionsValidator.validate(userSession, request.getLogin()); try (DbSession dbSession = dbClient.openSession(false)) { @@ -74,13 +74,13 @@ public class RevokeAction implements UserTokensWsAction { } } - private RevokeWsRequest toRevokeWsRequest(Request request) { - RevokeWsRequest revokeWsRequest = new RevokeWsRequest() + private RevokeRequest toRevokeRequest(Request request) { + RevokeRequest RevokeRequest = new RevokeRequest() .setLogin(request.param(PARAM_LOGIN)) .setName(request.mandatoryParam(PARAM_NAME)); - if (revokeWsRequest.getLogin() == null) { - revokeWsRequest.setLogin(userSession.getLogin()); + if (RevokeRequest.getLogin() == null) { + RevokeRequest.setLogin(userSession.getLogin()); } - return revokeWsRequest; + return RevokeRequest; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java index cadf64b42bb..e946788bfae 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/SearchAction.java @@ -29,13 +29,13 @@ import org.sonar.db.DbSession; import org.sonar.db.user.UserTokenDto; import org.sonar.server.user.UserSession; import org.sonarqube.ws.UserTokens.SearchWsResponse; -import org.sonarqube.ws.client.usertoken.SearchWsRequest; +import org.sonarqube.ws.client.usertokens.SearchRequest; import static org.sonar.api.utils.DateUtils.formatDateTime; import static org.sonar.server.ws.WsUtils.checkFound; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.ACTION_SEARCH; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN; public class SearchAction implements UserTokensWsAction { private final DbClient dbClient; @@ -63,11 +63,11 @@ public class SearchAction implements UserTokensWsAction { @Override public void handle(Request request, Response response) throws Exception { - SearchWsResponse searchWsResponse = doHandle(toSearchWsRequest(request)); + SearchWsResponse searchWsResponse = doHandle(toSearchRequest(request)); writeProtobuf(searchWsResponse, request, response); } - private SearchWsResponse doHandle(SearchWsRequest request) { + private SearchWsResponse doHandle(SearchRequest request) { TokenPermissionsValidator.validate(userSession, request.getLogin()); try (DbSession dbSession = dbClient.openSession(false)) { @@ -78,12 +78,12 @@ public class SearchAction implements UserTokensWsAction { } } - private SearchWsRequest toSearchWsRequest(Request request) { - SearchWsRequest searchWsRequest = new SearchWsRequest().setLogin(request.param(PARAM_LOGIN)); - if (searchWsRequest.getLogin() == null) { - searchWsRequest.setLogin(userSession.getLogin()); + private SearchRequest toSearchRequest(Request request) { + SearchRequest SearchRequest = new SearchRequest().setLogin(request.param(PARAM_LOGIN)); + if (SearchRequest.getLogin() == null) { + SearchRequest.setLogin(userSession.getLogin()); } - return searchWsRequest; + return SearchRequest; } private static SearchWsResponse buildResponse(String login, List userTokensDto) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWs.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWs.java index 7710e885822..760d3500392 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWs.java @@ -21,7 +21,7 @@ package org.sonar.server.usertoken.ws; import org.sonar.api.server.ws.WebService; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.CONTROLLER; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.CONTROLLER; public class UserTokensWs implements WebService { private final UserTokensWsAction[] actions; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensWsParameters.java b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWsParameters.java similarity index 96% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensWsParameters.java rename to server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWsParameters.java index 76d8c793b13..bad14a08afc 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensWsParameters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/usertoken/ws/UserTokensWsParameters.java @@ -17,7 +17,7 @@ * 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.usertoken; +package org.sonar.server.usertoken.ws; public class UserTokensWsParameters { public static final String CONTROLLER = "api/user_tokens"; 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 d21308296a8..11f0cc414a4 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 @@ -53,7 +53,6 @@ import org.sonar.test.JsonAssert; import org.sonarqube.ws.Ce; import org.sonarqube.ws.Common; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.Ce; import org.sonarqube.ws.Ce.ActivityResponse; import org.sonarqube.ws.Ce.Task; @@ -70,12 +69,12 @@ import static org.sonar.db.ce.CeQueueDto.Status.PENDING; import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY; import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY; import static org.sonar.db.component.BranchType.LONG; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_QUERY; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE; +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; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_TYPE; public class ActivityActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java index ca9f836a290..11bcaaa09f2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityStatusActionTest.java @@ -41,14 +41,13 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.Ce; -import org.sonarqube.ws.Ce; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.ce.CeQueueTesting.newCeQueueDto; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; +import static org.sonar.server.ce.ws.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; public class ActivityStatusActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java index c270a9058b7..14f555993f2 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java @@ -53,8 +53,8 @@ import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY; import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY; import static org.sonar.db.component.BranchType.LONG; import static org.sonar.db.component.BranchType.SHORT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT; -import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT; +import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID; public class ComponentActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java index b4aad0ceba1..1206e212e53 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/AddActionTest.java @@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; +import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT; public class AddActionTest { private static final String PROJECT_KEY = "project-key"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java index 63fcc8e05c2..a362110143a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/favorite/ws/RemoveActionTest.java @@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; +import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT; public class RemoveActionTest { private static final String PROJECT_KEY = "project-key"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java index 3f024bd13ee..95558a89bcb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/notification/ws/AddActionTest.java @@ -42,7 +42,7 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.client.notification.AddRequest; +import org.sonarqube.ws.client.notifications.AddRequest; import static java.lang.String.format; import static java.net.HttpURLConnection.HTTP_NO_CONTENT; @@ -51,10 +51,10 @@ import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.component.ComponentTesting.newView; import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION; import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE; public class AddActionTest { private static final String NOTIF_MY_NEW_ISSUES = "Dispatcher1"; @@ -82,8 +82,7 @@ public class AddActionTest { private AddAction underTest; private WsActionTester ws; - private AddRequest.Builder request = AddRequest.builder() - .setType(NOTIF_MY_NEW_ISSUES); + private AddRequest request = new AddRequest().setType(NOTIF_MY_NEW_ISSUES); @Before public void setUp() { @@ -313,13 +312,12 @@ public class AddActionTest { .setLogin(userSession.getLogin())); } - private TestResponse call(AddRequest.Builder wsRequestBuilder) { - AddRequest wsRequest = wsRequestBuilder.build(); + private TestResponse call(AddRequest add) { TestRequest request = ws.newRequest(); - request.setParam(PARAM_TYPE, wsRequest.getType()); - setNullable(wsRequest.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel)); - setNullable(wsRequest.getProject(), project -> request.setParam(PARAM_PROJECT, project)); - setNullable(wsRequest.getLogin(), login -> request.setParam(PARAM_LOGIN, login)); + request.setParam(PARAM_TYPE, add.getType()); + setNullable(add.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel)); + setNullable(add.getProject(), project -> request.setParam(PARAM_PROJECT, project)); + setNullable(add.getLogin(), login -> request.setParam(PARAM_LOGIN, login)); return request.execute(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java index f8a25ade4ee..2b975075980 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/notification/ws/RemoveActionTest.java @@ -42,7 +42,7 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; -import org.sonarqube.ws.client.notification.RemoveRequest; +import org.sonarqube.ws.client.notifications.RemoveRequest; import static java.lang.String.format; import static java.net.HttpURLConnection.HTTP_NO_CONTENT; @@ -51,10 +51,10 @@ import static org.sonar.core.util.Protobuf.setNullable; import static org.sonar.db.component.ComponentTesting.newView; import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION; import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT; +import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE; public class RemoveActionTest { private static final String NOTIF_MY_NEW_ISSUES = "Dispatcher1"; @@ -79,7 +79,7 @@ public class RemoveActionTest { private RemoveAction underTest; private WsActionTester ws; - private RemoveRequest.Builder request = RemoveRequest.builder().setType(NOTIF_MY_NEW_ISSUES); + private RemoveRequest request = new RemoveRequest().setType(NOTIF_MY_NEW_ISSUES); private UserDto user; @@ -280,14 +280,12 @@ public class RemoveActionTest { call(request.setProject(branch.getDbKey())); } - private TestResponse call(RemoveRequest.Builder wsRequestBuilder) { - RemoveRequest wsRequest = wsRequestBuilder.build(); - + private TestResponse call(RemoveRequest remove) { TestRequest request = ws.newRequest(); - request.setParam(PARAM_TYPE, wsRequest.getType()); - setNullable(wsRequest.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel)); - setNullable(wsRequest.getProject(), project -> request.setParam(PARAM_PROJECT, project)); - setNullable(wsRequest.getLogin(), login -> request.setParam(PARAM_LOGIN, login)); + request.setParam(PARAM_TYPE, remove.getType()); + setNullable(remove.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel)); + setNullable(remove.getProject(), project -> request.setParam(PARAM_PROJECT, project)); + setNullable(remove.getLogin(), login -> request.setParam(PARAM_LOGIN, login)); return request.execute(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java index f1ab8b32bb3..90d82f85f90 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/CreateActionTest.java @@ -50,10 +50,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_NAME; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_URL; public class CreateActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java index 81bcd42594d..5c46ed5daf3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/DeleteActionTest.java @@ -41,7 +41,7 @@ import org.sonar.server.ws.WsActionTester; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_ID; public class DeleteActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java index 7e421fc2451..29cfea1e93f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/projectlink/ws/SearchActionTest.java @@ -53,8 +53,8 @@ import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY; public class SearchActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java index 01c7f67834b..995bad40b56 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/CreateConditionActionTest.java @@ -48,12 +48,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.metric.MetricTesting.newMetricDto; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.PERCENT; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING; public class CreateConditionActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/DeleteConditionActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/DeleteConditionActionTest.java index 1dd44cefb04..1e242273a33 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/DeleteConditionActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/DeleteConditionActionTest.java @@ -41,7 +41,7 @@ import static java.net.HttpURLConnection.HTTP_NO_CONTENT; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; public class DeleteConditionActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java index c457670ae72..7e0115e803d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java @@ -54,9 +54,9 @@ import static org.sonar.db.component.SnapshotTesting.newAnalysis; import static org.sonar.db.measure.MeasureTesting.newMeasureDto; import static org.sonar.db.metric.MetricTesting.newMetricDto; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ANALYSIS_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY; public class ProjectStatusActionTest { private static final String ANALYSIS_ID = "task-uuid"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java index 194ae1b1bc7..560a7de1529 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/UpdateConditionActionTest.java @@ -48,12 +48,12 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.metric.MetricTesting.newMetricDto; import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES; import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.PERCENT; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD; -import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD; +import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING; public class UpdateConditionActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java index 2fae76356d2..8227c7d119b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/GenerateActionTest.java @@ -44,8 +44,8 @@ import static org.mockito.Mockito.when; import static org.sonar.db.user.UserTesting.newUserDto; import static org.sonar.db.user.UserTokenTesting.newUserToken; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME; public class GenerateActionTest { private static final String GRACE_HOPPER = "grace.hopper"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/RevokeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/RevokeActionTest.java index 7ef7baf7921..597ef95c3d0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/RevokeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/RevokeActionTest.java @@ -37,8 +37,8 @@ import org.sonar.server.ws.WsActionTester; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.user.UserTokenTesting.newUserToken; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME; public class RevokeActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java index eb0f1539d35..f97c912811f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usertoken/ws/SearchActionTest.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.user.UserTesting.newUserDto; import static org.sonar.db.user.UserTokenTesting.newUserToken; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; +import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN; public class SearchActionTest { private static final String GRACE_HOPPER = "grace.hopper"; 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 473ec80ad45..61f41989b8f 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 @@ -21,25 +21,26 @@ package org.sonarqube.ws.client; import org.sonarqube.ws.client.ce.CeService; import org.sonarqube.ws.client.component.ComponentsService; -import org.sonarqube.ws.client.favorite.FavoritesService; +import org.sonarqube.ws.client.favorites.FavoritesService; import org.sonarqube.ws.client.issue.IssuesService; import org.sonarqube.ws.client.measure.MeasuresService; +import org.sonarqube.ws.client.notifications.NotificationsService; import org.sonarqube.ws.client.organization.OrganizationService; import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.project.ProjectsService; import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService; -import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld; +import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; import org.sonarqube.ws.client.root.RootsService; import org.sonarqube.ws.client.rule.RulesService; import org.sonarqube.ws.client.setting.SettingsService; -import org.sonarqube.ws.client.system.SystemServiceOld; +import org.sonarqube.ws.client.system.SystemService; import org.sonarqube.ws.client.user.UsersService; import org.sonarqube.ws.client.usergroup.UserGroupsService; -import org.sonarqube.ws.client.usertoken.UserTokensService; -import org.sonarqube.ws.client.webhook.WebhooksService; +import org.sonarqube.ws.client.usertokens.UserTokensService; +import org.sonarqube.ws.client.webhooks.WebhooksService; /** * This class is not public anymore since version 5.5. It is @@ -61,7 +62,7 @@ class DefaultWsClient implements WsClient { private final UserTokensService userTokensService; private final QualitygatesService qualityGatesService; private final MeasuresService measuresService; - private final SystemServiceOld systemService; + private final SystemService systemService; private final CeService ceService; private final RulesService rulesService; private final ProjectsService projectsService; @@ -70,7 +71,8 @@ class DefaultWsClient implements WsClient { private final RootsService rootsService; private final WebhooksService webhooksService; private final ProjectAnalysisService projectAnalysisService; - private final ProjectBranchesServiceOld projectBranchesService; + private final NotificationsService notificationsService; + private final ProjectBranchesService projectBranchesService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; @@ -85,7 +87,7 @@ class DefaultWsClient implements WsClient { this.userTokensService = new UserTokensService(wsConnector); this.qualityGatesService = new QualitygatesService(wsConnector); this.measuresService = new MeasuresService(wsConnector); - this.systemService = new SystemServiceOld(wsConnector); + this.systemService = new SystemService(wsConnector); this.ceService = new CeService(wsConnector); this.rulesService = new RulesService(wsConnector); this.projectsService = new ProjectsService(wsConnector); @@ -94,7 +96,8 @@ class DefaultWsClient implements WsClient { this.rootsService = new RootsService(wsConnector); this.webhooksService = new WebhooksService(wsConnector); this.projectAnalysisService = new ProjectAnalysisService(wsConnector); - this.projectBranchesService = new ProjectBranchesServiceOld(wsConnector); + this.projectBranchesService = new ProjectBranchesService(wsConnector); + this.notificationsService = new NotificationsService(wsConnector); } @Override @@ -158,7 +161,7 @@ class DefaultWsClient implements WsClient { } @Override - public SystemServiceOld system() { + public SystemService system() { return systemService; } @@ -203,7 +206,12 @@ class DefaultWsClient implements WsClient { } @Override - public ProjectBranchesServiceOld projectBranches() { + public ProjectBranchesService projectBranches() { return projectBranchesService; } + + @Override + public NotificationsService notifications() { + return notificationsService; + } } 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 71b00aa96d9..824ec008990 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 @@ -21,25 +21,26 @@ package org.sonarqube.ws.client; import org.sonarqube.ws.client.ce.CeService; import org.sonarqube.ws.client.component.ComponentsService; -import org.sonarqube.ws.client.favorite.FavoritesService; +import org.sonarqube.ws.client.favorites.FavoritesService; import org.sonarqube.ws.client.issue.IssuesService; import org.sonarqube.ws.client.measure.MeasuresService; +import org.sonarqube.ws.client.notifications.NotificationsService; import org.sonarqube.ws.client.organization.OrganizationService; import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.project.ProjectsService; import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService; -import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld; +import org.sonarqube.ws.client.projectbranches.ProjectBranchesService; import org.sonarqube.ws.client.projectlinks.ProjectLinksService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofile.QualityProfilesService; import org.sonarqube.ws.client.root.RootsService; import org.sonarqube.ws.client.rule.RulesService; import org.sonarqube.ws.client.setting.SettingsService; -import org.sonarqube.ws.client.system.SystemServiceOld; +import org.sonarqube.ws.client.system.SystemService; import org.sonarqube.ws.client.user.UsersService; import org.sonarqube.ws.client.usergroup.UserGroupsService; -import org.sonarqube.ws.client.usertoken.UserTokensService; -import org.sonarqube.ws.client.webhook.WebhooksService; +import org.sonarqube.ws.client.usertokens.UserTokensService; +import org.sonarqube.ws.client.webhooks.WebhooksService; /** * Allows to request the web services of SonarQube server. Instance is provided by @@ -68,6 +69,8 @@ public interface WsClient { IssuesService issues(); + NotificationsService notifications(); + PermissionsService permissions(); QualityProfilesService qualityProfiles(); @@ -82,7 +85,7 @@ public interface WsClient { MeasuresService measures(); - SystemServiceOld system(); + SystemService system(); CeService ce(); @@ -123,5 +126,5 @@ public interface WsClient { /** * @since 6.6> */ - ProjectBranchesServiceOld projectBranches(); + ProjectBranchesService projectBranches(); } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java deleted file mode 100644 index 9971fa2fd54..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.ce; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java deleted file mode 100644 index 15126309555..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/FavoritesService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.favorite; - -import org.sonar.api.server.ws.WebService.Param; -import org.sonarqube.ws.Favorites.SearchResponse; -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 static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_ADD; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_REMOVE; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.CONTROLLER_FAVORITES; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; - -public class FavoritesService extends BaseService { - public FavoritesService(WsConnector wsConnector) { - super(wsConnector, CONTROLLER_FAVORITES); - } - - public void add(String component) { - PostRequest post = new PostRequest(path(ACTION_ADD)).setParam(PARAM_COMPONENT, component); - - call(post); - } - - public void remove(String component) { - PostRequest post = new PostRequest(path(ACTION_REMOVE)).setParam(PARAM_COMPONENT, component); - - call(post); - } - - public SearchResponse search(SearchRequest request) { - GetRequest get = new GetRequest(path(ACTION_SEARCH)); - if (request.getPage() != null) { - get.setParam(Param.PAGE, request.getPage()); - } - if (request.getPageSize() != null) { - get.setParam(Param.PAGE_SIZE, request.getPageSize()); - } - - return call(get, SearchResponse.parser()); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/SearchRequest.java deleted file mode 100644 index e74c3421e00..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/SearchRequest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.favorite; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchRequest { - public static final int MAX_PAGE_SIZE = 500; - - private Integer page; - private Integer pageSize; - - @CheckForNull - public Integer getPage() { - return page; - } - - public SearchRequest setPage(@Nullable Integer page) { - this.page = page; - return this; - } - - @CheckForNull - public Integer getPageSize() { - return pageSize; - } - - public SearchRequest setPageSize(@Nullable Integer pageSize) { - if (pageSize != null && pageSize > MAX_PAGE_SIZE) { - throw new IllegalArgumentException("Page size must be lower than or equals to " + MAX_PAGE_SIZE); - } - this.pageSize = pageSize; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/package-info.java deleted file mode 100644 index 971ad925495..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/favorite/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.favorite; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/AddRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/AddRequest.java deleted file mode 100644 index ff509a25522..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/AddRequest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.notification; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class AddRequest { - private final String type; - private final String channel; - private final String project; - private final String login; - - private AddRequest(Builder builder) { - this.channel = builder.channel; - this.type = builder.type; - this.project = builder.project; - this.login = builder.login; - } - - public String getType() { - return type; - } - - @CheckForNull - public String getChannel() { - return channel; - } - - @CheckForNull - public String getProject() { - return project; - } - - @CheckForNull - public String getLogin() { - return login; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String type; - private String channel; - private String project; - private String login; - - private Builder() { - // enforce factory method - } - - public Builder setType(String type) { - this.type = type; - return this; - } - - public Builder setChannel(@Nullable String channel) { - this.channel = channel; - return this; - } - - public Builder setProject(@Nullable String project) { - this.project = project; - return this; - } - - public Builder setLogin(@Nullable String login) { - this.login = login; - return this; - } - - public AddRequest build() { - requireNonNull(type, "Notification is required"); - return new AddRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/RemoveRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/RemoveRequest.java deleted file mode 100644 index 91547b58805..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/RemoveRequest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.notification; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import static java.util.Objects.requireNonNull; - -public class RemoveRequest { - private final String type; - private final String channel; - private final String project; - private final String login; - - private RemoveRequest(Builder builder) { - this.channel = builder.channel; - this.type = builder.type; - this.project = builder.project; - this.login = builder.login; - } - - public String getType() { - return type; - } - - @CheckForNull - public String getChannel() { - return channel; - } - - @CheckForNull - public String getProject() { - return project; - } - - @CheckForNull - public String getLogin() { - return login; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String type; - private String channel; - private String project; - private String login; - - private Builder() { - // enforce factory method - } - - public Builder setType(String type) { - this.type = type; - return this; - } - - public Builder setChannel(@Nullable String channel) { - this.channel = channel; - return this; - } - - public Builder setProject(@Nullable String project) { - this.project = project; - return this; - } - - public Builder setLogin(@Nullable String login) { - this.login = login; - return this; - } - - public RemoveRequest build() { - requireNonNull(type, "Notification is required"); - return new RemoveRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/package-info.java deleted file mode 100644 index 2aac87609ea..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/notification/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.notification; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java deleted file mode 100644 index cee7e910636..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceOld.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectbranches; - -import org.sonarqube.ws.ProjectBranches.ListWsResponse; -import org.sonarqube.ws.ProjectBranches.ShowWsResponse; -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 static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_SHOW; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; - -public class ProjectBranchesServiceOld extends BaseService { - - public ProjectBranchesServiceOld(WsConnector wsConnector) { - super(wsConnector, CONTROLLER); - } - - public ListWsResponse list(String project) { - GetRequest get = new GetRequest(path(ACTION_LIST)) - .setParam(PARAM_PROJECT, project); - return call(get, ListWsResponse.parser()); - } - - public ShowWsResponse show(String project, String branch) { - GetRequest get = new GetRequest(path(ACTION_SHOW)) - .setParam(PARAM_PROJECT, project) - .setParam(PARAM_BRANCH, branch); - return call(get, ShowWsResponse.parser()); - } - - public void delete(String project, String branch) { - PostRequest post = new PostRequest(path(ACTION_DELETE)) - .setParam(PARAM_PROJECT, project) - .setParam(PARAM_BRANCH, branch); - call(post); - } - - public void rename(String project, String name) { - PostRequest post = new PostRequest(path(ACTION_RENAME)) - .setParam(PARAM_PROJECT, project) - .setParam(PARAM_NAME, name); - call(post); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java deleted file mode 100644 index 148ff98162a..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectbranches/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.projectbranches; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateWsRequest.java deleted file mode 100644 index 48d405921b0..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/CreateWsRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectlinks; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class CreateWsRequest { - private String projectId; - private String projectKey; - private String name; - private String url; - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public CreateWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public CreateWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } - - public String getName() { - return name; - } - - public CreateWsRequest setName(String name) { - this.name = name; - return this; - } - - public String getUrl() { - return url; - } - - public CreateWsRequest setUrl(String url) { - this.url = url; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteWsRequest.java deleted file mode 100644 index 71a5fd46945..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/DeleteWsRequest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectlinks; - -public class DeleteWsRequest { - private Long id; - - public Long getId() { - return id; - } - - public DeleteWsRequest setId(Long id) { - this.id = id; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java deleted file mode 100644 index 6266aa38689..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/ProjectLinksService.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectlinks; - -import org.sonarqube.ws.ProjectLinks.CreateWsResponse; -import org.sonarqube.ws.ProjectLinks.SearchWsResponse; -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 static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_CREATE; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_DELETE; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL; - -public class ProjectLinksService extends BaseService { - - public ProjectLinksService(WsConnector wsConnector) { - super(wsConnector, "api/project_links"); - } - - public SearchWsResponse search(SearchWsRequest request) { - return call(new GetRequest(path(ACTION_SEARCH)) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()), - SearchWsResponse.parser()); - } - - public CreateWsResponse create(CreateWsRequest request) { - return call(new PostRequest(path(ACTION_CREATE)) - .setParam(PARAM_PROJECT_KEY, request.getProjectKey()) - .setParam(PARAM_PROJECT_ID, request.getProjectId()) - .setParam(PARAM_NAME, request.getName()) - .setParam(PARAM_URL, request.getUrl()), - CreateWsResponse.parser()); - } - - public void delete(DeleteWsRequest request) { - call(new PostRequest(path(ACTION_DELETE)) - .setParam(PARAM_ID, request.getId())); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchWsRequest.java deleted file mode 100644 index d329c763c4c..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/SearchWsRequest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectlinks; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchWsRequest { - @CheckForNull - private String projectId; - @CheckForNull - private String projectKey; - - @CheckForNull - public String getProjectId() { - return projectId; - } - - public SearchWsRequest setProjectId(@Nullable String projectId) { - this.projectId = projectId; - return this; - } - - @CheckForNull - public String getProjectKey() { - return projectKey; - } - - public SearchWsRequest setProjectKey(@Nullable String projectKey) { - this.projectKey = projectKey; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java deleted file mode 100644 index 01d51ffb385..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectlinks/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.projectlinks; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/package-info.java deleted file mode 100644 index fa8dfc430b1..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygate/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.qualitygate; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java deleted file mode 100644 index 949cec119da..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/SystemServiceOld.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.system; - -import org.sonarqube.ws.System; -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.client.WsResponse; - -public class SystemServiceOld extends BaseService { - public SystemServiceOld(WsConnector wsConnector) { - super(wsConnector, "api/system"); - } - - public System.HealthResponse health() { - return call(new GetRequest(path("health")), System.HealthResponse.parser()); - } - - public void restart() { - call(new PostRequest(path("restart"))); - } - - public System.StatusResponse status() { - return call(new GetRequest(path("status")), System.StatusResponse.parser()); - } - - public void changeLogLevel(String level) { - call(new PostRequest(path("change_log_level")).setParam("level", level)); - } - - public WsResponse info() { - return call(new GetRequest(path("info"))); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java deleted file mode 100644 index 86b11d9949b..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/system/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.system; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/GenerateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/GenerateWsRequest.java deleted file mode 100644 index 52500d196fa..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/GenerateWsRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.usertoken; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class GenerateWsRequest { - private String login; - private String name; - - @CheckForNull - public String getLogin() { - return login; - } - - public GenerateWsRequest setLogin(@Nullable String login) { - this.login = login; - return this; - } - - public String getName() { - return name; - } - - public GenerateWsRequest setName(String name) { - this.name = name; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/RevokeWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/RevokeWsRequest.java deleted file mode 100644 index 69654fcf81d..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/RevokeWsRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.usertoken; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class RevokeWsRequest { - private String login; - private String name; - - @CheckForNull - public String getLogin() { - return login; - } - - public RevokeWsRequest setLogin(@Nullable String login) { - this.login = login; - return this; - } - - public String getName() { - return name; - } - - public RevokeWsRequest setName(String name) { - this.name = name; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/SearchWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/SearchWsRequest.java deleted file mode 100644 index a5efcecc309..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/SearchWsRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.usertoken; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -public class SearchWsRequest { - private String login; - - @CheckForNull - public String getLogin() { - return login; - } - - public SearchWsRequest setLogin(@Nullable String login) { - this.login = login; - return this; - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java deleted file mode 100644 index d3cd30a8be1..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/UserTokensService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.usertoken; - -import org.sonarqube.ws.UserTokens.GenerateWsResponse; -import org.sonarqube.ws.UserTokens.SearchWsResponse; -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 static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_GENERATE; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_REVOKE; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_SEARCH; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.CONTROLLER; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN; -import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME; - -public class UserTokensService extends BaseService { - - public UserTokensService(WsConnector wsConnector) { - super(wsConnector, CONTROLLER); - } - - public GenerateWsResponse generate(GenerateWsRequest request) { - return call( - new PostRequest(path(ACTION_GENERATE)) - .setParam(PARAM_LOGIN, request.getLogin()) - .setParam(PARAM_NAME, request.getName()), - GenerateWsResponse.parser()); - } - - public SearchWsResponse search(SearchWsRequest request) { - return call( - new GetRequest(path(ACTION_SEARCH)).setParam(PARAM_LOGIN, request.getLogin()), - SearchWsResponse.parser()); - } - - public void revoke(RevokeWsRequest request) { - call( - new PostRequest(path(ACTION_REVOKE)) - .setParam(PARAM_LOGIN, request.getLogin()) - .setParam(PARAM_NAME, request.getName())); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/package-info.java deleted file mode 100644 index 445faceae60..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/usertoken/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.usertoken; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/DeliveriesRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/DeliveriesRequest.java deleted file mode 100644 index 6418fbb8919..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/DeliveriesRequest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.webhook; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.annotation.concurrent.Immutable; - -@Immutable -public class DeliveriesRequest { - - private final String componentKey; - private final String ceTaskId; - - private DeliveriesRequest(Builder builder) { - this.componentKey = builder.componentKey; - this.ceTaskId = builder.ceTaskId; - } - - @CheckForNull - public String getComponentKey() { - return componentKey; - } - - @CheckForNull - public String getCeTaskId() { - return ceTaskId; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String componentKey; - private String ceTaskId; - - /** - * @see #builder() - */ - private Builder() { - } - - public Builder setComponentKey(@Nullable String s) { - this.componentKey = s; - return this; - } - - public Builder setCeTaskId(@Nullable String s) { - this.ceTaskId = s; - return this; - } - - public DeliveriesRequest build() { - return new DeliveriesRequest(this); - } - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/WebhooksService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/WebhooksService.java deleted file mode 100644 index ec5686691be..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/WebhooksService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.webhook; - -import org.sonarqube.ws.Webhooks; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.WsConnector; - -/** - * @since 6.2 - */ -public class WebhooksService extends BaseService { - - public WebhooksService(WsConnector wsConnector) { - super(wsConnector, "api/webhooks"); - } - - public Webhooks.DeliveryWsResponse delivery(String deliveryId) { - GetRequest httpRequest = new GetRequest(path("delivery")) - .setParam("deliveryId", deliveryId); - return call(httpRequest, Webhooks.DeliveryWsResponse.parser()); - } - - /** - * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx. - */ - public Webhooks.DeliveriesWsResponse deliveries(DeliveriesRequest request) { - GetRequest httpRequest = new GetRequest(path("deliveries")) - .setParam("componentKey", request.getComponentKey()) - .setParam("ceTaskId", request.getCeTaskId()); - return call(httpRequest, Webhooks.DeliveriesWsResponse.parser()); - } -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/package-info.java deleted file mode 100644 index 66527650e1a..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/webhook/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.sonarqube.ws.client.webhook; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java deleted file mode 100644 index 940a558fb11..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/FavoritesServiceTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.favorite; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.server.ws.WebService.Param; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT; - -public class FavoritesServiceTest { - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new FavoritesService(mock(WsConnector.class))); - - private FavoritesService underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void add() { - underTest.add("my_project"); - - serviceTester.assertThat(serviceTester.getPostRequest()) - .hasPath("add") - .hasParam(PARAM_COMPONENT, "my_project") - .andNoOtherParam(); - } - - @Test - public void remove() { - underTest.remove("my_project"); - - serviceTester.assertThat(serviceTester.getPostRequest()) - .hasPath("remove") - .hasParam(PARAM_COMPONENT, "my_project") - .andNoOtherParam(); - } - - @Test - public void search() { - underTest.search(new SearchRequest().setPage(42).setPageSize(255)); - - serviceTester.assertThat(serviceTester.getGetRequest()) - .hasPath("search") - .hasParam(Param.PAGE, 42) - .hasParam(Param.PAGE_SIZE, 255) - .andNoOtherParam(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/SearchRequestTest.java deleted file mode 100644 index b2c4bf72522..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/favorite/SearchRequestTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.favorite; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -public class SearchRequestTest { - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private SearchRequest underTest = new SearchRequest(); - - @Test - public void fail_if_page_size_greater_than_500() { - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage("Page size must be lower than or equals to 500"); - - underTest.setPageSize(501); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java deleted file mode 100644 index a20137651fe..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectbranches/ProjectBranchesServiceTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectbranches; - -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.ProjectBranches.ListWsResponse; -import org.sonarqube.ws.ProjectBranches.ShowWsResponse; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT; - -public class ProjectBranchesServiceTest { - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new ProjectBranchesServiceOld(mock(WsConnector.class))); - - private ProjectBranchesServiceOld underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void list() { - underTest.list("projectKey"); - - assertThat(serviceTester.getGetParser()).isSameAs(ListWsResponse.parser()); - - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("list") - .hasParam(PARAM_PROJECT, "projectKey") - .andNoOtherParam(); - } - - @Test - public void show() { - underTest.show("projectKey", "my_branch"); - - assertThat(serviceTester.getGetParser()).isSameAs(ShowWsResponse.parser()); - - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("show") - .hasParam(PARAM_PROJECT, "projectKey") - .hasParam(PARAM_BRANCH, "my_branch") - .andNoOtherParam(); - } - - @Test - public void delete() { - underTest.delete("projectKey", "my_branch"); - - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("delete") - .hasParam(PARAM_PROJECT, "projectKey") - .hasParam(PARAM_BRANCH, "my_branch") - .andNoOtherParam(); - } - - @Test - public void rename() { - underTest.rename("projectKey", "my_branch"); - - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("rename") - .hasParam(PARAM_PROJECT, "projectKey") - .hasParam(PARAM_NAME, "my_branch") - .andNoOtherParam(); - } - -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java deleted file mode 100644 index 3ebf9c68a23..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectlinks/ProjectLinksServiceTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.projectlinks; - -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.ProjectLinks.CreateWsResponse; -import org.sonarqube.ws.ProjectLinks.SearchWsResponse; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY; -import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL; - -public class ProjectLinksServiceTest { - private static final String PROJECT_ID_VALUE = "project_id_value"; - private static final String PROJECT_KEY_VALUE = "project_key_value"; - private static final String NAME_VALUE = "name_value"; - private static final String URL_VALUE = "url_value"; - private static final long ID_VALUE = 175; - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new ProjectLinksService(mock(WsConnector.class))); - - private ProjectLinksService underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void search_does_GET_request() { - underTest.search(new SearchWsRequest() - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE)); - - assertThat(serviceTester.getGetParser()).isSameAs(SearchWsResponse.parser()); - - GetRequest getRequest = serviceTester.getGetRequest(); - - serviceTester.assertThat(getRequest) - .hasPath("search") - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .andNoOtherParam(); - } - - @Test - public void create_does_POST_request() { - underTest.create(new CreateWsRequest() - .setProjectId(PROJECT_ID_VALUE) - .setProjectKey(PROJECT_KEY_VALUE) - .setName(NAME_VALUE) - .setUrl(URL_VALUE)); - - assertThat(serviceTester.getPostParser()).isSameAs(CreateWsResponse.parser()); - - PostRequest postRequest = serviceTester.getPostRequest(); - - serviceTester.assertThat(postRequest) - .hasPath("create") - .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE) - .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE) - .hasParam(PARAM_NAME, NAME_VALUE) - .hasParam(PARAM_URL, URL_VALUE) - .andNoOtherParam(); - } - - @Test - public void delete_does_POST_request() { - underTest.delete(new DeleteWsRequest().setId(ID_VALUE)); - - assertThat(serviceTester.getPostParser()).isNull(); - - PostRequest postRequest = serviceTester.getPostRequest(); - - serviceTester.assertThat(postRequest) - .hasPath("delete") - .hasParam(PARAM_ID, String.valueOf(ID_VALUE)) - .andNoOtherParam(); - } -} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java deleted file mode 100644 index 766baa37520..00000000000 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/system/SystemServiceTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.system; - -import org.junit.Rule; -import org.junit.Test; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.ServiceTester; -import org.sonarqube.ws.client.WsConnector; - -import static org.mockito.Mockito.mock; - -public class SystemServiceTest { - - @Rule - public ServiceTester serviceTester = new ServiceTester<>(new SystemServiceOld(mock(WsConnector.class))); - - private SystemServiceOld underTest = serviceTester.getInstanceUnderTest(); - - @Test - public void test_health() throws Exception { - underTest.health(); - - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("health") - .andNoOtherParam(); - } - - @Test - public void test_status() throws Exception { - underTest.status(); - - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("status") - .andNoOtherParam(); - } - - @Test - public void test_restart() throws Exception { - underTest.restart(); - - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("restart") - .andNoOtherParam(); - } - - @Test - public void test_changeLogLevel() throws Exception { - underTest.changeLogLevel("TRACE"); - - PostRequest postRequest = serviceTester.getPostRequest(); - serviceTester.assertThat(postRequest) - .hasPath("change_log_level") - .hasParam("level", "TRACE") - .andNoOtherParam(); - } - - @Test - public void test_info() throws Exception { - underTest.info(); - - GetRequest getRequest = serviceTester.getGetRequest(); - serviceTester.assertThat(getRequest) - .hasPath("info") - .andNoOtherParam(); - } -} diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java index 1bb37ef7303..14b60781d47 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/FavoriteTest.java @@ -31,7 +31,7 @@ import org.sonarqube.ws.Favorites; import org.sonarqube.ws.Favorites.Favorite; import org.sonarqube.ws.Permissions; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.favorite.SearchRequest; +import org.sonarqube.ws.client.favorites.SearchRequest; import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateWsRequest; import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest; diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java index 574dc29c367..2f2e20bc59a 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/LinksTest.java @@ -23,15 +23,15 @@ import com.google.common.collect.ImmutableMap; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.MavenBuild; import com.sonar.orchestrator.build.SonarScanner; -import org.sonarqube.tests.Category3Suite; import java.util.List; import java.util.Optional; import org.junit.After; import org.junit.ClassRule; import org.junit.Test; +import org.sonarqube.tests.Category3Suite; import org.sonarqube.ws.ProjectLinks; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.projectlinks.SearchWsRequest; +import org.sonarqube.ws.client.projectlinks.SearchRequest; import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -75,7 +75,7 @@ public class LinksTest { private void verifyLinks() { WsClient wsClient = ItUtils.newWsClient(orchestrator); - List links = wsClient.projectLinks().search(new SearchWsRequest().setProjectKey(PROJECT_KEY)).getLinksList(); + List links = wsClient.projectLinks().search(new SearchRequest().setProjectKey(PROJECT_KEY)).getLinksList(); verifyLink(links, "homepage", "http://www.simplesample.org_OVERRIDDEN"); verifyLink(links, "ci", "http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE"); verifyLink(links, "issue", "http://jira.codehaus.org/browse/SIMPLESAMPLE"); diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java index d0f4eefd4a4..b7d8921246d 100644 --- a/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java +++ b/tests/src/test/java/org/sonarqube/tests/analysis/PermissionTest.java @@ -32,9 +32,9 @@ import org.junit.Test; import org.sonarqube.ws.UserTokens; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.permission.AddUserWsRequest; -import org.sonarqube.ws.client.usertoken.GenerateWsRequest; -import org.sonarqube.ws.client.usertoken.RevokeWsRequest; -import org.sonarqube.ws.client.usertoken.UserTokensService; +import org.sonarqube.ws.client.usertokens.GenerateRequest; +import org.sonarqube.ws.client.usertokens.RevokeRequest; +import org.sonarqube.ws.client.usertokens.UserTokensService; import util.user.UserRule; import static org.assertj.core.api.Assertions.assertThat; @@ -79,7 +79,7 @@ public class PermissionTest { createUserWithProvisioningAndScanPermissions(); String tokenName = "For test"; - UserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest() + UserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateRequest() .setLogin(A_LOGIN) .setName(tokenName)); SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); @@ -90,7 +90,7 @@ public class PermissionTest { BuildResult buildResult = orchestrator.executeBuild(sampleProject); assertThat(buildResult.isSuccess()).isTrue(); - userTokensWsClient.revoke(new RevokeWsRequest().setLogin(A_LOGIN).setName(tokenName)); + userTokensWsClient.revoke(new RevokeRequest().setLogin(A_LOGIN).setName(tokenName)); } @Test diff --git a/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java b/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java index 3d0b3c8ab02..a4a0ad170a8 100644 --- a/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java +++ b/tests/src/test/java/org/sonarqube/tests/component/BranchTest.java @@ -30,6 +30,7 @@ import org.sonarqube.ws.Common; import org.sonarqube.ws.ProjectBranches; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; +import org.sonarqube.ws.client.projectbranches.ListRequest; import util.ItUtils; import static org.assertj.core.api.Java6Assertions.assertThat; @@ -47,7 +48,7 @@ public class BranchTest { public void list_branches_contains_main_branch() { runProjectAnalysis(orchestrator, "shared/xoo-sample"); - ProjectBranches.ListWsResponse result = tester.wsClient().projectBranches().list("sample"); + ProjectBranches.ListWsResponse result = tester.wsClient().projectBranches().list(new ListRequest().setProject("sample")); assertThat(result.getBranchesList()) .extracting(ProjectBranches.Branch::getName, ProjectBranches.Branch::getType, ProjectBranches.Branch::getIsMain) diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java index b980b287381..17e15dadd13 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectLinksTest.java @@ -33,8 +33,8 @@ import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.ProjectLinkItem; import org.sonarqube.qa.util.pageobjects.ProjectLinksPage; import org.sonarqube.ws.ProjectLinks.CreateWsResponse; -import org.sonarqube.ws.client.projectlinks.CreateWsRequest; -import org.sonarqube.ws.client.projectlinks.DeleteWsRequest; +import org.sonarqube.ws.client.projectlinks.CreateRequest; +import org.sonarqube.ws.client.projectlinks.DeleteRequest; import static com.codeborne.selenide.Condition.text; import static com.codeborne.selenide.Selenide.$; @@ -131,7 +131,7 @@ public class ProjectLinksTest { } private CreateWsResponse createCustomLink() { - return tester.wsClient().projectLinks().create(new CreateWsRequest() + return tester.wsClient().projectLinks().create(new CreateRequest() .setProjectKey("sample") .setName("Custom") .setUrl("http://example.org/custom")); @@ -139,7 +139,7 @@ public class ProjectLinksTest { private void deleteLink(long id) { try { - tester.wsClient().projectLinks().delete(new DeleteWsRequest().setId(id)); + tester.wsClient().projectLinks().delete(new DeleteRequest().setId("" + id)); } catch (Exception e) { // fail silently } diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java index a18787080f5..0bf926b80b3 100644 --- a/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectsPageTest.java @@ -32,6 +32,8 @@ import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage; import org.sonarqube.ws.Users; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; +import org.sonarqube.ws.client.favorites.AddRequest; +import org.sonarqube.ws.client.favorites.RemoveRequest; import static com.codeborne.selenide.Selenide.clearBrowserLocalStorage; import static com.codeborne.selenide.WebDriverRunner.url; @@ -110,12 +112,12 @@ public class ProjectsPageTest { // favorite one project WsClient administratorWsClient = tester.as(administrator.getLogin()).wsClient(); - administratorWsClient.favorites().add(PROJECT_KEY); + administratorWsClient.favorites().add(new AddRequest().setComponent(PROJECT_KEY)); page = nav.openProjects(); page.shouldHaveTotal(1).shouldDisplayFavoriteProjects(); // un-favorite this project - administratorWsClient.favorites().remove(PROJECT_KEY); + administratorWsClient.favorites().remove(new RemoveRequest().setComponent(PROJECT_KEY)); page = nav.openProjects(); page.shouldHaveTotal(2).shouldDisplayAllProjects(); diff --git a/tests/src/test/java/org/sonarqube/tests/user/FavoritesWsTest.java b/tests/src/test/java/org/sonarqube/tests/user/FavoritesWsTest.java index fbcd3181ad3..8baa938ef66 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/FavoritesWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/FavoritesWsTest.java @@ -21,14 +21,16 @@ package org.sonarqube.tests.user; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.SonarScanner; -import org.sonarqube.tests.Category4Suite; import java.util.List; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; +import org.sonarqube.tests.Category4Suite; import org.sonarqube.ws.Favorites.Favorite; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.favorite.SearchRequest; +import org.sonarqube.ws.client.favorites.AddRequest; +import org.sonarqube.ws.client.favorites.RemoveRequest; +import org.sonarqube.ws.client.favorites.SearchRequest; import static org.assertj.core.api.Assertions.assertThat; import static util.ItUtils.newAdminWsClient; @@ -56,15 +58,15 @@ public class FavoritesWsTest { assertThat(favorites).isEmpty(); // POST (create favorites) - adminClient.favorites().add("sample"); - adminClient.favorites().add("sample:src/main/xoo/sample/Sample.xoo"); + adminClient.favorites().add(new AddRequest().setComponent("sample")); + adminClient.favorites().add(new AddRequest().setComponent("sample:src/main/xoo/sample/Sample.xoo")); // GET (created favorites) favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList(); assertThat(favorites.stream().map(Favorite::getKey)).containsOnly("sample", "sample:src/main/xoo/sample/Sample.xoo"); // DELETE (a favorite) - adminClient.favorites().remove("sample"); + adminClient.favorites().remove(new RemoveRequest().setComponent("sample")); favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList(); assertThat(favorites.stream().map(Favorite::getKey)).containsOnly("sample:src/main/xoo/sample/Sample.xoo"); } diff --git a/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java index 14b8237feab..1955c1c2f62 100644 --- a/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java @@ -40,10 +40,10 @@ import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.WsClientFactories; import org.sonarqube.ws.client.WsResponse; import org.sonarqube.ws.client.user.CreateRequest; -import org.sonarqube.ws.client.usertoken.GenerateWsRequest; -import org.sonarqube.ws.client.usertoken.RevokeWsRequest; -import org.sonarqube.ws.client.usertoken.SearchWsRequest; -import org.sonarqube.ws.client.usertoken.UserTokensService; +import org.sonarqube.ws.client.usertokens.GenerateRequest; +import org.sonarqube.ws.client.usertokens.RevokeRequest; +import org.sonarqube.ws.client.usertokens.SearchRequest; +import org.sonarqube.ws.client.usertokens.UserTokensService; import util.selenium.Selenese; import static java.lang.String.format; @@ -106,7 +106,7 @@ public class LocalAuthenticationTest { User user = tester.users().generate(); String tokenName = "Validate token based authentication"; UserTokensService tokensService = tester.wsClient().userTokens(); - UserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateWsRequest() + UserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateRequest() .setLogin(user.getLogin()) .setName(tokenName)); WsClient wsClient = WsClientFactories.getDefault().newClient(HttpConnector.newBuilder() @@ -117,10 +117,10 @@ public class LocalAuthenticationTest { assertThat(response.content()).isEqualTo("{\"valid\":true}"); - UserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin())); + UserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchRequest().setLogin(user.getLogin())); assertThat(searchResponse.getUserTokensCount()).isEqualTo(1); - tokensService.revoke(new RevokeWsRequest().setLogin(user.getLogin()).setName(tokenName)); - searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin())); + tokensService.revoke(new RevokeRequest().setLogin(user.getLogin()).setName(tokenName)); + searchResponse = tokensService.search(new SearchRequest().setLogin(user.getLogin())); assertThat(searchResponse.getUserTokensCount()).isEqualTo(0); } diff --git a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java index 003c3eba941..5aba7eeb6c4 100644 --- a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java +++ b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java @@ -37,7 +37,8 @@ import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.project.DeleteRequest; import org.sonarqube.ws.client.setting.ResetRequest; import org.sonarqube.ws.client.setting.SetRequest; -import org.sonarqube.ws.client.webhook.DeliveriesRequest; +import org.sonarqube.ws.client.webhooks.DeliveriesRequest; +import org.sonarqube.ws.client.webhooks.DeliveryRequest; import util.ItUtils; import static java.util.Objects.requireNonNull; @@ -220,7 +221,7 @@ public class WebhooksTest { } private List getPersistedDeliveries() { - DeliveriesRequest deliveriesReq = DeliveriesRequest.builder().setComponentKey(PROJECT_KEY).build(); + DeliveriesRequest deliveriesReq = new DeliveriesRequest().setComponentKey(PROJECT_KEY); return adminWs.webhooks().deliveries(deliveriesReq).getDeliveriesList(); } @@ -230,7 +231,7 @@ public class WebhooksTest { } private Webhooks.Delivery getDetailOfPersistedDelivery(Webhooks.Delivery delivery) { - Webhooks.Delivery detail = adminWs.webhooks().delivery(delivery.getId()).getDelivery(); + Webhooks.Delivery detail = adminWs.webhooks().delivery(new DeliveryRequest().setDeliveryId(delivery.getId())).getDelivery(); return requireNonNull(detail); } -- 2.39.5