From: Julien Lancelot Date: Tue, 12 Dec 2017 12:59:38 +0000 (+0100) Subject: SONAR-10134 Add organization parameter in quality gates wsclient X-Git-Tag: 7.0-RC1~110 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a93fdfcffa23c125376d3e1f9e2e4abbc6b61a19;p=sonarqube.git SONAR-10134 Add organization parameter in quality gates wsclient --- diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java index 87eeca9a8da..3383f355d09 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java @@ -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 builtInQualityGates = session.wsClient().qualitygates().list().getQualitygatesList().stream() + List 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())))); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java index f995619b0ec..1feda7bc21e 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CopyRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java index f0bd0551e53..2413177780e 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateConditionRequest.java @@ -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: *
    diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java index 86938326d7c..bbddb5efe18 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/CreateRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java index 209b77d4cc6..366cd99394e 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeleteConditionRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java index a1565475457..7d93b7e4f1f 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DeselectRequest.java @@ -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 diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java index 9a2280e692c..50802428f66 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/DestroyRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java index 868d867fead..9b8032bcd3a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/GetByProjectRequest.java @@ -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 index 00000000000..2a0f2388e2c --- /dev/null +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ListRequest.java @@ -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 Further information about this action online (including a response example) + * @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; + } +} diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java index 9152bdae30d..65423484335 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ProjectStatusRequest.java @@ -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" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java index bfef940b019..362479b2f43 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java @@ -19,20 +19,20 @@ */ 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 Further information about this web service online @@ -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 Further information about this action online (including a response example) * @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 Further information about this action online (including a response example) * @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()); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java index ae2edfa43b1..04f4cdebb04 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/RenameRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java index 5506b0423d5..005f846820b 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SearchRequest.java @@ -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" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java index d83215d0eb4..75025f5cd6a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SelectRequest.java @@ -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" */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java index 15cd79e71e9..a9783aa7866 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/SetAsDefaultRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java index 02902bd5617..0ad38ba5ab2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/ShowRequest.java @@ -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; + } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java index 2291826d004..7e334059da2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/UpdateConditionRequest.java @@ -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: *
      diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java index 37cd43aa4cc..0262c9d68bc 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java @@ -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()); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java index 859f6b479fc..279c5a438de 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java @@ -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"); }