diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-11-10 17:44:56 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-11-12 11:01:30 +0100 |
commit | dd16b88717a81272e50624bd60ece463fae8ec76 (patch) | |
tree | 1c175d39a49d588be5bd4eec3e75f458314747c9 /sonar-batch-protocol/src | |
parent | cefeabcce2dc82c4987e2337df8075647a70f3e6 (diff) | |
download | sonarqube-dd16b88717a81272e50624bd60ece463fae8ec76.tar.gz sonarqube-dd16b88717a81272e50624bd60ece463fae8ec76.zip |
SONAR-6993 Rename DuplicationBlock into CpdTextBlock
Diffstat (limited to 'sonar-batch-protocol/src')
6 files changed, 18 insertions, 18 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java index 786fcaaa9fb..89af7f43e74 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java @@ -91,10 +91,10 @@ public class BatchReportReader { return emptyCloseableIterator(); } - public CloseableIterator<BatchReport.DuplicationBlock> readComponentDuplicationBlocks(int componentRef) { - File file = fileStructure.fileFor(FileStructure.Domain.DUPLICATION_BLOCKS, componentRef); + public CloseableIterator<BatchReport.CpdTextBlock> readCpdTextBlocks(int componentRef) { + File file = fileStructure.fileFor(FileStructure.Domain.CPD_TEXT_BLOCKS, componentRef); if (fileExists(file)) { - return Protobuf.readStream(file, BatchReport.DuplicationBlock.parser()); + return Protobuf.readStream(file, BatchReport.CpdTextBlock.parser()); } return emptyCloseableIterator(); } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java index 224bfdd6935..7faabbb2d15 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java @@ -98,9 +98,9 @@ public class BatchReportWriter { return file; } - public File writeDuplicationBlocks(int componentRef, Iterable<BatchReport.DuplicationBlock> duplicationBlocks) { - File file = fileStructure.fileFor(FileStructure.Domain.DUPLICATION_BLOCKS, componentRef); - Protobuf.writeStream(duplicationBlocks, file, false); + public File writeCpdTextBlocks(int componentRef, Iterable<BatchReport.CpdTextBlock> blocks) { + File file = fileStructure.fileFor(FileStructure.Domain.CPD_TEXT_BLOCKS, componentRef); + Protobuf.writeStream(blocks, file, false); return file; } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java index 23575dcdec6..9f4e8014e11 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java @@ -31,7 +31,7 @@ public class FileStructure { COMPONENT("component-", Domain.PB), MEASURES("measures-", Domain.PB), DUPLICATIONS("duplications-", Domain.PB), - DUPLICATION_BLOCKS("duplication-blocks-", Domain.PB), + CPD_TEXT_BLOCKS("cpd-text-block-", Domain.PB), SYNTAX_HIGHLIGHTINGS("syntax-highlightings-", Domain.PB), CHANGESETS("changesets-", Domain.PB), SYMBOLS("symbols-", Domain.PB), diff --git a/sonar-batch-protocol/src/main/protobuf/batch_report.proto b/sonar-batch-protocol/src/main/protobuf/batch_report.proto index 7937353fe9f..ae012d0fc2d 100644 --- a/sonar-batch-protocol/src/main/protobuf/batch_report.proto +++ b/sonar-batch-protocol/src/main/protobuf/batch_report.proto @@ -143,7 +143,7 @@ message Duplication { } // Used for cross project duplication -message DuplicationBlock { +message CpdTextBlock { repeated int32 hash = 1 [packed = true]; optional int32 start_line = 2; optional int32 end_line = 3; diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java index 3c2c5ac5da9..1cd26e0a34b 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java @@ -180,17 +180,17 @@ public class BatchReportReaderTest { writer.writeComponent(BatchReport.Component.newBuilder() .setRef(1).build()); - BatchReport.DuplicationBlock duplicationBlock = BatchReport.DuplicationBlock.newBuilder() + BatchReport.CpdTextBlock duplicationBlock = BatchReport.CpdTextBlock.newBuilder() .addAllHash(asList(1, 2, 3, 5, 7)) .setStartLine(1) .setEndLine(2) .setStartTokenIndex(10) .setEndTokenIndex(15) .build(); - writer.writeDuplicationBlocks(1, singletonList(duplicationBlock)); + writer.writeCpdTextBlocks(1, singletonList(duplicationBlock)); BatchReportReader sut = new BatchReportReader(dir); - assertThat(sut.readComponentDuplicationBlocks(1)).hasSize(1); + assertThat(sut.readCpdTextBlocks(1)).hasSize(1); } @Test diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java index fdd1ba2b67b..13f0765c83e 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java @@ -191,22 +191,22 @@ public class BatchReportWriterTest { @Test public void write_duplication_blocks() { - assertThat(underTest.hasComponentData(FileStructure.Domain.DUPLICATION_BLOCKS, 1)).isFalse(); + assertThat(underTest.hasComponentData(FileStructure.Domain.CPD_TEXT_BLOCKS, 1)).isFalse(); - BatchReport.DuplicationBlock duplicationBlock = BatchReport.DuplicationBlock.newBuilder() + BatchReport.CpdTextBlock duplicationBlock = BatchReport.CpdTextBlock.newBuilder() .addAllHash(asList(1, 2, 3, 5, 7)) .setStartLine(1) .setEndLine(2) .setStartTokenIndex(10) .setEndTokenIndex(15) .build(); - underTest.writeDuplicationBlocks(1, asList(duplicationBlock)); + underTest.writeCpdTextBlocks(1, asList(duplicationBlock)); - assertThat(underTest.hasComponentData(FileStructure.Domain.DUPLICATION_BLOCKS, 1)).isTrue(); - File file = underTest.getFileStructure().fileFor(FileStructure.Domain.DUPLICATION_BLOCKS, 1); + assertThat(underTest.hasComponentData(FileStructure.Domain.CPD_TEXT_BLOCKS, 1)).isTrue(); + File file = underTest.getFileStructure().fileFor(FileStructure.Domain.CPD_TEXT_BLOCKS, 1); assertThat(file).exists().isFile(); - try (CloseableIterator<BatchReport.DuplicationBlock> duplicationBlocks = Protobuf.readStream(file, BatchReport.DuplicationBlock.parser())) { - BatchReport.DuplicationBlock duplicationBlockResult = duplicationBlocks.next(); + try (CloseableIterator<BatchReport.CpdTextBlock> duplicationBlocks = Protobuf.readStream(file, BatchReport.CpdTextBlock.parser())) { + BatchReport.CpdTextBlock duplicationBlockResult = duplicationBlocks.next(); assertThat(duplicationBlockResult.getHashList()).containsOnly(1, 2, 3, 5, 7); assertThat(duplicationBlockResult.getStartLine()).isEqualTo(1); assertThat(duplicationBlockResult.getEndLine()).isEqualTo(2); |