use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_does_not_fail_when_report_has_a_quality_profile_that_does_not_exist_anymore.
@Test
public void execute_does_not_fail_when_report_has_a_quality_profile_that_does_not_exist_anymore() {
ComponentDto project = db.components().insertPublicProject();
ScannerReport.Metadata.Builder metadataBuilder = newBatchReportBuilder();
metadataBuilder.setProjectKey(project.getDbKey());
metadataBuilder.putQprofilesPerLanguage("js", ScannerReport.Metadata.QProfile.newBuilder().setKey("p1").setName("Sonar way").setLanguage("js").build());
reportReader.setMetadata(metadataBuilder.build());
ComputationStep underTest = createStep(createCeTask(project.getDbKey()));
underTest.execute(new TestComputationStepContext());
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method set_root_component_ref.
@Test
public void set_root_component_ref() {
reportReader.setMetadata(newBatchReportBuilder().setRootComponentRef(1).build());
underTest.execute(new TestComputationStepContext());
assertThat(analysisMetadataHolder.getRootComponentRef()).isOne();
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_fails_with_ISE_if_component_is_null_in_CE_task.
@Test
public void execute_fails_with_ISE_if_component_is_null_in_CE_task() {
CeTask res = mock(CeTask.class);
when(res.getComponent()).thenReturn(Optional.empty());
reportReader.setMetadata(ScannerReport.Metadata.newBuilder().build());
ComputationStep underTest = createStep(res);
assertThatThrownBy(() -> underTest.execute(new TestComputationStepContext())).isInstanceOf(IllegalStateException.class).hasMessage("component missing on ce task");
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method set_cross_project_duplication_to_false_when_nothing_in_the_report.
@Test
public void set_cross_project_duplication_to_false_when_nothing_in_the_report() {
reportReader.setMetadata(newBatchReportBuilder().build());
underTest.execute(new TestComputationStepContext());
assertThat(analysisMetadataHolder.isCrossProjectDuplicationEnabled()).isFalse();
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class NewSizeMeasuresStepTest method compute_no_new_duplicated_lines_density_when_no_lines.
@Test
public void compute_no_new_duplicated_lines_density_when_no_lines() {
underTest.execute(new TestComputationStepContext());
assertNoRawMeasures(NEW_DUPLICATED_LINES_DENSITY_KEY);
}
Aggregations