From b1d577cbbe3dd9c622c6a8ef3a3f732c2b45e05c Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 11 Feb 2020 15:00:00 +0100 Subject: [PATCH] SONAR-13001 Add ITs --- .../sonarqube/ws/client/DefaultWsClient.java | 14 +- .../org/sonarqube/ws/client/WsClient.java | 6 +- .../almintegration/AlmIntegrationService.java | 64 ---------- .../AlmIntegrationsService.java | 120 ++++++++++++++++++ .../CheckPatRequest.java | 17 ++- .../ImportBitbucketserverProjectRequest.java | 72 +++++++++++ .../ListBibucketserverProjectsRequest.java | 46 +++++++ .../SearchBibucketserverReposRequest.java | 70 ++++++++++ .../SetPatRequest.java | 25 ++-- .../client/almintegrations/package-info.java | 26 ++++ 10 files changed, 370 insertions(+), 90 deletions(-) delete mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java rename sonar-ws/src/main/java/org/sonarqube/ws/client/{almintegration => almintegrations}/CheckPatRequest.java (82%) create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketserverProjectRequest.java create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListBibucketserverProjectsRequest.java create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SearchBibucketserverReposRequest.java rename sonar-ws/src/main/java/org/sonarqube/ws/client/{almintegration => almintegrations}/SetPatRequest.java (82%) create mode 100644 sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/package-info.java 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 68fee7f1f62..e79d59e8886 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 @@ -20,7 +20,7 @@ package org.sonarqube.ws.client; import javax.annotation.Generated; -import org.sonarqube.ws.client.almintegration.AlmIntegrationService; +import org.sonarqube.ws.client.almintegrations.AlmIntegrationsService; import org.sonarqube.ws.client.almsettings.AlmSettingsService; import org.sonarqube.ws.client.analysisreports.AnalysisReportsService; import org.sonarqube.ws.client.applications.ApplicationsService; @@ -87,6 +87,7 @@ class DefaultWsClient implements WsClient { private final WsConnector wsConnector; + private final AlmIntegrationsService almIntegrationsService; private final AlmSettingsService almSettingsService; private final AnalysisReportsService analysisReportsService; private final ApplicationsService applicationsService; @@ -141,11 +142,11 @@ class DefaultWsClient implements WsClient { private final WebservicesService webservicesService; private final BatchService batchService; private final SecurityReportsService securityReportsService; - private final AlmIntegrationService almIntegrationService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; + this.almIntegrationsService = new AlmIntegrationsService(wsConnector); this.almSettingsService = new AlmSettingsService(wsConnector); this.analysisReportsService = new AnalysisReportsService(wsConnector); this.applicationsService = new ApplicationsService(wsConnector); @@ -200,7 +201,6 @@ class DefaultWsClient implements WsClient { this.webservicesService = new WebservicesService(wsConnector); this.batchService = new BatchService(wsConnector); this.securityReportsService = new SecurityReportsService(wsConnector); - this.almIntegrationService = new AlmIntegrationService(wsConnector); } @Override @@ -210,13 +210,13 @@ class DefaultWsClient implements WsClient { } @Override - public AlmSettingsService almSettings() { - return almSettingsService; + public AlmIntegrationsService almIntegrations() { + return almIntegrationsService; } @Override - public AlmIntegrationService almIntegrations() { - return almIntegrationService; + public AlmSettingsService almSettings() { + return almSettingsService; } @Override 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 56873593d03..3f7243d0520 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 @@ -20,7 +20,7 @@ package org.sonarqube.ws.client; import javax.annotation.Generated; -import org.sonarqube.ws.client.almintegration.AlmIntegrationService; +import org.sonarqube.ws.client.almintegrations.AlmIntegrationsService; import org.sonarqube.ws.client.almsettings.AlmSettingsService; import org.sonarqube.ws.client.analysisreports.AnalysisReportsService; import org.sonarqube.ws.client.applications.ApplicationsService; @@ -99,9 +99,9 @@ public interface WsClient { WsConnector wsConnector(); - AlmSettingsService almSettings(); + AlmIntegrationsService almIntegrations(); - AlmIntegrationService almIntegrations(); + AlmSettingsService almSettings(); AnalysisReportsService analysisReports(); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java deleted file mode 100644 index e68e67138ac..00000000000 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/AlmIntegrationService.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2020 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.almintegration; - -import javax.annotation.Generated; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.client.BaseService; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; -import org.sonarqube.ws.client.WsConnector; - -/** - * @see Further information about this web service online - */ -@Generated("sonar-ws-generator") -public class AlmIntegrationService extends BaseService { - - public AlmIntegrationService(WsConnector wsConnector) { - super(wsConnector, "api/alm_integrations"); - } - - /** - * This is a POST request. - * @see Further information about this action online (including a response example) - * @since 8.1 - */ - public void setPat(SetPatRequest request) { - call( - new PostRequest(path("set_pat")) - .setParam("almSetting", request.getAlmSetting()) - .setParam("pat", request.getPat()) - .setMediaType(MediaTypes.JSON)).content(); - } - - /** - * This is a GET request. - * @see Further information about this action online (including a response example) - * @since 8.1 - */ - public void checkPat(CheckPatRequest request) { - call( - new GetRequest(path("check_pat")) - .setParam("almSetting", request.getAlmSetting()) - .setMediaType(MediaTypes.JSON)).content(); - } - -} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java new file mode 100644 index 00000000000..e9941d19ce8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java @@ -0,0 +1,120 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegrations; + +import javax.annotation.Generated; +import org.sonarqube.ws.AlmIntegrations; +import org.sonarqube.ws.MediaTypes; +import org.sonarqube.ws.Projects; +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; + +/** + * @see Further information about this web service online + */ +@Generated("sonar-ws-generator") +public class AlmIntegrationsService extends BaseService { + + public AlmIntegrationsService(WsConnector wsConnector) { + super(wsConnector, "api/alm_integrations"); + } + + /** + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ + public void checkPat(CheckPatRequest request) { + call( + new GetRequest(path("check_pat")) + .setParam("almSetting", request.getAlmSetting()) + .setMediaType(MediaTypes.JSON) + ).content(); + } + + /** + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ + public Projects.CreateWsResponse importBitbucketserverProject(ImportBitbucketserverProjectRequest request) { + return call( + new PostRequest(path("import_bitbucketserver_project")) + .setParam("almSetting", request.getAlmSetting()) + .setParam("projectKey", request.getProjectKey()) + .setParam("repositorySlug", request.getRepositorySlug()) + .setMediaType(MediaTypes.JSON), + Projects.CreateWsResponse.parser()); + } + + /** + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ + public AlmIntegrations.ListBitbucketserverProjectsWsResponse listBibucketserverProjects(ListBibucketserverProjectsRequest request) { + return call( + new GetRequest(path("list_bibucketserver_projects")) + .setParam("almSetting", request.getAlmSetting()) + .setMediaType(MediaTypes.JSON), + AlmIntegrations.ListBitbucketserverProjectsWsResponse.parser()); + } + + /** + * + * This is part of the internal API. + * This is a GET request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ + public AlmIntegrations.SearchBitbucketserverReposWsResponse searchBibucketserverRepos(SearchBibucketserverReposRequest request) { + return call( + new GetRequest(path("search_bibucketserver_repos")) + .setParam("almSetting", request.getAlmSetting()) + .setParam("projectName", request.getProjectName()) + .setParam("repositoryName", request.getRepositoryName()) + .setMediaType(MediaTypes.JSON), + AlmIntegrations.SearchBitbucketserverReposWsResponse.parser()); + } + + /** + * + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ + public void setPat(SetPatRequest request) { + call( + new PostRequest(path("set_pat")) + .setParam("almSetting", request.getAlmSetting()) + .setParam("pat", request.getPat()) + .setMediaType(MediaTypes.JSON) + ).content(); + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/CheckPatRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/CheckPatRequest.java similarity index 82% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/CheckPatRequest.java rename to sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/CheckPatRequest.java index 38a007c9301..0699c499349 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/CheckPatRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/CheckPatRequest.java @@ -17,27 +17,30 @@ * 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.almintegration; +package org.sonarqube.ws.client.almintegrations; import javax.annotation.Generated; /** + * This is part of the internal API. * This is a POST request. - * @see Further information about this action online (including a response example) - * @since 8.1 + * @see Further information about this action online (including a response example) + * @since 8.2 */ @Generated("sonar-ws-generator") public class CheckPatRequest { private String almSetting; - public String getAlmSetting() { - return almSetting; - } - + /** + * This is a mandatory parameter. + */ public CheckPatRequest setAlmSetting(String almSetting) { this.almSetting = almSetting; return this; } + public String getAlmSetting() { + return almSetting; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketserverProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketserverProjectRequest.java new file mode 100644 index 00000000000..6cdd7d11422 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketserverProjectRequest.java @@ -0,0 +1,72 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegrations; + +import javax.annotation.Generated; + +/** + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ +@Generated("sonar-ws-generator") +public class ImportBitbucketserverProjectRequest { + + private String almSetting; + private String projectKey; + private String repositorySlug; + + /** + * This is a mandatory parameter. + */ + public ImportBitbucketserverProjectRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + + public String getAlmSetting() { + return almSetting; + } + + /** + * This is a mandatory parameter. + */ + public ImportBitbucketserverProjectRequest setProjectKey(String projectKey) { + this.projectKey = projectKey; + return this; + } + + public String getProjectKey() { + return projectKey; + } + + /** + * This is a mandatory parameter. + */ + public ImportBitbucketserverProjectRequest setRepositorySlug(String repositorySlug) { + this.repositorySlug = repositorySlug; + return this; + } + + public String getRepositorySlug() { + return repositorySlug; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListBibucketserverProjectsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListBibucketserverProjectsRequest.java new file mode 100644 index 00000000000..9d6abffc6f8 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ListBibucketserverProjectsRequest.java @@ -0,0 +1,46 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegrations; + +import javax.annotation.Generated; + +/** + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ +@Generated("sonar-ws-generator") +public class ListBibucketserverProjectsRequest { + + private String almSetting; + + /** + * This is a mandatory parameter. + */ + public ListBibucketserverProjectsRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + + public String getAlmSetting() { + return almSetting; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SearchBibucketserverReposRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SearchBibucketserverReposRequest.java new file mode 100644 index 00000000000..f859e641b80 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SearchBibucketserverReposRequest.java @@ -0,0 +1,70 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 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.almintegrations; + +import javax.annotation.Generated; + +/** + * This is part of the internal API. + * This is a POST request. + * @see Further information about this action online (including a response example) + * @since 8.2 + */ +@Generated("sonar-ws-generator") +public class SearchBibucketserverReposRequest { + + private String almSetting; + private String projectName; + private String repositoryName; + + /** + * This is a mandatory parameter. + */ + public SearchBibucketserverReposRequest setAlmSetting(String almSetting) { + this.almSetting = almSetting; + return this; + } + + public String getAlmSetting() { + return almSetting; + } + + /** + */ + public SearchBibucketserverReposRequest setProjectName(String projectName) { + this.projectName = projectName; + return this; + } + + public String getProjectName() { + return projectName; + } + + /** + */ + public SearchBibucketserverReposRequest setRepositoryName(String repositoryName) { + this.repositoryName = repositoryName; + return this; + } + + public String getRepositoryName() { + return repositoryName; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/SetPatRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SetPatRequest.java similarity index 82% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/SetPatRequest.java rename to sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SetPatRequest.java index 24c622d45f3..25b88554fee 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegration/SetPatRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SetPatRequest.java @@ -17,14 +17,15 @@ * 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.almintegration; +package org.sonarqube.ws.client.almintegrations; import javax.annotation.Generated; /** + * This is part of the internal API. * This is a POST request. - * @see Further information about this action online (including a response example) - * @since 8.1 + * @see Further information about this action online (including a response example) + * @since 8.2 */ @Generated("sonar-ws-generator") public class SetPatRequest { @@ -32,21 +33,27 @@ public class SetPatRequest { private String almSetting; private String pat; - public String getAlmSetting() { - return almSetting; - } - + /** + * This is a mandatory parameter. + */ public SetPatRequest setAlmSetting(String almSetting) { this.almSetting = almSetting; return this; } - public String getPat() { - return pat; + public String getAlmSetting() { + return almSetting; } + /** + * This is a mandatory parameter. + */ public SetPatRequest setPat(String pat) { this.pat = pat; return this; } + + public String getPat() { + return pat; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/package-info.java new file mode 100644 index 00000000000..eff691dfe61 --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/package-info.java @@ -0,0 +1,26 @@ +/* + * SonarQube + * Copyright (C) 2009-2020 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +@Generated("sonar-ws-generator") +package org.sonarqube.ws.client.almintegrations; + +import javax.annotation.Generated; +import javax.annotation.ParametersAreNonnullByDefault; + -- 2.39.5