use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SearchActionTest method call.
private SearchResponse call(@Nullable Integer page, @Nullable Integer pageSize) {
TestRequest request = ws.newRequest().setMediaType(MediaTypes.PROTOBUF).setMethod(POST.name());
setNullable(page, p -> request.setParam(Param.PAGE, p.toString()));
setNullable(pageSize, ps -> request.setParam(Param.PAGE_SIZE, ps.toString()));
InputStream response = request.execute().getInputStream();
try {
return SearchResponse.parseFrom(response);
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SendActionTest method executeRequest.
private void executeRequest(@Nullable String to, @Nullable String subject, @Nullable String message) {
TestRequest request = ws.newRequest();
if (to != null) {
request.setParam("to", to);
}
if (subject != null) {
request.setParam("subject", subject);
}
if (message != null) {
request.setParam("message", message);
}
request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class AddCommentActionTest method call.
private TestResponse call(@Nullable String issueKey, @Nullable String commentText) {
TestRequest request = tester.newRequest();
setNullable(issueKey, issue -> request.setParam("issue", issue));
setNullable(commentText, text -> request.setParam("text", text));
return request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class BulkChangeActionTest method call.
private BulkChangeWsResponse call(BulkChangeRequest bulkChangeRequest) {
TestRequest request = tester.newRequest().setMediaType(MediaTypes.PROTOBUF);
setNullable(bulkChangeRequest.getIssues(), value -> request.setParam("issues", String.join(",", value)));
setNullable(bulkChangeRequest.getAssign(), value -> request.setParam("assign", value));
setNullable(bulkChangeRequest.getSetSeverity(), value -> request.setParam("set_severity", value));
setNullable(bulkChangeRequest.getSetType(), value -> request.setParam("set_type", value));
setNullable(bulkChangeRequest.getDoTransition(), value -> request.setParam("do_transition", value));
setNullable(bulkChangeRequest.getComment(), value -> request.setParam("comment", value));
setNullable(bulkChangeRequest.getSendNotifications(), value -> request.setParam("sendNotifications", value != null ? value ? "true" : "false" : null));
if (!bulkChangeRequest.getAddTags().isEmpty()) {
request.setParam("add_tags", String.join(",", bulkChangeRequest.getAddTags()));
}
if (!bulkChangeRequest.getRemoveTags().isEmpty()) {
request.setParam("remove_tags", String.join(",", bulkChangeRequest.getRemoveTags()));
}
try {
return BulkChangeWsResponse.parseFrom(request.execute().getInputStream());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class DeleteCommentActionTest method call.
private TestResponse call(@Nullable String commentKey) {
TestRequest request = tester.newRequest();
setNullable(commentKey, comment -> request.setParam("comment", comment));
return request.execute();
}
Aggregations