use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method set_base_project_snapshot_when_last_snapshot_exist.
@Test
public void set_base_project_snapshot_when_last_snapshot_exist() {
setAnalysisMetadataHolder();
ComponentDto project = insertComponent(newPrivateProjectDto("ABCD").setDbKey(REPORT_PROJECT_KEY));
insertSnapshot(newAnalysis(project).setLast(true));
reportReader.putComponent(component(ROOT_REF, PROJECT, REPORT_PROJECT_KEY));
underTest.execute(new TestComputationStepContext());
assertThat(analysisMetadataHolder.isFirstAnalysis()).isFalse();
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method set_no_base_project_snapshot_when_no_snapshot.
@Test
public void set_no_base_project_snapshot_when_no_snapshot() {
setAnalysisMetadataHolder();
reportReader.putComponent(component(ROOT_REF, PROJECT, REPORT_PROJECT_KEY));
underTest.execute(new TestComputationStepContext());
assertThat(analysisMetadataHolder.isFirstAnalysis()).isTrue();
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method compute_keys_and_uuids_on_multi_modules.
@Test
public void compute_keys_and_uuids_on_multi_modules() {
setAnalysisMetadataHolder();
reportReader.putComponent(component(ROOT_REF, PROJECT, REPORT_PROJECT_KEY, FILE_1_REF));
reportReader.putComponent(componentWithPath(FILE_1_REF, FILE, REPORT_FILE_PATH_1));
underTest.execute(new TestComputationStepContext());
verifyComponentByRef(ROOT_REF, REPORT_PROJECT_KEY, analysisMetadataHolder.getProject().getName());
verifyComponentByKey(REPORT_PROJECT_KEY + ":" + REPORT_DIR_PATH_1, REPORT_DIR_PATH_1);
verifyComponentByRef(FILE_1_REF, REPORT_PROJECT_KEY + ":" + REPORT_FILE_PATH_1, REPORT_FILE_NAME_1);
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method return_existing_uuids.
@Test
public void return_existing_uuids() {
setAnalysisMetadataHolder();
ComponentDto project = insertComponent(newPrivateProjectDto("ABCD").setDbKey(REPORT_PROJECT_KEY));
ComponentDto directory = newDirectory(project, "CDEF", REPORT_DIR_PATH_1);
insertComponent(directory.setDbKey(REPORT_PROJECT_KEY + ":" + REPORT_DIR_PATH_1));
insertComponent(newFileDto(project, directory, "DEFG").setDbKey(REPORT_PROJECT_KEY + ":" + REPORT_FILE_PATH_1).setPath(REPORT_FILE_PATH_1));
// new structure, without modules
reportReader.putComponent(component(ROOT_REF, PROJECT, REPORT_PROJECT_KEY, FILE_1_REF));
reportReader.putComponent(componentWithPath(FILE_1_REF, FILE, REPORT_FILE_PATH_1));
underTest.execute(new TestComputationStepContext());
verifyComponentByRef(ROOT_REF, REPORT_PROJECT_KEY, analysisMetadataHolder.getProject().getName(), "ABCD");
verifyComponentByKey(REPORT_PROJECT_KEY + ":" + REPORT_DIR_PATH_1, REPORT_PROJECT_KEY + ":" + REPORT_DIR_PATH_1, REPORT_DIR_PATH_1, "CDEF");
verifyComponentByRef(FILE_1_REF, REPORT_PROJECT_KEY + ":" + REPORT_FILE_PATH_1, REPORT_FILE_NAME_1, "DEFG");
}
use of org.sonar.ce.task.step.TestComputationStepContext in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method set_no_base_project_snapshot_when_no_last_snapshot.
@Test
public void set_no_base_project_snapshot_when_no_last_snapshot() {
setAnalysisMetadataHolder();
ComponentDto project = insertComponent(newPrivateProjectDto("ABCD").setDbKey(REPORT_PROJECT_KEY));
insertSnapshot(newAnalysis(project).setLast(false));
reportReader.putComponent(component(ROOT_REF, PROJECT, REPORT_PROJECT_KEY));
underTest.execute(new TestComputationStepContext());
assertThat(analysisMetadataHolder.isFirstAnalysis()).isTrue();
}
Aggregations