Search in sources :

Example 46 with GetRequest

use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.

the class PermissionsServiceTest method groups_does_POST_on_WS_groups.

@Test
public void groups_does_POST_on_WS_groups() {
    GroupsWsRequest request = new GroupsWsRequest();
    underTest.groups(request.setPermission(PERMISSION_VALUE).setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE).setPage(PAGE_VALUE).setPageSize(PAGE_SIZE_VALUE).setQuery(QUERY_VALUE));
    assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.WsGroupsResponse.parser());
    GetRequest getRequest = serviceTester.getGetRequest();
    serviceTester.assertThat(getRequest).hasPath("groups").hasParam(PARAM_PERMISSION, PERMISSION_VALUE).hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE).hasParam(PARAM_P, PAGE_VALUE).hasParam(PARAM_PS, PAGE_SIZE_VALUE).hasParam(PARAM_Q, QUERY_VALUE).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 47 with GetRequest

use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.

the class PermissionsServiceTest method searchTemplates_does_GET_on_Ws_search_templates.

@Test
public void searchTemplates_does_GET_on_Ws_search_templates() {
    underTest.searchTemplates(new SearchTemplatesWsRequest().setQuery(QUERY_VALUE));
    assertThat(serviceTester.getGetParser()).isSameAs(WsPermissions.SearchTemplatesWsResponse.parser());
    GetRequest getRequest = serviceTester.getGetRequest();
    serviceTester.assertThat(getRequest).hasPath("search_templates").hasParam(PARAM_Q, QUERY_VALUE).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 48 with GetRequest

use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.

the class ProjectLinksServiceTest method search_does_GET_request.

@Test
public void search_does_GET_request() {
    underTest.search(new SearchWsRequest().setProjectId(PROJECT_ID_VALUE).setProjectKey(PROJECT_KEY_VALUE));
    assertThat(serviceTester.getGetParser()).isSameAs(SearchWsResponse.parser());
    GetRequest getRequest = serviceTester.getGetRequest();
    serviceTester.assertThat(getRequest).hasPath("search").hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE).hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 49 with GetRequest

use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.

the class QualityGatesServiceTest method project_status.

@Test
public void project_status() {
    underTest.projectStatus(new ProjectStatusWsRequest().setAnalysisId("analysisId").setProjectId("projectId").setProjectKey("projectKey"));
    GetRequest getRequest = serviceTester.getGetRequest();
    assertThat(serviceTester.getGetParser()).isSameAs(ProjectStatusWsResponse.parser());
    serviceTester.assertThat(getRequest).hasParam(PARAM_ANALYSIS_ID, "analysisId").hasParam(PARAM_PROJECT_ID, "projectId").hasParam(PARAM_PROJECT_KEY, "projectKey").andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 50 with GetRequest

use of org.sonarqube.ws.client.GetRequest in project sonarqube by SonarSource.

the class CeServiceTest method activity.

@Test
public void activity() {
    ActivityWsRequest request = new ActivityWsRequest().setComponentId(VALUE_COMPONENT_ID).setQuery(VALUE_QUERY).setStatus(ImmutableList.of(VALUE_TASK_STATUS_1, VALUE_TASK_STATUS_2)).setType(VALUE_TASK_TYPE).setPage(VALUE_PAGE).setPageSize(VALUE_PAGE_SIZE).setMaxExecutedAt(VALUE_MAX_EXECUTED_AT).setMinSubmittedAt(VALUE_MIN_SUBMITTED_AT).setOnlyCurrents(VALUE_ONLY_CURRENTS).setPage(1).setPageSize(1);
    underTest.activity(request);
    GetRequest result = serviceTester.getGetRequest();
    assertThat(serviceTester.getGetParser()).isSameAs(ActivityResponse.parser());
    serviceTester.assertThat(result).hasPath("activity").hasParam(PARAM_COMPONENT_ID, VALUE_COMPONENT_ID).hasParam("q", VALUE_QUERY).hasParam(PARAM_STATUS, VALUE_TASK_STATUS_1 + "," + VALUE_TASK_STATUS_2).hasParam(PARAM_TYPE, VALUE_TASK_TYPE).hasParam(PARAM_MAX_EXECUTED_AT, VALUE_MAX_EXECUTED_AT).hasParam(PARAM_MIN_SUBMITTED_AT, VALUE_MIN_SUBMITTED_AT).hasParam(PARAM_ONLY_CURRENTS, VALUE_ONLY_CURRENTS).hasParam("p", 1).hasParam("ps", 1).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Aggregations

GetRequest (org.sonarqube.ws.client.GetRequest)59 Test (org.junit.Test)34 WsResponse (org.sonarqube.ws.client.WsResponse)27 IOException (java.io.IOException)5 InputStream (java.io.InputStream)5 Profiler (org.sonar.api.utils.log.Profiler)5 Reader (java.io.Reader)4 HttpException (org.sonarqube.ws.client.HttpException)4 WsClient (org.sonarqube.ws.client.WsClient)4 ItUtils.newAdminWsClient (util.ItUtils.newAdminWsClient)3 File (java.io.File)2 PipedInputStream (java.io.PipedInputStream)2 PipedOutputStream (java.io.PipedOutputStream)2 ShowWsResponse (org.sonarqube.ws.ServerId.ShowWsResponse)2 ItUtils.newWsClient (util.ItUtils.newWsClient)2 Gson (com.google.gson.Gson)1 LinkedList (java.util.LinkedList)1 CheckForNull (javax.annotation.CheckForNull)1 LoadedActiveRule (org.sonar.api.batch.rule.LoadedActiveRule)1 Metric (org.sonar.api.measures.Metric)1