Search in sources :

Example 16 with ProjectMeasuresQuery

use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.

the class ProjectMeasuresQueryFactoryTest method filter_on_projectUuids_if_projectUuid_is_empty_and_criteria_is_empty.

@Test
public void filter_on_projectUuids_if_projectUuid_is_empty_and_criteria_is_empty() throws Exception {
    ProjectMeasuresQuery query = newProjectMeasuresQuery(emptyList(), emptySet());
    assertThat(query.getProjectUuids()).isPresent();
}
Also used : ProjectMeasuresQuery(org.sonar.server.measure.index.ProjectMeasuresQuery) ProjectMeasuresQueryFactory.newProjectMeasuresQuery(org.sonar.server.component.ws.ProjectMeasuresQueryFactory.newProjectMeasuresQuery) Test(org.junit.Test)

Example 17 with ProjectMeasuresQuery

use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.

the class ProjectMeasuresQueryFactoryTest method create_query_on_language_using_in_operator.

@Test
public void create_query_on_language_using_in_operator() throws Exception {
    ProjectMeasuresQuery query = newProjectMeasuresQuery(singletonList(Criterion.builder().setKey("languages").setOperator(IN).setValues(asList("java", "js")).build()), emptySet());
    assertThat(query.getLanguages().get()).containsOnly("java", "js");
}
Also used : ProjectMeasuresQuery(org.sonar.server.measure.index.ProjectMeasuresQuery) ProjectMeasuresQueryFactory.newProjectMeasuresQuery(org.sonar.server.component.ws.ProjectMeasuresQueryFactory.newProjectMeasuresQuery) Test(org.junit.Test)

Example 18 with ProjectMeasuresQuery

use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.

the class ProjectMeasuresQueryFactoryTest method filter_on_projectUuids_if_projectUuid_is_non_empty_and_criteria_empty.

@Test
public void filter_on_projectUuids_if_projectUuid_is_non_empty_and_criteria_empty() throws Exception {
    ProjectMeasuresQuery query = newProjectMeasuresQuery(emptyList(), Collections.singleton("foo"));
    assertThat(query.getProjectUuids()).isPresent();
}
Also used : ProjectMeasuresQuery(org.sonar.server.measure.index.ProjectMeasuresQuery) ProjectMeasuresQueryFactory.newProjectMeasuresQuery(org.sonar.server.component.ws.ProjectMeasuresQueryFactory.newProjectMeasuresQuery) Test(org.junit.Test)

Example 19 with ProjectMeasuresQuery

use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.

the class ProjectMeasuresQueryFactoryTest method filter_on_projectUuids_if_projectUuid_is_empty_and_criteria_non_empty.

@Test
public void filter_on_projectUuids_if_projectUuid_is_empty_and_criteria_non_empty() throws Exception {
    ProjectMeasuresQuery query = newProjectMeasuresQuery(singletonList(Criterion.builder().setKey("ncloc").setOperator(GT).setValue("10").build()), emptySet());
    assertThat(query.getProjectUuids()).isPresent();
}
Also used : ProjectMeasuresQuery(org.sonar.server.measure.index.ProjectMeasuresQuery) ProjectMeasuresQueryFactory.newProjectMeasuresQuery(org.sonar.server.component.ws.ProjectMeasuresQueryFactory.newProjectMeasuresQuery) Test(org.junit.Test)

Example 20 with ProjectMeasuresQuery

use of org.sonar.server.measure.index.ProjectMeasuresQuery in project sonarqube by SonarSource.

the class ProjectMeasuresQueryFactoryTest method accept_empty_query.

@Test
public void accept_empty_query() throws Exception {
    ProjectMeasuresQuery result = newProjectMeasuresQuery(emptyList(), emptySet());
    assertThat(result.getMetricCriteria()).isEmpty();
}
Also used : ProjectMeasuresQuery(org.sonar.server.measure.index.ProjectMeasuresQuery) ProjectMeasuresQueryFactory.newProjectMeasuresQuery(org.sonar.server.component.ws.ProjectMeasuresQueryFactory.newProjectMeasuresQuery) Test(org.junit.Test)

Aggregations

ProjectMeasuresQuery (org.sonar.server.measure.index.ProjectMeasuresQuery)24 Test (org.junit.Test)22 ProjectMeasuresQueryFactory.newProjectMeasuresQuery (org.sonar.server.component.ws.ProjectMeasuresQueryFactory.newProjectMeasuresQuery)16 MetricCriterion (org.sonar.server.measure.index.ProjectMeasuresQuery.MetricCriterion)10 Criterion (org.sonar.server.component.ws.FilterParser.Criterion)4 ComponentDto (org.sonar.db.component.ComponentDto)1 SnapshotDto (org.sonar.db.component.SnapshotDto)1 SearchOptions (org.sonar.server.es.SearchOptions)1