diff options
author | Lukasz Jarocki <lukasz.jarocki@sonarsource.com> | 2022-02-16 08:43:46 -0300 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-02-18 15:48:04 +0000 |
commit | d44482b279f26b210c140b0c48e35734d3dd008b (patch) | |
tree | 63fe68eecbc59773df7a2e5c6874d1e67fdc0360 /sonar-ws | |
parent | 3934bb53c8767834d274863e1f3a19fe6a60a50e (diff) | |
download | sonarqube-d44482b279f26b210c140b0c48e35734d3dd008b.tar.gz sonarqube-d44482b279f26b210c140b0c48e35734d3dd008b.zip |
SONAR-16029 integration test for push endpoint
Diffstat (limited to 'sonar-ws')
3 files changed, 50 insertions, 0 deletions
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 9a3432d45c5..39c97e4b4ba 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 @@ -55,6 +55,7 @@ import org.sonarqube.ws.client.projectpullrequests.ProjectPullRequestsService; import org.sonarqube.ws.client.projects.ProjectsService; import org.sonarqube.ws.client.projecttags.ProjectTagsService; import org.sonarqube.ws.client.properties.PropertiesService; +import org.sonarqube.ws.client.push.SonarLintServerPushService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService; import org.sonarqube.ws.client.roots.RootsService; @@ -140,6 +141,7 @@ class DefaultWsClient implements WsClient { private final WebservicesService webservicesService; private final BatchService batchService; private final SecurityReportsService securityReportsService; + private final SonarLintServerPushService sonarLintPushService; DefaultWsClient(WsConnector wsConnector) { this.wsConnector = wsConnector; @@ -198,6 +200,7 @@ class DefaultWsClient implements WsClient { this.webservicesService = new WebservicesService(wsConnector); this.batchService = new BatchService(wsConnector); this.securityReportsService = new SecurityReportsService(wsConnector); + this.sonarLintPushService = new SonarLintServerPushService(wsConnector); } @Override @@ -307,6 +310,11 @@ class DefaultWsClient implements WsClient { } @Override + public SonarLintServerPushService sonarLintPush() { + return sonarLintPushService; + } + + @Override public NavigationService navigation() { return navigationService; } 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 e18bd387c7a..23f90cfd7ad 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 @@ -55,6 +55,7 @@ import org.sonarqube.ws.client.projectpullrequests.ProjectPullRequestsService; import org.sonarqube.ws.client.projects.ProjectsService; import org.sonarqube.ws.client.projecttags.ProjectTagsService; import org.sonarqube.ws.client.properties.PropertiesService; +import org.sonarqube.ws.client.push.SonarLintServerPushService; import org.sonarqube.ws.client.qualitygates.QualitygatesService; import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService; import org.sonarqube.ws.client.roots.RootsService; @@ -205,4 +206,6 @@ public interface WsClient { SecurityReportsService securityReports(); MonitoringService monitoring(); + + SonarLintServerPushService sonarLintPush(); } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/push/SonarLintServerPushService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/push/SonarLintServerPushService.java new file mode 100644 index 00000000000..6e4842d2a6b --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/push/SonarLintServerPushService.java @@ -0,0 +1,39 @@ +/* + * SonarQube + * Copyright (C) 2009-2022 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.push; + +import org.sonarqube.ws.client.BaseService; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.client.WsResponse; + +public class SonarLintServerPushService extends BaseService { + public SonarLintServerPushService(WsConnector wsConnector) { + super(wsConnector, "api/push"); + } + + public WsResponse connect(String projectKeys, String languages) { + return call( + new GetRequest(path("sonarlint_events")) + .setParam("projectKeys", projectKeys) + .setParam("languages", languages) + .setHeader("accept", "text/event-stream")); + } +} |