use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class CreateActionTest method executeRequest.
private CreateWsResponse executeRequest(@Nullable String name, @Nullable String key, @Nullable String description, @Nullable String url, @Nullable String avatar) {
TestRequest request = wsTester.newRequest().setMediaType(MediaTypes.PROTOBUF);
populateRequest(name, key, description, url, avatar, request);
try {
return CreateWsResponse.parseFrom(request.execute().getInputStream());
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class UpdateActionTest method executeRequest.
private Organizations.UpdateWsResponse executeRequest(@Nullable String key, @Nullable String name, @Nullable String description, @Nullable String url, @Nullable String avatar) {
TestRequest request = wsTester.newRequest().setMediaType(MediaTypes.PROTOBUF);
setParam(request, "key", key);
setParam(request, "name", name);
setParam(request, "description", description);
setParam(request, "url", url);
setParam(request, "avatar", avatar);
try {
return Organizations.UpdateWsResponse.parseFrom(request.execute().getInputStream());
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class AddUserActionTest method executeRequest.
private void executeRequest(UserDto userDto, String permission, @Nullable OrganizationDto organizationDto) throws Exception {
TestRequest request = newRequest().setParam(PARAM_USER_LOGIN, userDto.getLogin()).setParam(PARAM_PERMISSION, permission);
if (organizationDto != null) {
request.setParam(PARAM_ORGANIZATION, organizationDto.getKey());
}
request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class CreateActionTest method call.
private CreateWsResponse call(CreateRequest request) {
TestRequest httpRequest = ws.newRequest().setMethod(POST.name()).setMediaType(MediaTypes.PROTOBUF);
setNullable(request.getOrganization(), e -> httpRequest.setParam("organization", e));
setNullable(request.getKey(), e -> httpRequest.setParam("project", e));
setNullable(request.getName(), e -> httpRequest.setParam("name", e));
setNullable(request.getBranch(), e -> httpRequest.setParam("branch", e));
try {
return CreateWsResponse.parseFrom(httpRequest.execute().getInputStream());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class UpdateEventActionTest method call.
private UpdateEventResponse call(@Nullable String eventUuid, @Nullable String name) {
TestRequest request = ws.newRequest().setMethod(POST.name()).setMediaType(MediaTypes.PROTOBUF);
setNullable(eventUuid, e -> request.setParam(PARAM_EVENT, e));
setNullable(name, n -> request.setParam(PARAM_NAME, n));
try {
return UpdateEventResponse.parseFrom(request.execute().getInputStream());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
Aggregations