Search in sources :

Example 6 with TextBlock

use of org.sonar.server.computation.task.projectanalysis.duplication.TextBlock in project sonarqube by SonarSource.

the class NewSizeMeasuresStepTest method compute_duplicated_blocks_one_for_original_and_ignores_CrossProjectDuplicate.

@Test
public void compute_duplicated_blocks_one_for_original_and_ignores_CrossProjectDuplicate() {
    duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), SOME_FILE_KEY, new TextBlock(2, 2));
    setChangesets(FILE_1_REF);
    underTest.execute();
    assertRawMeasureValueOnPeriod(FILE_1_REF, NEW_BLOCKS_DUPLICATED_KEY, 1);
}
Also used : TextBlock(org.sonar.server.computation.task.projectanalysis.duplication.TextBlock) Test(org.junit.Test)

Example 7 with TextBlock

use of org.sonar.server.computation.task.projectanalysis.duplication.TextBlock in project sonarqube by SonarSource.

the class ReportDuplicationMeasuresStepTest method compute_duplicated_blocks_one_for_original_and_ignores_CrossProjectDuplicate.

@Test
public void compute_duplicated_blocks_one_for_original_and_ignores_CrossProjectDuplicate() {
    duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), SOME_FILE_KEY, new TextBlock(2, 2));
    underTest.execute();
    assertRawMeasureValue(FILE_1_REF, DUPLICATED_BLOCKS_KEY, 1);
}
Also used : TextBlock(org.sonar.server.computation.task.projectanalysis.duplication.TextBlock) Test(org.junit.Test)

Example 8 with TextBlock

use of org.sonar.server.computation.task.projectanalysis.duplication.TextBlock in project sonarqube by SonarSource.

the class ReportDuplicationMeasuresStepTest method compute_duplicated_blocks_does_not_count_blocks_only_once_it_assumes_consistency_from_duplication_data.

@Test
public void compute_duplicated_blocks_does_not_count_blocks_only_once_it_assumes_consistency_from_duplication_data() {
    duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(1, 1), new TextBlock(3, 3));
    duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(2, 2), new TextBlock(3, 3));
    underTest.execute();
    assertRawMeasureValue(FILE_1_REF, DUPLICATED_BLOCKS_KEY, 4);
}
Also used : TextBlock(org.sonar.server.computation.task.projectanalysis.duplication.TextBlock) Test(org.junit.Test)

Example 9 with TextBlock

use of org.sonar.server.computation.task.projectanalysis.duplication.TextBlock in project sonarqube by SonarSource.

the class ReportDuplicationMeasuresStepTest method compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate_only_once.

@Test
public void compute_duplicated_lines_counts_lines_from_original_and_InnerDuplicate_only_once() {
    TextBlock original = new TextBlock(1, 12);
    duplicationRepository.addDuplication(FILE_1_REF, original, new TextBlock(10, 11), new TextBlock(11, 15));
    duplicationRepository.addDuplication(FILE_1_REF, new TextBlock(2, 2), new TextBlock(96, 96));
    underTest.execute();
    assertRawMeasureValue(FILE_1_REF, DUPLICATED_LINES_KEY, 16);
}
Also used : TextBlock(org.sonar.server.computation.task.projectanalysis.duplication.TextBlock) Test(org.junit.Test)

Example 10 with TextBlock

use of org.sonar.server.computation.task.projectanalysis.duplication.TextBlock in project sonarqube by SonarSource.

the class ReportDuplicationMeasuresStepTest method compute_duplicated_lines_counts_lines_from_original_and_ignores_InProjectDuplicate.

@Test
public void compute_duplicated_lines_counts_lines_from_original_and_ignores_InProjectDuplicate() {
    TextBlock original = new TextBlock(1, 1);
    duplicationRepository.addDuplication(FILE_1_REF, original, FILE_2_REF, new TextBlock(2, 2));
    underTest.execute();
    assertRawMeasureValue(FILE_1_REF, DUPLICATED_LINES_KEY, 1);
}
Also used : TextBlock(org.sonar.server.computation.task.projectanalysis.duplication.TextBlock) Test(org.junit.Test)

Aggregations

TextBlock (org.sonar.server.computation.task.projectanalysis.duplication.TextBlock)26 Test (org.junit.Test)24 DbFileSources (org.sonar.db.protobuf.DbFileSources)1 FileSourceDto (org.sonar.db.source.FileSourceDto)1 CrossProjectDuplicate (org.sonar.server.computation.task.projectanalysis.duplication.CrossProjectDuplicate)1 Duplicate (org.sonar.server.computation.task.projectanalysis.duplication.Duplicate)1 Duplication (org.sonar.server.computation.task.projectanalysis.duplication.Duplication)1 InProjectDuplicate (org.sonar.server.computation.task.projectanalysis.duplication.InProjectDuplicate)1 InnerDuplicate (org.sonar.server.computation.task.projectanalysis.duplication.InnerDuplicate)1