Search in sources :

Example 1 with SearchHistoryRequest

use of org.sonarqube.ws.client.measure.SearchHistoryRequest 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)

Aggregations

IOException (java.io.IOException)1 TestRequest (org.sonar.server.ws.TestRequest)1 SearchHistoryRequest (org.sonarqube.ws.client.measure.SearchHistoryRequest)1