use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class DeleteEventActionTest method call.
private void call(@Nullable String event) {
TestRequest request = ws.newRequest();
if (event != null) {
request.setParam(PARAM_EVENT, event);
}
request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class GhostsActionTest method fail_with_NotFoundException_when_organization_with_specified_key_does_not_exist.
@Test
public void fail_with_NotFoundException_when_organization_with_specified_key_does_not_exist() {
TestRequest request = underTest.newRequest().setParam("organization", "foo");
userSessionRule.logIn();
expectedException.expect(NotFoundException.class);
expectedException.expectMessage("No organization for key 'foo'");
request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class SetActionTest method call.
private TestResponse call(@Nullable String projectKey, @Nullable String tags) {
TestRequest request = ws.newRequest();
setNullable(projectKey, p -> request.setParam("project", p));
setNullable(tags, t -> request.setParam("tags", tags));
return request.execute();
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class IndexActionTest method executeAndVerify.
private void executeAndVerify(@Nullable String componentKey, @Nullable String key, String expectedFile) {
TestRequest request = ws.newRequest().setMediaType(MediaTypes.JSON);
if (key != null) {
request.setParam("id", key);
}
if (componentKey != null) {
request.setParam("resource", componentKey);
}
String result = request.execute().getInput();
assertJson(result).isSimilarTo(resource(expectedFile));
}
use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.
the class GetByProjectActionTest method call.
private GetByProjectWsResponse call(@Nullable String projectUuid, @Nullable String projectKey) {
TestRequest request = ws.newRequest().setMediaType(MediaTypes.PROTOBUF);
if (projectUuid != null) {
request.setParam(PARAM_PROJECT_ID, projectUuid);
}
if (projectKey != null) {
request.setParam(PARAM_PROJECT_KEY, projectKey);
}
InputStream response = request.execute().getInputStream();
try {
return GetByProjectWsResponse.parseFrom(response);
} catch (IOException e) {
throw propagate(e);
}
}
Aggregations