use of org.sonarqube.ws.Components.Component in project sonarqube by SonarSource.
the class SearchProjectsActionTest method filter_projects_by_coverage.
@Test
public void filter_projects_by_coverage() {
userSession.logIn();
MetricDto coverage = db.measures().insertMetric(c -> c.setKey(COVERAGE).setValueType("PERCENT"));
ComponentDto project1 = insertProject(new Measure(coverage, c -> c.setValue(80d)));
ComponentDto project2 = insertProject(new Measure(coverage, c -> c.setValue(85d)));
ComponentDto project3 = insertProject(new Measure(coverage, c -> c.setValue(10d)));
index();
SearchProjectsWsResponse result = call(request.setFilter("coverage <= 80"));
assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
}
use of org.sonarqube.ws.Components.Component in project sonarqube by SonarSource.
the class SearchProjectsActionTest method filter_projects_by_new_lines.
@Test
public void filter_projects_by_new_lines() {
userSession.logIn();
MetricDto newLines = db.measures().insertMetric(c -> c.setKey(NEW_LINES_KEY).setValueType(INT.name()));
ComponentDto project1 = insertProject(new Measure(newLines, c -> c.setVariation(80d)));
ComponentDto project2 = insertProject(new Measure(newLines, c -> c.setVariation(85d)));
ComponentDto project3 = insertProject(new Measure(newLines, c -> c.setVariation(10d)));
index();
SearchProjectsWsResponse result = call(request.setFilter("new_lines <= 80"));
assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
}
use of org.sonarqube.ws.Components.Component 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.Component 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.Component in project sonarqube by SonarSource.
the class SearchProjectsActionTest method filter_projects_by_new_duplications.
@Test
public void filter_projects_by_new_duplications() {
userSession.logIn();
MetricDto newDuplications = db.measures().insertMetric(c -> c.setKey(NEW_DUPLICATED_LINES_DENSITY_KEY).setValueType("PERCENT"));
ComponentDto project1 = insertProject(new Measure(newDuplications, c -> c.setVariation(80d)));
ComponentDto project2 = insertProject(new Measure(newDuplications, c -> c.setVariation(85d)));
ComponentDto project3 = insertProject(new Measure(newDuplications, c -> c.setVariation(10d)));
index();
SearchProjectsWsResponse result = call(request.setFilter("new_duplicated_lines_density <= 80"));
assertThat(result.getComponentsList()).extracting(Component::getKey).containsExactlyInAnyOrder(project1.getDbKey(), project3.getDbKey());
}
Aggregations