]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14812 - BBC Integration Tests
authorBelen Pruvost <belen.pruvost@sonarsource.com>
Thu, 3 Jun 2021 10:42:55 +0000 (12:42 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 3 Jun 2021 20:31:41 +0000 (20:31 +0000)
.cirrus.yml
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/AlmIntegrationsService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketcloudRepoRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SearchBitbucketcloudReposRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SetPatRequest.java

index 665a8c3d35ed51a97f7e3bbf1cd698e03bc8bb33..6bf844e3d475059fac12e0190d1a2b9e29c81538 100644 (file)
@@ -208,6 +208,31 @@ qa_bitbucket_task:
   on_failure:
     <<: *REPORTS_JUNIT_SCREENSHOTS_ON_FAILURE_TEMPLATE
 
+qa_bitbucket_cloud_task:
+  <<: *ONLY_NIGHTLY_DEPENDING_ON_BUILD_TEMPLATE
+  gke_container:
+    <<: *GKE_CONTAINER_TEMPLATE
+    cpu: 2.4
+    memory: 5Gb
+  env:
+    # No need to clone the full history.
+    # Depth of 1 is not enough because it would fail the build in case of consecutive pushes
+    # (example of error: "Hard resetting to c968ecaf7a1942dacecd78480b3751ac74d53c33...Failed to force reset to c968ecaf7a1942dacecd78480b3751ac74d53c33: object not found!")
+    CIRRUS_CLONE_DEPTH: 50
+    QA_CATEGORY: BITBUCKET_CLOUD
+    BBC_CLIENT_ID: ENCRYPTED[f1c2c57d5f02885345b3db5776a3b28f5dbcc89723809f73ad05ada903ece9584f1dfe61b026c10eabd72c75d1258bac]
+    BBC_CLIENT_SECRET: ENCRYPTED[39cc89ce4695c243fd688e687879bd473a60882fd30ba8613d6697e5d2b04e2017c68cae3a9a7ed9704f69c52bf229ee]
+    BBC_READ_REPOS_APP_PASSWORD: ENCRYPTED[d33b02d02987e188b5cec2a14f6ddd04d1fcac39ed5d6ced08891fc562ebb6721c9fbf307c0eba81df78c83f75b3c27c]
+    BBC_USERNAME: ENCRYPTED[f0af9be9d2fbaa55fbf69e4fce706ebc9131e0dc22cf8bce5d7ab2e0c2b57aff3ddbf6b3b77166e803a6000276256cea]
+  gradle_cache:
+    folder: ~/.gradle/caches
+  script:
+    - ./private/cirrus/cirrus-qa.sh h2
+  cleanup_before_cache_script:
+    - ./private/cirrus/cleanup-gradle-cache.sh
+  on_failure:
+    <<: *REPORTS_JUNIT_SCREENSHOTS_ON_FAILURE_TEMPLATE
+
 qa_ha_task:
   <<: *ONLY_NIGHTLY_DEPENDING_ON_BUILD_TEMPLATE
   gke_container:
index 13c73ed4e67b904414d25e1b4b8a495aee20d9c8..479c8d0424599563f6fbbfa800212f6b20716559 100644 (file)
@@ -70,6 +70,22 @@ public class AlmIntegrationsService extends BaseService {
       Projects.CreateWsResponse.parser());
   }
 
+  /**
+   * This is part of the internal API.
+   * This is a POST request.
+   *
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_bitbucketcloud_project">Further information about this action online (including a response example)</a>
+   * @since 8.2
+   */
+  public Projects.CreateWsResponse importBitbucketcloudProject(ImportBitbucketcloudRepoRequest request) {
+    return call(
+      new PostRequest(path("import_bitbucketcloud_repo"))
+        .setParam("almSetting", request.getAlmSetting())
+        .setParam("repositorySlug", request.getRepositorySlug())
+        .setMediaType(MediaTypes.JSON),
+      Projects.CreateWsResponse.parser());
+  }
+
   /**
    * This is a POST request.
    *
@@ -166,6 +182,21 @@ public class AlmIntegrationsService extends BaseService {
       AlmIntegrations.SearchBitbucketserverReposWsResponse.parser());
   }
 
+  /**
+   * This is part of the internal API.
+   * This is a GET request.
+   *
+   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bitbucketcloud_repos">Further information about this action online (including a response example)</a>
+   * @since 8.2
+   */
+  public AlmIntegrations.SearchBitbucketcloudReposWsResponse searchBitbucketcloudRepos(SearchBitbucketcloudReposRequest request) {
+    return call(
+      new GetRequest(path("search_bitbucketcloud_repos"))
+        .setParam("almSetting", request.getAlmSetting())
+        .setMediaType(MediaTypes.JSON),
+      AlmIntegrations.SearchBitbucketcloudReposWsResponse.parser());
+  }
+
   /**
    * This is part of the internal API.
    * This is a POST request.
@@ -178,6 +209,7 @@ public class AlmIntegrationsService extends BaseService {
       new PostRequest(path("set_pat"))
         .setParam("almSetting", request.getAlmSetting())
         .setParam("pat", request.getPat())
+        .setParam("username", request.getUsername())
         .setMediaType(MediaTypes.JSON)
     ).content();
   }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketcloudRepoRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/ImportBitbucketcloudRepoRequest.java
new file mode 100644 (file)
index 0000000..efd9153
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/import_bitbucketcloud_repo">Further information about this action online (including a response example)</a>
+ * @since 8.2
+ */
+@Generated("sonar-ws-generator")
+public class ImportBitbucketcloudRepoRequest {
+
+  private String almSetting;
+  private String repositorySlug;
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public ImportBitbucketcloudRepoRequest setAlmSetting(String almSetting) {
+    this.almSetting = almSetting;
+    return this;
+  }
+
+  public String getAlmSetting() {
+    return almSetting;
+  }
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public ImportBitbucketcloudRepoRequest 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/SearchBitbucketcloudReposRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/almintegrations/SearchBitbucketcloudReposRequest.java
new file mode 100644 (file)
index 0000000..6246bab
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/alm_integrations/search_bibucketserver_repos">Further information about this action online (including a response example)</a>
+ * @since 8.2
+ */
+@Generated("sonar-ws-generator")
+public class SearchBitbucketcloudReposRequest {
+
+  private String almSetting;
+  private String projectName;
+  private String repositoryName;
+
+  /**
+   * This is a mandatory parameter.
+   */
+  public SearchBitbucketcloudReposRequest setAlmSetting(String almSetting) {
+    this.almSetting = almSetting;
+    return this;
+  }
+
+  public String getAlmSetting() {
+    return almSetting;
+  }
+
+  /**
+   */
+  public SearchBitbucketcloudReposRequest setProjectName(String projectName) {
+    this.projectName = projectName;
+    return this;
+  }
+
+  public String getProjectName() {
+    return projectName;
+  }
+
+  /**
+   */
+  public SearchBitbucketcloudReposRequest setRepositoryName(String repositoryName) {
+    this.repositoryName = repositoryName;
+    return this;
+  }
+
+  public String getRepositoryName() {
+    return repositoryName;
+  }
+}
index faa42bbe7602e45d60433186b4ace76a3068ee6d..77986f21859af4d11f52eac2c6655d226ce317cd 100644 (file)
@@ -32,6 +32,7 @@ public class SetPatRequest {
 
   private String almSetting;
   private String pat;
+  private String username;
 
   /**
    * This is a mandatory parameter.
@@ -56,4 +57,13 @@ public class SetPatRequest {
   public String getPat() {
     return pat;
   }
+
+  public SetPatRequest setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public String getUsername() {
+    return username;
+  }
 }