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;
}
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()))));
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
private String id;
private String name;
+ private String organization;
/**
* This is a mandatory parameter.
public String getName() {
return name;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public CopyRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
private String gateId;
private String metric;
private String op;
+ private String organization;
private String period;
private String warning;
return op;
}
+ /**
+ * Example value: "my-org"
+ */
+ public CreateConditionRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
+
/**
* Possible values:
* <ul>
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class CreateRequest {
private String name;
+ private String organization;
/**
* This is a mandatory parameter.
public String getName() {
return name;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public CreateRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class DeleteConditionRequest {
private String id;
+ private String organization;
/**
* This is a mandatory parameter.
public String getId() {
return id;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public DeleteConditionRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
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
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class DestroyRequest {
private String id;
+ private String organization;
/**
* This is a mandatory parameter.
public String getId() {
return id;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public DestroyRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
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"
--- /dev/null
+/*
+ * 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;
+ }
+}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class ProjectStatusRequest {
private String analysisId;
+ private String organization;
private String projectId;
private String projectKey;
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"
*/
*/
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>
new PostRequest(path("copy"))
.setParam("id", request.getId())
.setParam("name", request.getName())
+ .setParam("organization", request.getOrganization())
.setMediaType(MediaTypes.JSON)
).content();
}
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());
}
.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());
call(
new PostRequest(path("delete_condition"))
.setParam("id", request.getId())
+ .setParam("organization", request.getOrganization())
.setMediaType(MediaTypes.JSON)
).content();
}
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)
call(
new PostRequest(path("destroy"))
.setParam("id", request.getId())
+ .setParam("organization", request.getOrganization())
.setMediaType(MediaTypes.JSON)
).content();
}
public GetByProjectResponse getByProject(GetByProjectRequest request) {
return call(
new GetRequest(path("get_by_project"))
+ .setParam("organization", request.getOrganization())
.setParam("project", request.getProject()),
GetByProjectResponse.parser());
}
* @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());
}
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());
new PostRequest(path("rename"))
.setParam("id", request.getId())
.setParam("name", request.getName())
+ .setParam("organization", request.getOrganization())
.setMediaType(MediaTypes.JSON)
).content();
}
* @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());
}
/**
call(
new PostRequest(path("select"))
.setParam("gateId", request.getGateId())
+ .setParam("organization", request.getOrganization())
.setParam("projectId", request.getProjectId())
.setParam("projectKey", request.getProjectKey())
.setMediaType(MediaTypes.JSON)
call(
new PostRequest(path("set_as_default"))
.setParam("id", request.getId())
+ .setParam("organization", request.getOrganization())
.setMediaType(MediaTypes.JSON)
).content();
}
return call(
new GetRequest(path("show"))
.setParam("id", request.getId())
- .setParam("name", request.getName()),
+ .setParam("name", request.getName())
+ .setParam("organization", request.getOrganization()),
ShowWsResponse.parser());
}
.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());
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
private String id;
private String name;
+ private String organization;
/**
* This is a mandatory parameter.
public String getName() {
return name;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public RenameRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class SearchRequest {
private String gateId;
+ private String organization;
private String page;
private String pageSize;
private String query;
return gateId;
}
+ /**
+ * Example value: "my-org"
+ */
+ public SearchRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
+
/**
* Example value: "2"
*/
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class SelectRequest {
private String gateId;
+ private String organization;
private String projectId;
private String projectKey;
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"
*/
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
public class SetAsDefaultRequest {
private String id;
+ private String organization;
/**
* This is a mandatory parameter.
public String getId() {
return id;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public SetAsDefaultRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
private String id;
private String name;
+ private String organization;
/**
* Example value: "1"
public String getName() {
return name;
}
+
+ /**
+ * Example value: "my-org"
+ */
+ public ShowRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
}
*/
package org.sonarqube.ws.client.qualitygates;
-import java.util.List;
import javax.annotation.Generated;
/**
private String id;
private String metric;
private String op;
+ private String organization;
private String period;
private String warning;
return op;
}
+ /**
+ * Example value: "my-org"
+ */
+ public UpdateConditionRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
+
/**
* Possible values:
* <ul>
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());
.disableOrganizations();
@Before
- public void initPeriod() throws Exception {
+ public void initPeriod() {
tester.settings().setGlobalSettings("sonar.leak.period", "previous_version");
}