use of org.sonarqube.ws.Components.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() {
userSession.logIn();
insertProject(c -> c.setName("Sonar Java"));
insertProject(c -> c.setName("Sonar Groovy"));
insertProject(c -> c.setName("Sonar Markdown"));
insertProject(c -> c.setName("Sonar Qube"));
index();
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsList()).extracting(Component::getName).containsExactly("Sonar Groovy", "Sonar Java", "Sonar Markdown", "Sonar Qube");
}
use of org.sonarqube.ws.Components.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method filter_projects_by_duplications.
@Test
public void filter_projects_by_duplications() {
userSession.logIn();
MetricDto duplications = db.measures().insertMetric(c -> c.setKey(DUPLICATED_LINES_DENSITY_KEY).setValueType("PERCENT"));
ComponentDto project1 = insertProject(new Measure(duplications, c -> c.setValue(80d)));
ComponentDto project2 = insertProject(new Measure(duplications, c -> c.setValue(85d)));
ComponentDto project3 = insertProject(new Measure(duplications, c -> c.setValue(10d)));
index();
SearchProjectsWsResponse result = call(request.setFilter("duplicated_lines_density <= 80"));
assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
}
use of org.sonarqube.ws.Components.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method order_by_name_case_insensitive.
@Test
public void order_by_name_case_insensitive() {
userSession.logIn();
insertProject(c -> c.setName("Maven"));
insertProject(c -> c.setName("Apache"));
insertProject(c -> c.setName("guava"));
index();
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsList()).extracting(Component::getName).containsExactly("Apache", "guava", "Maven");
}
use of org.sonarqube.ws.Components.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method filter_projects_by_no_duplication_should_not_return_projects_with_duplication.
@Test
public void filter_projects_by_no_duplication_should_not_return_projects_with_duplication() {
userSession.logIn();
MetricDto coverage = db.measures().insertMetric(c -> c.setKey(COVERAGE).setValueType("PERCENT"));
MetricDto duplications = db.measures().insertMetric(c -> c.setKey(DUPLICATED_LINES_DENSITY_KEY).setValueType("PERCENT"));
insertProject(new Measure(duplications, c -> c.setValue(10d)), new Measure(coverage, c -> c.setValue(50d)));
index();
SearchProjectsWsResponse result = call(request.setFilter("duplicated_lines_density = NO_DATA"));
assertThat(result.getComponentsList()).extracting(Component::getKey).isEmpty();
}
use of org.sonarqube.ws.Components.SearchProjectsWsResponse in project sonarqube by SonarSource.
the class SearchProjectsActionTest method empty_result.
@Test
public void empty_result() {
userSession.logIn();
SearchProjectsWsResponse result = call(request);
assertThat(result.getComponentsCount()).isZero();
Common.Paging paging = result.getPaging();
assertThat(paging.getPageIndex()).isOne();
assertThat(paging.getPageSize()).isEqualTo(100);
assertThat(paging.getTotal()).isZero();
}
Aggregations