use of org.sonar.server.computation.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class ComponentIssuesRepositoryRule method getIssues.
public List<DefaultIssue> getIssues(int componentRef) {
checkState(this.component != null && this.issues != null, "Issues have not been initialized");
Component component = treeRootHolder.getComponentByRef(componentRef);
checkArgument(component != null, String.format("Component '%s' does not exists in the report ", componentRef));
checkArgument(component == this.component, String.format("Only issues from component '%s' are available, but wanted component is '%s'.", this.component.getReportAttributes().getRef(), component.getReportAttributes().getRef()));
return issues;
}
use of org.sonar.server.computation.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method verify_ref_and_type.
@Test
@UseDataProvider("allComponentTypes")
public void verify_ref_and_type(ComponentType componentType) {
int componentRef = 1;
reportReader.putComponent(component(componentRef, componentType));
underTest.execute();
Component root = treeRootHolder.getRoot();
assertThat(root).isNotNull();
assertThat(root.getType()).isEqualTo(Component.Type.valueOf(componentType.name()));
assertThat(root.getReportAttributes().getRef()).isEqualTo(ROOT_REF);
assertThat(root.getChildren()).isEmpty();
}
use of org.sonar.server.computation.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();
verify(componentIndexer).indexProject(PROJECT_UUID, ProjectIndexer.Cause.NEW_ANALYSIS);
}
use of org.sonar.server.computation.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class LoadDuplicationsFromReportStepTest method loads_never_consider_originals_from_batch_on_same_lines_as_the_equals.
@Test
public void loads_never_consider_originals_from_batch_on_same_lines_as_the_equals() {
reportReader.putDuplications(FILE_2_REF, createDuplication(singleLineTextRange(LINE), createInnerDuplicate(LINE + 1), createInnerDuplicate(LINE + 2), createInProjectDuplicate(FILE_1_REF, LINE + 2)), createDuplication(singleLineTextRange(LINE), createInnerDuplicate(LINE + 2), createInnerDuplicate(LINE + 3), createInProjectDuplicate(FILE_1_REF, LINE + 2)));
underTest.execute();
Component file1Component = treeRootHolder.getComponentByRef(FILE_1_REF);
assertThat(duplicationRepository.getDuplications(FILE_2_REF)).containsOnly(duplication(singleLineDetailedTextBlock(1, LINE), new InnerDuplicate(singleLineTextBlock(LINE + 1)), new InnerDuplicate(singleLineTextBlock(LINE + 2)), new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 2))), duplication(singleLineDetailedTextBlock(2, LINE), new InnerDuplicate(singleLineTextBlock(LINE + 2)), new InnerDuplicate(singleLineTextBlock(LINE + 3)), new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 2))));
}
use of org.sonar.server.computation.task.projectanalysis.component.Component in project sonarqube by SonarSource.
the class PurgeDatastoresStepTest method do_not_call_purge_method_of_the_purge_task_for_other_report_components.
@Test
@UseDataProvider("nonRootProjectComponentTypes")
public void do_not_call_purge_method_of_the_purge_task_for_other_report_components(Component.Type type) {
Component component = ReportComponent.builder(type, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build();
verify_do_not_call_purge_method_of_the_purge_task(component);
}
Aggregations