use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class ViewsPersistAnalysisStepTest method persist_snapshots_with_new_code_period.
@Test
public void persist_snapshots_with_new_code_period() {
ComponentDto viewDto = save(ComponentTesting.newPortfolio("UUID_VIEW").setDbKey("KEY_VIEW"));
ComponentDto subViewDto = save(ComponentTesting.newSubPortfolio(viewDto, "UUID_SUBVIEW", "KEY_SUBVIEW"));
dbTester.getSession().commit();
Component subView = ViewsComponent.builder(SUBVIEW, "KEY_SUBVIEW").setUuid("UUID_SUBVIEW").build();
Component view = ViewsComponent.builder(VIEW, "KEY_VIEW").setUuid("UUID_VIEW").addChildren(subView).build();
treeRootHolder.setRoot(view);
periodsHolder.setPeriod(new Period("NUMBER_OF_DAYS", "30", analysisDate));
underTest.execute(new TestComputationStepContext());
SnapshotDto viewSnapshot = getUnprocessedSnapshot(viewDto.uuid());
assertThat(viewSnapshot.getPeriodMode()).isEqualTo("NUMBER_OF_DAYS");
assertThat(viewSnapshot.getPeriodDate()).isEqualTo(analysisDate);
assertThat(viewSnapshot.getPeriodModeParameter()).isNotNull();
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class IndexAnalysisStepTest method call_indexByProjectUuid_of_indexer_for_project.
@Test
public void call_indexByProjectUuid_of_indexer_for_project() {
Component project = ReportComponent.builder(PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build();
treeRootHolder.setRoot(project);
underTest.execute(new TestComputationStepContext());
verify(componentIndexer).indexOnAnalysis(PROJECT_UUID);
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class IndexAnalysisStepTest method call_indexByProjectUuid_of_indexer_for_view.
@Test
public void call_indexByProjectUuid_of_indexer_for_view() {
Component view = ViewsComponent.builder(VIEW, PROJECT_KEY).setUuid(PROJECT_UUID).build();
treeRootHolder.setRoot(view);
underTest.execute(new TestComputationStepContext());
verify(componentIndexer).indexOnAnalysis(PROJECT_UUID);
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class SmallChangesetQualityGateSpecialCaseTest method should_not_change_green_conditions.
@Test
public void should_not_change_green_conditions() {
QualityGateMeasuresStep.MetricEvaluationResult metricEvaluationResult = generateEvaluationResult(NEW_BUGS_KEY, OK);
Component project = generateNewRootProject();
measureRepository.addRawMeasure(PROJECT_REF, CoreMetrics.NEW_LINES_KEY, newMeasureBuilder().setVariation(19).create(1000));
boolean result = underTest.appliesTo(project, metricEvaluationResult);
assertThat(result).isFalse();
}
use of org.sonar.ce.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class SmallChangesetQualityGateSpecialCaseTest method dont_ignore_errors_about_new_coverage_for_small_changesets_if_disabled.
@Test
public void dont_ignore_errors_about_new_coverage_for_small_changesets_if_disabled() {
mapSettings.setProperty(CoreProperties.QUALITY_GATE_IGNORE_SMALL_CHANGES, false);
QualityGateMeasuresStep.MetricEvaluationResult metricEvaluationResult = generateEvaluationResult(NEW_COVERAGE_KEY, ERROR);
Component project = generateNewRootProject();
measureRepository.addRawMeasure(PROJECT_REF, CoreMetrics.NEW_LINES_KEY, newMeasureBuilder().setVariation(19).create(1000));
boolean result = underTest.appliesTo(project, metricEvaluationResult);
assertThat(result).isFalse();
}
Aggregations