use of org.sonarqube.ws.WsComponents.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsAction method handle.
@Override
public void handle(Request httpRequest, Response httpResponse) throws Exception {
SearchProjectsWsResponse response = doHandle(toRequest(httpRequest));
writeProtobuf(response, httpRequest, httpResponse);
}
use of org.sonarqube.ws.WsComponents.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method order_by_name_case_insensitive.
@Test
public void order_by_name_case_insensitive() {
insertProjectInDbAndEs(newProjectDto(db.getDefaultOrganization()).setName("Maven"));
insertProjectInDbAndEs(newProjectDto(db.getDefaultOrganization()).setName("Apache"));
insertProjectInDbAndEs(newProjectDto(db.getDefaultOrganization()).setName("guava"));
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsList()).extracting(Component::getName).containsExactly("Apache", "guava", "Maven");
}
use of org.sonarqube.ws.WsComponents.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method filter_projects_by_quality_gate.
@Test
public void filter_projects_by_quality_gate() {
OrganizationDto organizationDto = db.organizations().insertForKey("my-org-key-1");
insertProjectInDbAndEs(newProjectDto(organizationDto).setName("Sonar Java"), "OK");
insertProjectInDbAndEs(newProjectDto(organizationDto).setName("Sonar Markdown"), "OK");
insertProjectInDbAndEs(newProjectDto(organizationDto).setName("Sonar Qube"), "ERROR");
insertMetrics(COVERAGE, NCLOC);
request.setFilter("alert_status = OK");
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsList()).extracting(Component::getName).containsOnly("Sonar Java", "Sonar Markdown");
}
use of org.sonarqube.ws.WsComponents.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method default_sort_is_by_ascending_name.
@Test
public void default_sort_is_by_ascending_name() throws Exception {
OrganizationDto organization = db.getDefaultOrganization();
insertProjectInDbAndEs(newProjectDto(organization).setName("Sonar Java"), newArrayList(newMeasure(COVERAGE, 81), newMeasure(NCLOC, 5d)));
insertProjectInDbAndEs(newProjectDto(organization).setName("Sonar Groovy"), newArrayList(newMeasure(COVERAGE, 81), newMeasure(NCLOC, 5d)));
insertProjectInDbAndEs(newProjectDto(organization).setName("Sonar Markdown"), newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 10_000d)));
insertProjectInDbAndEs(newProjectDto(organization).setName("Sonar Qube"), newArrayList(newMeasure(COVERAGE, 80d), newMeasure(NCLOC, 500_001d)));
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsList()).extracting(Component::getName).containsExactly("Sonar Groovy", "Sonar Java", "Sonar Markdown", "Sonar Qube");
}
use of org.sonarqube.ws.WsComponents.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method return_only_projects.
@Test
public void return_only_projects() {
OrganizationDto organizationDto = db.organizations().insert();
ComponentDto project = newProjectDto(organizationDto).setName("SonarQube");
ComponentDto directory = newDirectory(project, "path");
insertProjectInDbAndEs(project);
componentDb.insertComponents(newModuleDto(project), newView(organizationDto), newDeveloper(organizationDto, "Sonar Developer"), directory, newFileDto(project, directory));
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsCount()).isEqualTo(1);
assertThat(result.getComponents(0).getName()).isEqualTo("SonarQube");
}
Aggregations