Search in sources :

Example 31 with TestRequest

use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.

the class ChangelogActionTest method call.

private ChangelogWsResponse call(@Nullable String issueKey) {
    TestRequest request = tester.newRequest().setMediaType(MediaTypes.PROTOBUF);
    setNullable(issueKey, e -> request.setParam("issue", e));
    try {
        return ChangelogWsResponse.parseFrom(request.execute().getInputStream());
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
}
Also used : IOException(java.io.IOException) TestRequest(org.sonar.server.ws.TestRequest)

Example 32 with TestRequest

use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.

the class SetSeverityActionTest method call.

private TestResponse call(@Nullable String issueKey, @Nullable String severity) {
    TestRequest request = tester.newRequest();
    setNullable(issueKey, issue -> request.setParam("issue", issue));
    setNullable(severity, value -> request.setParam("severity", value));
    return request.execute();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 33 with TestRequest

use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.

the class SetTypeActionTest method call.

private TestResponse call(@Nullable String issueKey, @Nullable String type) {
    TestRequest request = tester.newRequest();
    setNullable(issueKey, issue -> request.setParam("issue", issue));
    setNullable(type, t -> request.setParam("type", t));
    return request.execute();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 34 with TestRequest

use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.

the class SearchHistoryActionTest method call.

private SearchHistoryResponse call() {
    SearchHistoryRequest wsRequest = this.wsRequest.build();
    TestRequest request = ws.newRequest().setMediaType(MediaTypes.PROTOBUF);
    request.setParam(PARAM_COMPONENT, wsRequest.getComponent());
    request.setParam(PARAM_METRICS, String.join(",", wsRequest.getMetrics()));
    setNullable(wsRequest.getFrom(), from -> request.setParam(PARAM_FROM, from));
    setNullable(wsRequest.getTo(), to -> request.setParam(PARAM_TO, to));
    setNullable(wsRequest.getPage(), p -> request.setParam(Param.PAGE, String.valueOf(p)));
    setNullable(wsRequest.getPageSize(), ps -> request.setParam(Param.PAGE_SIZE, String.valueOf(ps)));
    try {
        return SearchHistoryResponse.parseFrom(request.execute().getInputStream());
    } catch (IOException e) {
        throw Throwables.propagate(e);
    }
}
Also used : IOException(java.io.IOException) SearchHistoryRequest(org.sonarqube.ws.client.measure.SearchHistoryRequest) TestRequest(org.sonar.server.ws.TestRequest)

Example 35 with TestRequest

use of org.sonar.server.ws.TestRequest in project sonarqube by SonarSource.

the class AddActionTest 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();
}
Also used : AddRequest(org.sonarqube.ws.client.notification.AddRequest) TestRequest(org.sonar.server.ws.TestRequest)

Aggregations

TestRequest (org.sonar.server.ws.TestRequest)48 IOException (java.io.IOException)19 Test (org.junit.Test)4 InputStream (java.io.InputStream)3 OrganizationDto (org.sonar.db.organization.OrganizationDto)2 AddRequest (org.sonarqube.ws.client.notification.AddRequest)2 DbSession (org.sonar.db.DbSession)1 CoveredFileDoc (org.sonar.server.test.index.CoveredFileDoc)1 TestDoc (org.sonar.server.test.index.TestDoc)1 TestResponse (org.sonar.server.ws.TestResponse)1 WsActionTester (org.sonar.server.ws.WsActionTester)1 SearchProjectsRequest (org.sonarqube.ws.client.component.SearchProjectsRequest)1 SearchHistoryRequest (org.sonarqube.ws.client.measure.SearchHistoryRequest)1 CreateEventRequest (org.sonarqube.ws.client.projectanalysis.CreateEventRequest)1