Search in sources :

Example 11 with TestRequest

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();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 12 with TestRequest

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

Example 13 with TestRequest

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);
    }
}
Also used : IOException(java.io.IOException) TestRequest(org.sonar.server.ws.TestRequest)

Example 14 with TestRequest

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();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 15 with TestRequest

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

the class AddUserToTemplateActionTest method newRequest.

private void newRequest(@Nullable String userLogin, @Nullable String templateKey, @Nullable String permission) throws Exception {
    TestRequest request = newRequest();
    if (userLogin != null) {
        request.setParam(PARAM_USER_LOGIN, userLogin);
    }
    if (templateKey != null) {
        request.setParam(org.sonarqube.ws.client.permission.PermissionsWsParameters.PARAM_TEMPLATE_ID, templateKey);
    }
    if (permission != null) {
        request.setParam(PARAM_PERMISSION, permission);
    }
    request.execute();
}
Also used : 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