use of org.sonarqube.ws.WsComponents.SuggestionsWsResponse in project sonarqube by SonarSource.
the class SuggestionsAction method handle.
@Override
public void handle(Request wsRequest, Response wsResponse) throws Exception {
SuggestionsWsResponse searchWsResponse = doHandle(wsRequest.param(URL_PARAM_QUERY));
writeProtobuf(searchWsResponse, wsRequest, wsResponse);
}
use of org.sonarqube.ws.WsComponents.SuggestionsWsResponse in project sonarqube by SonarSource.
the class SuggestionsActionTest method exact_match_in_one_qualifier.
@Test
public void exact_match_in_one_qualifier() {
ComponentDto project = db.components().insertComponent(newProjectDto(organization));
componentIndexer.indexOnStartup(null);
authorizationIndexerTester.allowOnlyAnyone(project);
SuggestionsWsResponse response = action.doHandle(project.getKey());
// assert match in qualifier "TRK"
assertThat(response.getResultsList()).filteredOn(q -> q.getItemsCount() > 0).extracting(SuggestionsWsResponse.Qualifier::getQ).containsExactly(Qualifiers.PROJECT);
// assert correct id to be found
assertThat(response.getResultsList()).flatExtracting(SuggestionsWsResponse.Qualifier::getItemsList).extracting(WsComponents.Component::getKey, WsComponents.Component::getOrganization).containsExactly(tuple(project.getKey(), organization.getKey()));
}
Aggregations