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)));
}
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);
}
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();
}
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);
}
Aggregations