use of org.sonar.db.metric.MetricDto in project sonarqube by SonarSource.
the class ProjectMeasuresIndexerIteratorTest method does_not_return_disabled_metrics.
@Test
public void does_not_return_disabled_metrics() throws Exception {
MetricDto disabledMetric = insertMetric("disabled", false, false, INT);
ComponentDto project = newProjectDto(dbTester.getDefaultOrganization());
SnapshotDto analysis = dbTester.components().insertProjectAndSnapshot(project);
insertMeasure(project, analysis, disabledMetric, 10d);
Map<String, ProjectMeasures> docsById = createResultSetAndReturnDocsById();
assertThat(docsById.get(project.uuid()).getMeasures().getNumericMeasures()).isEmpty();
}
use of org.sonar.db.metric.MetricDto in project sonarqube by SonarSource.
the class ProjectMeasuresIndexerIteratorTest method return_quality_gate_status_measure.
@Test
public void return_quality_gate_status_measure() throws Exception {
MetricDto metric = insertMetric("alert_status", LEVEL);
insertProjectAndMeasure("project1", metric, WARN.name());
insertProjectAndMeasure("project2", metric, OK.name());
insertProjectAndMeasure("project3", metric, ERROR.name());
Map<String, ProjectMeasures> docsById = createResultSetAndReturnDocsById();
assertThat(docsById.get("project1").getMeasures().getQualityGateStatus()).isEqualTo("WARN");
assertThat(docsById.get("project2").getMeasures().getQualityGateStatus()).isEqualTo("OK");
assertThat(docsById.get("project3").getMeasures().getQualityGateStatus()).isEqualTo("ERROR");
}
use of org.sonar.db.metric.MetricDto in project sonarqube by SonarSource.
the class ProjectMeasuresIndexerIteratorTest method return_project_measure_having_leak.
@Test
public void return_project_measure_having_leak() throws Exception {
MetricDto metric = insertIntMetric("new_lines");
ComponentDto project = newProjectDto(dbTester.getDefaultOrganization());
SnapshotDto analysis = dbTester.components().insertProjectAndSnapshot(project);
insertMeasureOnLeak(project, analysis, metric, 10d);
Map<String, ProjectMeasures> docsById = createResultSetAndReturnDocsById();
assertThat(docsById.get(project.uuid()).getMeasures().getNumericMeasures()).containsOnly(entry("new_lines", 10d));
}
use of org.sonar.db.metric.MetricDto in project sonarqube by SonarSource.
the class ProjectMeasuresIndexerIteratorTest method fail_when_measure_return_no_value.
@Test
public void fail_when_measure_return_no_value() throws Exception {
MetricDto metric = insertIntMetric("new_lines");
ComponentDto project = newProjectDto(dbTester.getDefaultOrganization());
SnapshotDto analysis = dbTester.components().insertProjectAndSnapshot(project);
insertMeasure(project, analysis, metric, 10d);
expectedException.expect(IllegalStateException.class);
createResultSetAndReturnDocsById();
}
use of org.sonar.db.metric.MetricDto in project sonarqube by SonarSource.
the class ProjectMeasuresIndexerIteratorTest method return_language_distribution_measure.
@Test
public void return_language_distribution_measure() throws Exception {
MetricDto metric = insertMetric("ncloc_language_distribution", DATA);
ComponentDto project = newProjectDto(dbTester.getDefaultOrganization());
SnapshotDto analysis = dbTester.components().insertProjectAndSnapshot(project);
insertMeasure(project, analysis, metric, "<null>=2;java=6;xoo=18");
Map<String, ProjectMeasures> docsById = createResultSetAndReturnDocsById();
assertThat(docsById.get(project.uuid()).getMeasures().getLanguages()).containsOnly("<null>", "java", "xoo");
}
Aggregations