Search in sources :

Example 6 with GetRequest

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

the class ProjectAnalysisServiceTest method search.

@Test
public void search() {
    underTest.search(SearchRequest.builder().setProject("project").setCategory(QUALITY_GATE).setPage(10).setPageSize(50).build());
    GetRequest getRequest = serviceTester.getGetRequest();
    assertThat(serviceTester.getGetParser()).isSameAs(ProjectAnalyses.SearchResponse.parser());
    serviceTester.assertThat(getRequest).hasParam(PARAM_PROJECT, "project").hasParam(PARAM_CATEGORY, QUALITY_GATE.name()).hasParam(PAGE, 10).hasParam(PAGE_SIZE, 50).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 7 with GetRequest

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

the class ProjectAnalysisServiceTest method search_without_category.

@Test
public void search_without_category() {
    underTest.search(SearchRequest.builder().setProject("project").setPage(10).setPageSize(50).build());
    GetRequest getRequest = serviceTester.getGetRequest();
    assertThat(serviceTester.getGetParser()).isSameAs(ProjectAnalyses.SearchResponse.parser());
    serviceTester.assertThat(getRequest).hasParam(PARAM_PROJECT, "project").hasParam(PAGE, 10).hasParam(PAGE_SIZE, 50).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 8 with GetRequest

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

the class ProjectAnalysisService method search.

public SearchResponse search(SearchRequest searchRequest) {
    EventCategory eventCategory = searchRequest.getCategory();
    GetRequest request = new GetRequest(path("search")).setParam(PARAM_PROJECT, searchRequest.getProject()).setParam(PARAM_CATEGORY, eventCategory == null ? null : eventCategory.name()).setParam(PAGE, searchRequest.getPage()).setParam(PAGE_SIZE, searchRequest.getPageSize());
    return call(request, SearchResponse.parser());
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest)

Example 9 with GetRequest

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

the class LicensesServiceTest method list_definitions.

@Test
public void list_definitions() {
    underTest.list();
    GetRequest getRequest = serviceTester.getGetRequest();
    assertThat(serviceTester.getGetParser()).isSameAs(ListWsResponse.parser());
    serviceTester.assertThat(getRequest).andNoOtherParam();
}
Also used : GetRequest(org.sonarqube.ws.client.GetRequest) Test(org.junit.Test)

Example 10 with GetRequest

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

the class MeasuresServiceTest method search_history.

@Test
public void search_history() {
    SearchHistoryRequest request = SearchHistoryRequest.builder().setComponent(VALUE_COMPONENT).setMetrics(VALUE_METRICS).setFrom(VALUE_FROM).setTo(VALUE_TO).setPage(VALUE_PAGE).setPageSize(VALUE_PAGE_SIZE).build();
    underTest.searchHistory(request);
    GetRequest getRequest = serviceTester.getGetRequest();
    assertThat(serviceTester.getGetParser()).isSameAs(WsMeasures.SearchHistoryResponse.parser());
    serviceTester.assertThat(getRequest).hasParam(PARAM_COMPONENT, VALUE_COMPONENT).hasParam(PARAM_METRICS, "ncloc,complexity").hasParam(PARAM_FROM, VALUE_FROM).hasParam(PARAM_TO, VALUE_TO).hasParam("p", VALUE_PAGE).hasParam("ps", VALUE_PAGE_SIZE).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