use of org.sonar.server.computation.task.projectanalysis.component.Developer in project sonarqube by SonarSource.
the class MeasureToMeasureDto method toMeasureDto.
@Nonnull
public MeasureDto toMeasureDto(Measure measure, Metric metric, Component component) {
MeasureDto out = new MeasureDto();
out.setMetricId(metric.getId());
out.setComponentUuid(component.getUuid());
out.setAnalysisUuid(analysisMetadataHolder.getUuid());
if (measure.hasVariation()) {
out.setVariation(measure.getVariation());
}
if (measure.hasQualityGateStatus()) {
setAlert(out, measure.getQualityGateStatus());
}
Developer developer = measure.getDeveloper();
if (developer != null) {
out.setDeveloperId(dbIdsRepository.getDeveloperId(developer));
}
out.setDescription(measure.getDescription());
out.setValue(valueAsDouble(measure));
out.setData(data(measure));
return out;
}
use of org.sonar.server.computation.task.projectanalysis.component.Developer in project sonarqube by SonarSource.
the class MeasureToMeasureDtoTest method toMeasureDto_sets_developerId_if_set_in_Measure.
@Test
public void toMeasureDto_sets_developerId_if_set_in_Measure() {
Developer developer = new DumbDeveloper("DEV1");
dbIdsRepository.setDeveloperId(developer, 42);
Measure measure = Measure.newMeasureBuilder().forDeveloper(developer).createNoValue();
assertThat(underTest.toMeasureDto(measure, SOME_BOOLEAN_METRIC, SOME_COMPONENT).getDeveloperId()).isEqualTo(42);
}
use of org.sonar.server.computation.task.projectanalysis.component.Developer in project sonarqube by SonarSource.
the class PersistMeasuresStepTest method insert_developer_measure_from_report.
@Test
public void insert_developer_measure_from_report() {
setupReportComponents();
metricRepository.add(1, INT_METRIC);
Developer developer = new DumbDeveloper("DEV1");
dbIdsRepository.setDeveloperId(developer, 10);
measureRepository.addRawMeasure(ROOT_REF, INT_METRIC_KEY, newMeasureBuilder().forDeveloper(developer).create(1));
underTest.execute();
assertThat(dbTester.countRowsOfTable("project_measures")).isEqualTo(1);
List<Map<String, Object>> dtos = selectSnapshots();
Map<String, Object> dto = dtos.get(0);
assertValue(dto, 1d);
assertThat(dto.get("developerId")).isEqualTo(10L);
}
Aggregations