]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11370 Add ITs to verify security reports content
authorJanos Gyerik <janos.gyerik@sonarsource.com>
Wed, 17 Oct 2018 15:33:18 +0000 (17:33 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 25 Oct 2018 18:21:01 +0000 (20:21 +0200)
sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/SecurityReportsService.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/package-info.java [new file with mode: 0644]

index b7406f4af0b53d050c7af67e6fba9ae28167c839..469b707ee5f247dd552a7e682d8aa19eac8d7179 100644 (file)
@@ -59,6 +59,7 @@ import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
 import org.sonarqube.ws.client.resources.ResourcesService;
 import org.sonarqube.ws.client.roots.RootsService;
 import org.sonarqube.ws.client.rules.RulesService;
+import org.sonarqube.ws.client.securityreports.SecurityReportsService;
 import org.sonarqube.ws.client.server.ServerService;
 import org.sonarqube.ws.client.settings.SettingsService;
 import org.sonarqube.ws.client.sources.SourcesService;
@@ -140,6 +141,7 @@ class DefaultWsClient implements WsClient {
   private final WebhooksService webhooksService;
   private final WebservicesService webservicesService;
   private final BatchService batchService;
+  private final SecurityReportsService securityReportsService;
 
   DefaultWsClient(WsConnector wsConnector) {
     this.wsConnector = wsConnector;
@@ -198,6 +200,7 @@ class DefaultWsClient implements WsClient {
     this.webhooksService = new WebhooksService(wsConnector);
     this.webservicesService = new WebservicesService(wsConnector);
     this.batchService = new BatchService(wsConnector);
+    this.securityReportsService = new SecurityReportsService(wsConnector);
   }
 
   @Override
@@ -476,4 +479,9 @@ class DefaultWsClient implements WsClient {
     return batchService;
   }
 
+  @Override
+  public SecurityReportsService securityReports() {
+    return securityReportsService;
+  }
+
 }
index 387e7258f451762afa06c919dc04b31fee6071c7..922659a8c11a239b5e56c82aecccaa988bc53404 100644 (file)
@@ -59,6 +59,7 @@ import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
 import org.sonarqube.ws.client.resources.ResourcesService;
 import org.sonarqube.ws.client.roots.RootsService;
 import org.sonarqube.ws.client.rules.RulesService;
+import org.sonarqube.ws.client.securityreports.SecurityReportsService;
 import org.sonarqube.ws.client.server.ServerService;
 import org.sonarqube.ws.client.settings.SettingsService;
 import org.sonarqube.ws.client.sources.SourcesService;
@@ -205,4 +206,6 @@ public interface WsClient {
   WebservicesService webservices();
 
   BatchService batch();
+
+  SecurityReportsService securityReports();
 }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/SecurityReportsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/SecurityReportsService.java
new file mode 100644 (file)
index 0000000..3715e31
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.securityreports;
+
+import javax.annotation.Generated;
+import org.sonarqube.ws.client.BaseService;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.WsConnector;
+import org.sonarqube.ws.SecurityReports.ShowWsResponse;
+
+/**
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/security_reports">Further information about this web service online</a>
+ */
+@Generated("sonar-ws-generator")
+public class SecurityReportsService extends BaseService {
+
+  public SecurityReportsService(WsConnector wsConnector) {
+    super(wsConnector, "api/security_reports");
+  }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a GET request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/security_reports/show">Further information about this action online (including a response example)</a>
+   * @since 7.3
+   */
+  public ShowWsResponse show(ShowRequest request) {
+    return call(
+      new GetRequest(path("show"))
+        .setParam("branch", request.getBranch())
+        .setParam("includeDistribution", request.getIncludeDistribution())
+        .setParam("project", request.getProject())
+        .setParam("standard", request.getStandard()),
+      ShowWsResponse.parser());
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/ShowRequest.java
new file mode 100644 (file)
index 0000000..8ebf048
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.securityreports;
+
+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/security_reports/show">Further information about this action online (including a response example)</a>
+ * @since 7.3
+ */
+@Generated("sonar-ws-generator")
+public class ShowRequest {
+
+  private String branch;
+  private String includeDistribution;
+  private String project;
+  private String standard;
+
+  /**
+   * Example value: "branch-2.0"
+   */
+  public ShowRequest setBranch(String branch) {
+    this.branch = branch;
+    return this;
+  }
+
+  public String getBranch() {
+    return branch;
+  }
+
+  /**
+   * Possible values:
+   * <ul>
+   *   <li>"true"</li>
+   *   <li>"false"</li>
+   *   <li>"yes"</li>
+   *   <li>"no"</li>
+   * </ul>
+   */
+  public ShowRequest setIncludeDistribution(String includeDistribution) {
+    this.includeDistribution = includeDistribution;
+    return this;
+  }
+
+  public String getIncludeDistribution() {
+    return includeDistribution;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public ShowRequest setProject(String project) {
+    this.project = project;
+    return this;
+  }
+
+  public String getProject() {
+    return project;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Possible values:
+   * <ul>
+   *   <li>"owaspTop10"</li>
+   *   <li>"sansTop25"</li>
+   * </ul>
+   */
+  public ShowRequest setStandard(String standard) {
+    this.standard = standard;
+    return this;
+  }
+
+  public String getStandard() {
+    return standard;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/securityreports/package-info.java
new file mode 100644 (file)
index 0000000..fdcd51b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.securityreports;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.Generated;
+