Search in sources :

Example 16 with TestRequest

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

the class AddGroupToTemplateActionTest method newRequest.

private void newRequest(@Nullable String groupName, @Nullable String templateKey, @Nullable String permission) throws Exception {
    TestRequest request = newRequest();
    if (groupName != null) {
        request.setParam(PARAM_GROUP_NAME, groupName);
    }
    if (templateKey != null) {
        request.setParam(PARAM_TEMPLATE_ID, templateKey);
    }
    if (permission != null) {
        request.setParam(PARAM_PERMISSION, permission);
    }
    request.execute();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 17 with TestRequest

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

the class RemoveGroupFromTemplateActionTest method newRequest.

private void newRequest(@Nullable String groupName, @Nullable String templateKey, @Nullable String permission) throws Exception {
    TestRequest request = newRequest();
    if (groupName != null) {
        request.setParam(PARAM_GROUP_NAME, groupName);
    }
    if (templateKey != null) {
        request.setParam(PARAM_TEMPLATE_ID, templateKey);
    }
    if (permission != null) {
        request.setParam(PARAM_PERMISSION, permission);
    }
    request.execute();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 18 with TestRequest

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

the class RemoveUserFromTemplateActionTest 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)

Example 19 with TestRequest

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

the class IndexActionTest method call.

private String call(@Nullable String key, @Nullable String search, @Nullable Boolean subprojects) {
    TestRequest httpRequest = ws.newRequest();
    setNullable(key, e -> httpRequest.setParam("key", e));
    setNullable(search, e -> httpRequest.setParam("search", e));
    setNullable(subprojects, e -> httpRequest.setParam("subprojects", Boolean.toString(e)));
    return httpRequest.execute().getInput();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest)

Example 20 with TestRequest

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

the class ProvisionedActionTest 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(PARAM_ORGANIZATION, "foo");
    userSessionRule.logIn();
    expectedException.expect(NotFoundException.class);
    expectedException.expectMessage("No organization for key 'foo'");
    request.execute();
}
Also used : TestRequest(org.sonar.server.ws.TestRequest) Test(org.junit.Test)

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