use of org.sonar.ce.task.projectanalysis.period.Period in project sonarqube by SonarSource.
the class NewLinesRepositoryTest method return_empty_if_no_report_and_no_scm_info.
@Test
public void return_empty_if_no_report_and_no_scm_info() {
periodHolder.setPeriod(new Period("", null, 1000L));
Optional<Set<Integer>> newLines = repository.getNewLines(FILE);
assertThat(newLines).isNotPresent();
assertThat(repository.newLinesAvailable()).isTrue();
}
use of org.sonar.ce.task.projectanalysis.period.Period in project sonarqube by SonarSource.
the class LoadPeriodsStep method execute.
@Override
public void execute(ComputationStep.Context context) {
if (!analysisMetadataHolder.isBranch()) {
periodsHolder.setPeriod(null);
return;
}
String projectUuid = getProjectBranchUuid();
String branchUuid = treeRootHolder.getRoot().getUuid();
String projectVersion = treeRootHolder.getRoot().getProjectAttributes().getProjectVersion();
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<NewCodePeriodDto> dto = firstPresent(Arrays.asList(() -> getBranchSetting(dbSession, projectUuid, branchUuid), () -> getProjectSetting(dbSession, projectUuid), () -> getGlobalSetting(dbSession)));
NewCodePeriodDto newCodePeriod = dto.orElse(NewCodePeriodDto.defaultInstance());
if (analysisMetadataHolder.isFirstAnalysis() && newCodePeriod.getType() != NewCodePeriodType.REFERENCE_BRANCH) {
periodsHolder.setPeriod(null);
return;
}
Period period = resolver.resolve(dbSession, branchUuid, newCodePeriod, projectVersion);
periodsHolder.setPeriod(period);
}
}
Aggregations