]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10134 Add organization parameter in quality gates wsclient
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 12 Dec 2017 12:59:38 +0000 (13:59 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 14 Dec 2017 16:03:35 +0000 (17:03 +0100)
19 files changed:
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java

index 87eeca9a8da9c7676d4ead946cb60c743d317a20..3383f355d09b45c63b5ade5e845dffc332846897 100644 (file)
@@ -28,6 +28,7 @@ import java.util.stream.Collectors;
 import org.sonarqube.ws.Projects.CreateWsResponse.Project;
 import org.sonarqube.ws.client.qualitygates.CreateRequest;
 import org.sonarqube.ws.client.qualitygates.DestroyRequest;
+import org.sonarqube.ws.client.qualitygates.ListRequest;
 import org.sonarqube.ws.client.qualitygates.QualitygatesService;
 import org.sonarqube.ws.client.qualitygates.SelectRequest;
 import org.sonarqube.ws.client.qualitygates.SetAsDefaultRequest;
@@ -49,13 +50,13 @@ public class QGateTester {
   }
 
   void deleteAll() {
-    List<ListWsResponse.QualityGate> builtInQualityGates = session.wsClient().qualitygates().list().getQualitygatesList().stream()
+    List<ListWsResponse.QualityGate> builtInQualityGates = session.wsClient().qualitygates().list(new ListRequest()).getQualitygatesList().stream()
       .filter(ListWsResponse.QualityGate::getIsBuiltIn)
       .collect(Collectors.toList());
     if (builtInQualityGates.size() == 1) {
       session.wsClient().qualitygates().setAsDefault(new SetAsDefaultRequest().setId(Long.toString(builtInQualityGates.get(0).getId())));
     }
-    session.wsClient().qualitygates().list().getQualitygatesList().stream()
+    session.wsClient().qualitygates().list(new ListRequest()).getQualitygatesList().stream()
       .filter(qualityGate -> !qualityGate.getIsDefault())
       .filter(qualityGate -> !qualityGate.getIsBuiltIn())
       .forEach(qualityGate -> session.wsClient().qualitygates().destroy(new DestroyRequest().setId(Long.toString(qualityGate.getId()))));
index f995619b0ec868c23cdcb331cc0a314871fe17c0..1feda7bc21ee40117ddb868b718d323a2299741e 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -33,6 +32,7 @@ public class CopyRequest {
 
   private String id;
   private String name;
+  private String organization;
 
   /**
    * This is a mandatory parameter.
@@ -59,4 +59,16 @@ public class CopyRequest {
   public String getName() {
     return name;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public CopyRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index f0bd0551e535d680a6d9acb186cc4623612487b2..2413177780e051e929c58aa72238d668ed95793d 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -35,6 +34,7 @@ public class CreateConditionRequest {
   private String gateId;
   private String metric;
   private String op;
+  private String organization;
   private String period;
   private String warning;
 
@@ -95,6 +95,18 @@ public class CreateConditionRequest {
     return op;
   }
 
+  /**
+   * Example value: "my-org"
+   */
+  public CreateConditionRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * Possible values:
    * <ul>
index 86938326d7c4bb716d8e677aba46e8ae8dc551e9..bbddb5efe18ef5541248ecfdd8a184b25605a909 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class CreateRequest {
 
   private String name;
+  private String organization;
 
   /**
    * This is a mandatory parameter.
@@ -45,4 +45,16 @@ public class CreateRequest {
   public String getName() {
     return name;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public CreateRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index 209b77d4cc69194c4e0658fc4c515f2258271681..366cd99394e7c1a1d45b657789dad0b91350c36d 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class DeleteConditionRequest {
 
   private String id;
+  private String organization;
 
   /**
    * This is a mandatory parameter.
@@ -45,4 +45,16 @@ public class DeleteConditionRequest {
   public String getId() {
     return id;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public DeleteConditionRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index a1565475457d0e4bc2533bf258c2a00c02096099..7d93b7e4f1fda5e4da1ca5018de9ab4153168426 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -31,9 +30,22 @@ import javax.annotation.Generated;
 @Generated("sonar-ws-generator")
 public class DeselectRequest {
 
+  private String organization;
   private String projectId;
   private String projectKey;
 
+  /**
+   * Example value: "my-org"
+   */
+  public DeselectRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * Example value: "AU-Tpxb--iU5OvuD2FLy"
    * @deprecated since 6.1
index 9a2280e692c6b89984d92458d3146036f85ad9aa..50802428f66c0349b5d8fafca19a28872ce5b12c 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class DestroyRequest {
 
   private String id;
+  private String organization;
 
   /**
    * This is a mandatory parameter.
@@ -45,4 +45,16 @@ public class DestroyRequest {
   public String getId() {
     return id;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public DestroyRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index 868d867fead30c1be431d6940da566ec933e4baf..9b8032bcd3aa66304ea1cbbb3eccab2c6d367233 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -31,8 +30,21 @@ import javax.annotation.Generated;
 @Generated("sonar-ws-generator")
 public class GetByProjectRequest {
 
+  private String organization;
   private String project;
 
+  /**
+   * Example value: "my-org"
+   */
+  public GetByProjectRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * This is a mandatory parameter.
    * Example value: "my_project"
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java
new file mode 100644 (file)
index 0000000..2a0f238
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.qualitygates;
+
+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/qualitygates/list">Further information about this action online (including a response example)</a>
+ * @since 4.3
+ */
+@Generated("sonar-ws-generator")
+public class ListRequest {
+
+  private String organization;
+
+  /**
+   * Example value: "my-org"
+   */
+  public ListRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+}
index 9152bdae30d61a0fcc144d163f8d3a661a6b3bf9..65423484335271af08494a43815ef4dd2100636d 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class ProjectStatusRequest {
 
   private String analysisId;
+  private String organization;
   private String projectId;
   private String projectKey;
 
@@ -47,6 +47,18 @@ public class ProjectStatusRequest {
     return analysisId;
   }
 
+  /**
+   * Example value: "my-org"
+   */
+  public ProjectStatusRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * Example value: "AU-Tpxb--iU5OvuD2FLy"
    */
index bfef940b019b67ba6c6c31b9fa5d7eab0f5e4d2c..362479b2f436599c197bff70758caca6f820c39a 100644 (file)
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.stream.Collectors;
 import javax.annotation.Generated;
 import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.WsConnector;
-import org.sonarqube.ws.Qualitygates.CreateResponse;
 import org.sonarqube.ws.Qualitygates.CreateConditionResponse;
+import org.sonarqube.ws.Qualitygates.CreateResponse;
 import org.sonarqube.ws.Qualitygates.GetByProjectResponse;
 import org.sonarqube.ws.Qualitygates.ListWsResponse;
 import org.sonarqube.ws.Qualitygates.ProjectStatusResponse;
+import org.sonarqube.ws.Qualitygates.SearchResponse;
 import org.sonarqube.ws.Qualitygates.ShowWsResponse;
 import org.sonarqube.ws.Qualitygates.UpdateConditionResponse;
+import org.sonarqube.ws.client.BaseService;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.PostRequest;
+import org.sonarqube.ws.client.WsConnector;
 
 /**
  * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates">Further information about this web service online</a>
@@ -56,6 +56,7 @@ public class QualitygatesService extends BaseService {
       new PostRequest(path("copy"))
         .setParam("id", request.getId())
         .setParam("name", request.getName())
+        .setParam("organization", request.getOrganization())
         .setMediaType(MediaTypes.JSON)
       ).content();
   }
@@ -70,7 +71,8 @@ public class QualitygatesService extends BaseService {
   public CreateResponse create(CreateRequest request) {
     return call(
       new PostRequest(path("create"))
-        .setParam("name", request.getName()),
+        .setParam("name", request.getName())
+        .setParam("organization", request.getOrganization()),
       CreateResponse.parser());
   }
 
@@ -88,6 +90,7 @@ public class QualitygatesService extends BaseService {
         .setParam("gateId", request.getGateId())
         .setParam("metric", request.getMetric())
         .setParam("op", request.getOp())
+        .setParam("organization", request.getOrganization())
         .setParam("period", request.getPeriod())
         .setParam("warning", request.getWarning()),
       CreateConditionResponse.parser());
@@ -104,6 +107,7 @@ public class QualitygatesService extends BaseService {
     call(
       new PostRequest(path("delete_condition"))
         .setParam("id", request.getId())
+        .setParam("organization", request.getOrganization())
         .setMediaType(MediaTypes.JSON)
       ).content();
   }
@@ -118,6 +122,7 @@ public class QualitygatesService extends BaseService {
   public void deselect(DeselectRequest request) {
     call(
       new PostRequest(path("deselect"))
+        .setParam("organization", request.getOrganization())
         .setParam("projectId", request.getProjectId())
         .setParam("projectKey", request.getProjectKey())
         .setMediaType(MediaTypes.JSON)
@@ -135,6 +140,7 @@ public class QualitygatesService extends BaseService {
     call(
       new PostRequest(path("destroy"))
         .setParam("id", request.getId())
+        .setParam("organization", request.getOrganization())
         .setMediaType(MediaTypes.JSON)
       ).content();
   }
@@ -149,6 +155,7 @@ public class QualitygatesService extends BaseService {
   public GetByProjectResponse getByProject(GetByProjectRequest request) {
     return call(
       new GetRequest(path("get_by_project"))
+        .setParam("organization", request.getOrganization())
         .setParam("project", request.getProject()),
       GetByProjectResponse.parser());
   }
@@ -160,9 +167,10 @@ public class QualitygatesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/list">Further information about this action online (including a response example)</a>
    * @since 4.3
    */
-  public ListWsResponse list() {
+  public ListWsResponse list(ListRequest request) {
     return call(
-      new GetRequest(path("list")),
+      new GetRequest(path("list"))
+        .setParam("organization", request.getOrganization()),
       ListWsResponse.parser());
   }
 
@@ -177,6 +185,7 @@ public class QualitygatesService extends BaseService {
     return call(
       new GetRequest(path("project_status"))
         .setParam("analysisId", request.getAnalysisId())
+        .setParam("organization", request.getOrganization())
         .setParam("projectId", request.getProjectId())
         .setParam("projectKey", request.getProjectKey()),
       ProjectStatusResponse.parser());
@@ -194,6 +203,7 @@ public class QualitygatesService extends BaseService {
       new PostRequest(path("rename"))
         .setParam("id", request.getId())
         .setParam("name", request.getName())
+        .setParam("organization", request.getOrganization())
         .setMediaType(MediaTypes.JSON)
       ).content();
   }
@@ -205,16 +215,16 @@ public class QualitygatesService extends BaseService {
    * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/search">Further information about this action online (including a response example)</a>
    * @since 4.3
    */
-  public String search(SearchRequest request) {
+  public SearchResponse search(SearchRequest request) {
     return call(
       new GetRequest(path("search"))
         .setParam("gateId", request.getGateId())
+        .setParam("organization", request.getOrganization())
         .setParam("page", request.getPage())
         .setParam("pageSize", request.getPageSize())
         .setParam("query", request.getQuery())
-        .setParam("selected", request.getSelected())
-        .setMediaType(MediaTypes.JSON)
-      ).content();
+        .setParam("selected", request.getSelected()),
+      SearchResponse.parser());
   }
 
   /**
@@ -228,6 +238,7 @@ public class QualitygatesService extends BaseService {
     call(
       new PostRequest(path("select"))
         .setParam("gateId", request.getGateId())
+        .setParam("organization", request.getOrganization())
         .setParam("projectId", request.getProjectId())
         .setParam("projectKey", request.getProjectKey())
         .setMediaType(MediaTypes.JSON)
@@ -245,6 +256,7 @@ public class QualitygatesService extends BaseService {
     call(
       new PostRequest(path("set_as_default"))
         .setParam("id", request.getId())
+        .setParam("organization", request.getOrganization())
         .setMediaType(MediaTypes.JSON)
       ).content();
   }
@@ -260,7 +272,8 @@ public class QualitygatesService extends BaseService {
     return call(
       new GetRequest(path("show"))
         .setParam("id", request.getId())
-        .setParam("name", request.getName()),
+        .setParam("name", request.getName())
+        .setParam("organization", request.getOrganization()),
       ShowWsResponse.parser());
   }
 
@@ -294,6 +307,7 @@ public class QualitygatesService extends BaseService {
         .setParam("id", request.getId())
         .setParam("metric", request.getMetric())
         .setParam("op", request.getOp())
+        .setParam("organization", request.getOrganization())
         .setParam("period", request.getPeriod())
         .setParam("warning", request.getWarning()),
       UpdateConditionResponse.parser());
index ae2edfa43b1e747822ac9184dc1e2aaaa65269db..04f4cdebb0425ac34edb1ed5afa5a44d642cf570 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -33,6 +32,7 @@ public class RenameRequest {
 
   private String id;
   private String name;
+  private String organization;
 
   /**
    * This is a mandatory parameter.
@@ -59,4 +59,16 @@ public class RenameRequest {
   public String getName() {
     return name;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public RenameRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index 5506b0423d569da4d2f928263d3cc4cfa7e9661c..005f846820b242b9e762fde8168fdcc1b02321d6 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class SearchRequest {
 
   private String gateId;
+  private String organization;
   private String page;
   private String pageSize;
   private String query;
@@ -50,6 +50,18 @@ public class SearchRequest {
     return gateId;
   }
 
+  /**
+   * Example value: "my-org"
+   */
+  public SearchRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * Example value: "2"
    */
index d83215d0eb439111506ca27bdb732814db3968b3..75025f5cd6af1f62342e2cc3e2b413a317d9d14b 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class SelectRequest {
 
   private String gateId;
+  private String organization;
   private String projectId;
   private String projectKey;
 
@@ -48,6 +48,18 @@ public class SelectRequest {
     return gateId;
   }
 
+  /**
+   * Example value: "my-org"
+   */
+  public SelectRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * Example value: "AU-Tpxb--iU5OvuD2FLy"
    */
index 15cd79e71e9795339d4cf81d59676807e7778b50..a9783aa7866ea71a5fcbeed414c2a54934ce3a1a 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -32,6 +31,7 @@ import javax.annotation.Generated;
 public class SetAsDefaultRequest {
 
   private String id;
+  private String organization;
 
   /**
    * This is a mandatory parameter.
@@ -45,4 +45,16 @@ public class SetAsDefaultRequest {
   public String getId() {
     return id;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public SetAsDefaultRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index 02902bd56170f59f8f1a8780771bbcfb7ea11644..0ad38ba5ab2338eec5972904d3c5d4063bb2833c 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -33,6 +32,7 @@ public class ShowRequest {
 
   private String id;
   private String name;
+  private String organization;
 
   /**
    * Example value: "1"
@@ -57,4 +57,16 @@ public class ShowRequest {
   public String getName() {
     return name;
   }
+
+  /**
+   * Example value: "my-org"
+   */
+  public ShowRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
 }
index 2291826d0044f1a89d74b436875254dbf6e2541f..7e334059da289770da750642bdddd19e691cbe07 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonarqube.ws.client.qualitygates;
 
-import java.util.List;
 import javax.annotation.Generated;
 
 /**
@@ -35,6 +34,7 @@ public class UpdateConditionRequest {
   private String id;
   private String metric;
   private String op;
+  private String organization;
   private String period;
   private String warning;
 
@@ -95,6 +95,18 @@ public class UpdateConditionRequest {
     return op;
   }
 
+  /**
+   * Example value: "my-org"
+   */
+  public UpdateConditionRequest setOrganization(String organization) {
+    this.organization = organization;
+    return this;
+  }
+
+  public String getOrganization() {
+    return organization;
+  }
+
   /**
    * Possible values:
    * <ul>
index 37cd43aa4ccd0ffcbeb13e9c9565839340ecaa8b..0262c9d68bca1a7bb0ca842ce3914c5a40275456 100644 (file)
@@ -55,11 +55,14 @@ public class OrganizationQualityGateUiTest {
   private Users.CreateWsResponse.User gateAdmin;
 
   @Before
-  public void setUp() throws Exception {
+  public void setUp() {
     organization = tester.organizations().generate();
     gateAdmin = tester.users().generate();
-    tester.organizations().addMember(tester.organizations().getDefaultOrganization(), gateAdmin);
-    tester.wsClient().permissions().addUser(new AddUserRequest().setLogin(gateAdmin.getLogin()).setPermission("gateadmin"));
+    tester.organizations().addMember(organization, gateAdmin);
+    tester.wsClient().permissions().addUser(new AddUserRequest()
+      .setOrganization(organization.getKey())
+      .setLogin(gateAdmin.getLogin())
+      .setPermission("gateadmin"));
     user = tester.users().generate();
     tester.organizations().addMember(organization, user);
     restoreProfile(orchestrator, getClass().getResource("/issue/with-many-rules.xml"), organization.getKey());
index 859f6b479fc2e214112d3db211b956df411f0314..279c5a438dea02496b2a16d7c68d2e0313a73cf2 100644 (file)
@@ -56,7 +56,7 @@ public class QualityGateUiTest {
     .disableOrganizations();
 
   @Before
-  public void initPeriod() throws Exception {
+  public void initPeriod() {
     tester.settings().setGlobalSettings("sonar.leak.period", "previous_version");
   }