use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class GenerateActionTest method newRequest.
private GenerateWsResponse newRequest(@Nullable String login, String name) {
TestRequest testRequest = ws.newRequest().setMediaType(MediaTypes.PROTOBUF).setParam(PARAM_NAME, name);
if (login != null) {
testRequest.setParam(PARAM_LOGIN, login);
}
InputStream responseStream = testRequest.execute().getInputStream();
try {
return GenerateWsResponse.parseFrom(responseStream);
} catch (IOException e) {
throw propagate(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class CreateActionTest method executeJsonRequest.
private String executeJsonRequest(@Nullable String name, @Nullable String key, @Nullable String description, @Nullable String url, @Nullable String avatar) {
TestRequest request = wsTester.newRequest().setMediaType(MediaTypes.JSON);
populateRequest(name, key, description, url, avatar, request);
return request.execute().getInput();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class RemoveActionTest method call.
private TestResponse call(AddRequest.Builder wsRequestBuilder) {
AddRequest wsRequest = wsRequestBuilder.build();
TestRequest request = ws.newRequest();
request.setParam(PARAM_TYPE, wsRequest.getType());
setNullable(wsRequest.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel));
setNullable(wsRequest.getProject(), project -> request.setParam(PARAM_PROJECT, project));
return request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SearchActionTest method executeRequest.
private List<Organization> executeRequest(@Nullable Integer page, @Nullable Integer pageSize, String... keys) {
TestRequest request = wsTester.newRequest().setMediaType(MediaTypes.PROTOBUF);
populateRequest(request, page, pageSize, keys);
try {
return Organizations.SearchWsResponse.parseFrom(request.execute().getInputStream()).getOrganizationsList();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SearchActionTest method executeJsonRequest.
private String executeJsonRequest(@Nullable Integer page, @Nullable Integer pageSize, String... keys) {
TestRequest request = wsTester.newRequest().setMediaType(MediaTypes.JSON);
populateRequest(request, page, pageSize, keys);
return request.execute().getInput();
}
Aggregations