use of org.sonarqube.ws.client.component.TreeWsRequest in project sonarqube by SonarSource.
the class LiteTest method call_components_ws.
@Test
public void call_components_ws() {
// files in project
WsComponents.TreeWsResponse tree = wsClient.components().tree(new TreeWsRequest().setBaseComponentKey(PROJECT_KEY).setQualifiers(singletonList("FIL")));
assertThat(tree.getComponentsCount()).isEqualTo(4);
tree.getComponentsList().forEach(c -> {
assertThat(c.getQualifier()).isEqualTo("FIL");
assertThat(c.getName()).endsWith(".xoo");
});
}
use of org.sonarqube.ws.client.component.TreeWsRequest in project sonarqube by SonarSource.
the class TreeAction method toTreeWsRequest.
private static TreeWsRequest toTreeWsRequest(Request request) {
TreeWsRequest treeWsRequest = new TreeWsRequest().setBaseComponentId(request.param(PARAM_COMPONENT_ID)).setBaseComponentKey(request.param(PARAM_COMPONENT)).setStrategy(request.mandatoryParam(PARAM_STRATEGY)).setQuery(request.param(Param.TEXT_QUERY)).setQualifiers(request.paramAsStrings(PARAM_QUALIFIERS)).setSort(request.mandatoryParamAsStrings(Param.SORT)).setAsc(request.mandatoryParamAsBoolean(Param.ASCENDING)).setPage(request.mandatoryParamAsInt(Param.PAGE)).setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE));
checkRequest(treeWsRequest.getPageSize() <= MAX_SIZE, "The '%s' parameter must be less than %d", Param.PAGE_SIZE, MAX_SIZE);
String searchQuery = treeWsRequest.getQuery();
checkRequest(searchQuery == null || searchQuery.length() >= QUERY_MINIMUM_LENGTH, "The '%s' parameter must have at least %d characters", Param.TEXT_QUERY, QUERY_MINIMUM_LENGTH);
return treeWsRequest;
}
Aggregations