aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-09-15 16:18:01 -0500
committersonartech <sonartech@sonarsource.com>2022-09-20 20:03:30 +0000
commita8fdb0fc9d296db66ddd5cf14c88023e9bd9a364 (patch)
tree9439c50824f6d7bcd5de3451841bfeb448e13d3c /sonar-ws/src
parent1731498e4f43bee8fc3c57ea58b1985db352baea (diff)
downloadsonarqube-a8fdb0fc9d296db66ddd5cf14c88023e9bd9a364.tar.gz
sonarqube-a8fdb0fc9d296db66ddd5cf14c88023e9bd9a364.zip
SONAR-17337 Scanner download of analyzer cache doesn't handle compression correctly
Diffstat (limited to 'sonar-ws/src')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java10
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java3
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/AnalysisCacheService.java68
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/GetRequest.java61
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/package-info.java26
5 files changed, 167 insertions, 1 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 9b7b205059c..20de62dceff 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
@@ -22,6 +22,7 @@ package org.sonarqube.ws.client;
import javax.annotation.Generated;
import org.sonarqube.ws.client.almintegrations.AlmIntegrationsService;
import org.sonarqube.ws.client.almsettings.AlmSettingsService;
+import org.sonarqube.ws.client.analysiscache.AnalysisCacheService;
import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
import org.sonarqube.ws.client.applications.ApplicationsService;
import org.sonarqube.ws.client.authentication.AuthenticationService;
@@ -89,6 +90,7 @@ class DefaultWsClient implements WsClient {
private final AlmIntegrationsService almIntegrationsService;
private final AlmSettingsService almSettingsService;
+ private final AnalysisCacheService analysisCacheService;
private final AnalysisReportsService analysisReportsService;
private final ApplicationsService applicationsService;
private final AuthenticationService authenticationService;
@@ -148,6 +150,7 @@ class DefaultWsClient implements WsClient {
this.almIntegrationsService = new AlmIntegrationsService(wsConnector);
this.almSettingsService = new AlmSettingsService(wsConnector);
+ this.analysisCacheService = new AnalysisCacheService(wsConnector);
this.analysisReportsService = new AnalysisReportsService(wsConnector);
this.applicationsService = new ApplicationsService(wsConnector);
this.authenticationService = new AuthenticationService(wsConnector);
@@ -220,6 +223,11 @@ class DefaultWsClient implements WsClient {
}
@Override
+ public AnalysisCacheService analysisCache() {
+ return analysisCacheService;
+ }
+
+ @Override
public AnalysisReportsService analysisReports() {
return analysisReportsService;
}
@@ -253,7 +261,7 @@ class DefaultWsClient implements WsClient {
public RegulatoryReportsService regulatoryReports() {
return regulatoryReportsService;
}
-
+
@Override
public DuplicationsService duplications() {
return duplicationsService;
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 c70da8022ae..07cc79baef8 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
@@ -22,6 +22,7 @@ package org.sonarqube.ws.client;
import javax.annotation.Generated;
import org.sonarqube.ws.client.almintegrations.AlmIntegrationsService;
import org.sonarqube.ws.client.almsettings.AlmSettingsService;
+import org.sonarqube.ws.client.analysiscache.AnalysisCacheService;
import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
import org.sonarqube.ws.client.applications.ApplicationsService;
import org.sonarqube.ws.client.authentication.AuthenticationService;
@@ -103,6 +104,8 @@ public interface WsClient {
AlmSettingsService almSettings();
+ AnalysisCacheService analysisCache();
+
AnalysisReportsService analysisReports();
ApplicationsService applications();
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/AnalysisCacheService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/AnalysisCacheService.java
new file mode 100644
index 00000000000..05ff43152eb
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/AnalysisCacheService.java
@@ -0,0 +1,68 @@
+/*
+ * 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.analysiscache;
+
+import java.io.InputStream;
+import javax.annotation.Generated;
+import org.sonarqube.ws.MediaTypes;
+import org.sonarqube.ws.client.BaseService;
+import org.sonarqube.ws.client.PostRequest;
+import org.sonarqube.ws.client.WsConnector;
+
+/**
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/analysis_cache">Further information about this web service online</a>
+ */
+@Generated("sonar-ws-generator")
+public class AnalysisCacheService extends BaseService {
+
+ public AnalysisCacheService(WsConnector wsConnector) {
+ super(wsConnector, "api/analysis_cache");
+ }
+
+ /**
+ * This is part of the internal API.
+ * This is a POST request.
+ *
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/analysis_cache/clear">Further information about this action online (including a response example)</a>
+ * @since 9.4
+ */
+ public void clear() {
+ call(
+ new PostRequest(path("clear"))
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+
+ /**
+ * This is part of the internal API.
+ * This is a GET request.
+ *
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/analysis_cache/get">Further information about this action online (including a response example)</a>
+ * @since 9.4
+ */
+ public InputStream get(GetRequest request) {
+ return call(
+ new org.sonarqube.ws.client.GetRequest(path("get"))
+ .setParam("branch", request.getBranch())
+ .setParam("project", request.getProject())
+ .setMediaType(MediaTypes.JSON)
+ ).contentStream();
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/GetRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/GetRequest.java
new file mode 100644
index 00000000000..d4b7b73e862
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/GetRequest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.analysiscache;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/analysis_cache/get">Further information about this action online (including a response example)</a>
+ * @since 9.4
+ */
+@Generated("sonar-ws-generator")
+public class GetRequest {
+
+ private String branch;
+ private String project;
+
+ /**
+ * Example value: "feature/my_branch"
+ */
+ public GetRequest setBranch(String branch) {
+ this.branch = branch;
+ return this;
+ }
+
+ public String getBranch() {
+ return branch;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "my_project"
+ */
+ public GetRequest setProject(String project) {
+ this.project = project;
+ return this;
+ }
+
+ public String getProject() {
+ return project;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/package-info.java
new file mode 100644
index 00000000000..dc513b11a5c
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/analysiscache/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+@ParametersAreNonnullByDefault
+@Generated("sonar-ws-generator")
+package org.sonarqube.ws.client.analysiscache;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.Generated;
+