Search in sources :

Example 6 with SearchResponse

use of org.sonarqube.ws.Favorites.SearchResponse in project sonarqube by SonarSource.

the class SearchActionTest method filter_authorized_components.

@Test
public void filter_authorized_components() {
    OrganizationDto organizationDto = db.organizations().insert();
    addComponent(newProjectDto(organizationDto).setKey("K1"));
    ComponentDto unauthorizedProject = db.components().insertComponent(newProjectDto(organizationDto));
    db.favorites().add(unauthorizedProject, USER_ID);
    SearchResponse result = call();
    assertThat(result.getFavoritesCount()).isEqualTo(1);
    assertThat(result.getFavorites(0).getKey()).isEqualTo("K1");
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) OrganizationDto(org.sonar.db.organization.OrganizationDto) SearchResponse(org.sonarqube.ws.Favorites.SearchResponse) Test(org.junit.Test)

Example 7 with SearchResponse

use of org.sonarqube.ws.Favorites.SearchResponse in project sonarqube by SonarSource.

the class SearchAction method handle.

@Override
public void handle(Request request, Response response) throws Exception {
    SearchRequest searchRequest = toWsRequest(request);
    SearchResults searchResults = toSearchResults(searchRequest);
    SearchResponse wsResponse = toSearchResponse(searchResults);
    writeProtobuf(wsResponse, request, response);
}
Also used : SearchRequest(org.sonarqube.ws.client.favorite.SearchRequest) SearchResponse(org.sonarqube.ws.Favorites.SearchResponse)

Aggregations

SearchResponse (org.sonarqube.ws.Favorites.SearchResponse)7 Test (org.junit.Test)6 ComponentDto (org.sonar.db.component.ComponentDto)4 OrganizationDto (org.sonar.db.organization.OrganizationDto)3 UserPermissionDto (org.sonar.db.permission.UserPermissionDto)1 SearchRequest (org.sonarqube.ws.client.favorite.SearchRequest)1