]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12366 Add WS to tester
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 9 Aug 2019 16:11:19 +0000 (11:11 -0500)
committerSonarTech <sonartech@sonarsource.com>
Tue, 24 Sep 2019 18:21:14 +0000 (20:21 +0200)
server/sonar-server/src/test/java/org/sonar/server/setting/ws/DeleteNewCodePeriodActionTest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/settings/DeleteNewCodePeriodRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/settings/SettingsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java [new file with mode: 0644]

index a04c216091cd52b32379bc69af77ca93a3d8fc66..ace4cf9d9aeabacd785edf3b511c4cc45c99853b 100644 (file)
@@ -180,7 +180,7 @@ public class DeleteNewCodePeriodActionTest {
     ws.newRequest()
       .setParam("project", project.getKey())
       .execute();
-    assertTableContainsOnly(project.uuid(), null, NewCodePeriodType.PREVIOUS_VERSION, null);
+    assertTableEmpty();
 
     ws.newRequest()
       .setParam("project", project.getKey())
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/plugins/DownloadRequest.java
new file mode 100644 (file)
index 0000000..72d31d2
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.plugins;
+
+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/plugins/download">Further information about this action online (including a response example)</a>
+ * @since 7.2
+ */
+@Generated("sonar-ws-generator")
+public class DownloadRequest {
+
+  private String acceptCompressions;
+  private String plugin;
+
+  /**
+   * Example value: "pack200"
+   */
+  public DownloadRequest setAcceptCompressions(String acceptCompressions) {
+    this.acceptCompressions = acceptCompressions;
+    return this;
+  }
+
+  public String getAcceptCompressions() {
+    return acceptCompressions;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "cobol"
+   */
+  public DownloadRequest setPlugin(String plugin) {
+    this.plugin = plugin;
+    return this;
+  }
+
+  public String getPlugin() {
+    return plugin;
+  }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/SetBaselineRequest.java
new file mode 100644 (file)
index 0000000..455a891
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.projectanalyses;
+
+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/project_analyses/set_baseline">Further information about this action online (including a response example)</a>
+ * @since 7.7
+ */
+@Generated("sonar-ws-generator")
+public class SetBaselineRequest {
+
+  private String analysis;
+  private String branch;
+  private String project;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "AU-Tpxb--iU5OvuD2FLy"
+   */
+  public SetBaselineRequest setAnalysis(String analysis) {
+    this.analysis = analysis;
+    return this;
+  }
+
+  public String getAnalysis() {
+    return analysis;
+  }
+
+  /**
+   */
+  public SetBaselineRequest setBranch(String branch) {
+    this.branch = branch;
+    return this;
+  }
+
+  public String getBranch() {
+    return branch;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public SetBaselineRequest 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/projectanalyses/UnsetBaselineRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalyses/UnsetBaselineRequest.java
new file mode 100644 (file)
index 0000000..aa2be41
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.projectanalyses;
+
+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/project_analyses/unset_baseline">Further information about this action online (including a response example)</a>
+ * @since 7.7
+ */
+@Generated("sonar-ws-generator")
+public class UnsetBaselineRequest {
+
+  private String branch;
+  private String project;
+
+  /**
+   */
+  public UnsetBaselineRequest setBranch(String branch) {
+    this.branch = branch;
+    return this;
+  }
+
+  public String getBranch() {
+    return branch;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public UnsetBaselineRequest 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/settings/DeleteNewCodePeriodRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/settings/DeleteNewCodePeriodRequest.java
new file mode 100644 (file)
index 0000000..9b81df3
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.settings;
+
+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/settings/delete_new_code_period">Further information about this action online (including a response example)</a>
+ * @since 8.0
+ */
+@Generated("sonar-ws-generator")
+public class DeleteNewCodePeriodRequest {
+
+  private String branch;
+  private String project;
+
+  /**
+   */
+  public DeleteNewCodePeriodRequest setBranch(String branch) {
+    this.branch = branch;
+    return this;
+  }
+
+  public String getBranch() {
+    return branch;
+  }
+
+  /**
+   */
+  public DeleteNewCodePeriodRequest setProject(String project) {
+    this.project = project;
+    return this;
+  }
+
+  public String getProject() {
+    return project;
+  }
+}
index 123900c217f10984fb7177406c688e4e6f183bf2..bcb034d4797c9f96fecc5dbea6dcb553483c5632 100644 (file)
@@ -56,6 +56,22 @@ public class SettingsService extends BaseService {
       CheckSecretKeyWsResponse.parser());
   }
 
+  /**
+   *
+   * This is part of the internal API.
+   * This is a GET request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/settings/delete_new_code_period">Further information about this action online (including a response example)</a>
+   * @since 8.0
+   */
+  public void deleteNewCodePeriod(DeleteNewCodePeriodRequest request) {
+    call(
+      new GetRequest(path("delete_new_code_period"))
+        .setParam("branch", request.getBranch())
+        .setParam("project", request.getProject())
+        .setMediaType(MediaTypes.JSON)
+    ).content();
+  }
+
   /**
    * This is part of the internal API.
    * This is a GET request.
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/sources/IssueSnippetsRequest.java
new file mode 100644 (file)
index 0000000..c7761b5
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 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.sources;
+
+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/sources/issue_snippets">Further information about this action online (including a response example)</a>
+ * @since 7.8
+ */
+@Generated("sonar-ws-generator")
+public class IssueSnippetsRequest {
+
+  private String issueKey;
+
+  /**
+   * This is a mandatory parameter.
+   * Example value: "AU-Tpxb--iU5OvuD2FLy"
+   */
+  public IssueSnippetsRequest setIssueKey(String issueKey) {
+    this.issueKey = issueKey;
+    return this;
+  }
+
+  public String getIssueKey() {
+    return issueKey;
+  }
+}