Search in sources :

Example 1 with DumbDeveloper

use of org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper 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);
}
Also used : DumbDeveloper(org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper) Developer(org.sonar.server.computation.task.projectanalysis.component.Developer) DumbDeveloper(org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper) Test(org.junit.Test)

Example 2 with DumbDeveloper

use of org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper 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);
}
Also used : Developer(org.sonar.server.computation.task.projectanalysis.component.Developer) DumbDeveloper(org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper) DumbDeveloper(org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper) Map(java.util.Map) Test(org.junit.Test)

Example 3 with DumbDeveloper

use of org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper in project sonarqube by SonarSource.

the class ReportComputeMeasureVariationsStepTest method do_not_set_variation_on_numeric_metric_for_developer.

@Test
public void do_not_set_variation_on_numeric_metric_for_developer() {
    SnapshotDto period1ProjectSnapshot = newAnalysis(project);
    dbClient.snapshotDao().insert(session, period1ProjectSnapshot);
    dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), PROJECT_UUID, period1ProjectSnapshot.getUuid(), 60d));
    session.commit();
    periodsHolder.setPeriod(newPeriod(period1ProjectSnapshot));
    treeRootHolder.setRoot(PROJECT);
    DumbDeveloper developer = new DumbDeveloper("a");
    measureRepository.addRawMeasure(PROJECT_REF, ISSUES_METRIC.getKey(), newMeasureBuilder().forDeveloper(developer).create(80, null));
    underTest.execute();
    assertThat(measureRepository.getRawMeasures(PROJECT).keys()).hasSize(1);
    assertThat(measureRepository.getRawMeasure(PROJECT, ISSUES_METRIC, developer).get().hasVariation()).isFalse();
}
Also used : SnapshotDto(org.sonar.db.component.SnapshotDto) DumbDeveloper(org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 DumbDeveloper (org.sonar.server.computation.task.projectanalysis.component.DumbDeveloper)3 Developer (org.sonar.server.computation.task.projectanalysis.component.Developer)2 Map (java.util.Map)1 SnapshotDto (org.sonar.db.component.SnapshotDto)1