Search in sources :

Example 11 with VisitorsCrawler

use of org.sonar.ce.task.projectanalysis.component.VisitorsCrawler in project sonarqube by SonarSource.

the class NewMaintainabilityMeasuresVisitorTest method setUp.

@Before
public void setUp() {
    when(ratingSettings.getDebtRatingGrid()).thenReturn(new DebtRatingGrid(RATING_GRID));
    underTest = new VisitorsCrawler(Arrays.asList(new NewMaintainabilityMeasuresVisitor(metricRepository, measureRepository, newLinesRepository, ratingSettings)));
}
Also used : VisitorsCrawler(org.sonar.ce.task.projectanalysis.component.VisitorsCrawler) DebtRatingGrid(org.sonar.server.measure.DebtRatingGrid) Before(org.junit.Before)

Example 12 with VisitorsCrawler

use of org.sonar.ce.task.projectanalysis.component.VisitorsCrawler in project sonarqube by SonarSource.

the class LastCommitVisitorTest method compute_date_of_file_from_scm_repo.

@Test
public void compute_date_of_file_from_scm_repo() {
    VisitorsCrawler underTest = new VisitorsCrawler(Lists.newArrayList(new LastCommitVisitor(metricRepository, measureRepository, scmInfoRepository)));
    scmInfoRepository.setScmInfo(FILE_1_REF, Changeset.newChangesetBuilder().setAuthor("john").setDate(1_500_000_000_000L).setRevision("rev-1").build(), Changeset.newChangesetBuilder().setAuthor("tom").setDate(1_600_000_000_000L).setRevision("rev-2").build(), Changeset.newChangesetBuilder().setAuthor("john").setDate(1_500_000_000_000L).setRevision("rev-1").build());
    ReportComponent file = createFileComponent(FILE_1_REF);
    treeRootHolder.setRoot(file);
    underTest.visit(file);
    assertDate(FILE_1_REF, 1_600_000_000_000L);
}
Also used : VisitorsCrawler(org.sonar.ce.task.projectanalysis.component.VisitorsCrawler) ReportComponent(org.sonar.ce.task.projectanalysis.component.ReportComponent) Test(org.junit.Test)

Example 13 with VisitorsCrawler

use of org.sonar.ce.task.projectanalysis.component.VisitorsCrawler in project sonarqube by SonarSource.

the class LastCommitVisitorTest method date_is_not_computed_on_file_if_blame_is_not_in_scm_repo.

@Test
public void date_is_not_computed_on_file_if_blame_is_not_in_scm_repo() {
    VisitorsCrawler underTest = new VisitorsCrawler(Lists.newArrayList(new LastCommitVisitor(metricRepository, measureRepository, scmInfoRepository)));
    ReportComponent file = createFileComponent(FILE_1_REF);
    treeRootHolder.setRoot(file);
    underTest.visit(file);
    Optional<Measure> measure = measureRepository.getAddedRawMeasure(FILE_1_REF, LAST_COMMIT_DATE_KEY);
    assertThat(measure).isEmpty();
}
Also used : VisitorsCrawler(org.sonar.ce.task.projectanalysis.component.VisitorsCrawler) Measure(org.sonar.ce.task.projectanalysis.measure.Measure) ReportComponent(org.sonar.ce.task.projectanalysis.component.ReportComponent) Test(org.junit.Test)

Example 14 with VisitorsCrawler

use of org.sonar.ce.task.projectanalysis.component.VisitorsCrawler in project sonarqube by SonarSource.

the class ExecuteVisitorsStep method execute.

@Override
public void execute(ComputationStep.Context context) {
    VisitorsCrawler visitorsCrawler = new VisitorsCrawler(visitors, LOGGER.isDebugEnabled());
    visitorsCrawler.visit(treeRootHolder.getRoot());
    logVisitorExecutionDurations(visitors, visitorsCrawler);
}
Also used : VisitorsCrawler(org.sonar.ce.task.projectanalysis.component.VisitorsCrawler)

Aggregations

VisitorsCrawler (org.sonar.ce.task.projectanalysis.component.VisitorsCrawler)14 Test (org.junit.Test)10 Before (org.junit.Before)3 ReportComponent (org.sonar.ce.task.projectanalysis.component.ReportComponent)3 ViewsComponent (org.sonar.ce.task.projectanalysis.component.ViewsComponent)2 DebtRatingGrid (org.sonar.server.measure.DebtRatingGrid)2 MeasureComputer (org.sonar.api.ce.measure.MeasureComputer)1 MeasureComputerDefinitionImpl (org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerDefinitionImpl)1 MeasureComputerWrapper (org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper)1 Component (org.sonar.ce.task.projectanalysis.component.Component)1 Measure (org.sonar.ce.task.projectanalysis.measure.Measure)1