aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-11-10 17:29:52 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-11-12 11:01:30 +0100
commitc20343073c1c3ba5356db69a9c1a040cab339fa1 (patch)
tree6004d5f70eac2c329ace178a2197dec29f190a89 /sonar-batch-protocol/src
parentdd16b88717a81272e50624bd60ece463fae8ec76 (diff)
downloadsonarqube-c20343073c1c3ba5356db69a9c1a040cab339fa1.tar.gz
sonarqube-c20343073c1c3ba5356db69a9c1a040cab339fa1.zip
SONAR-6993 Replace hash of CpdTextBlock from a list of int to a string
Having a the hash represented as a list of int in the report brings too much complexity in the compute engine, as we need only a string.
Diffstat (limited to 'sonar-batch-protocol/src')
-rw-r--r--sonar-batch-protocol/src/main/protobuf/batch_report.proto2
-rw-r--r--sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java2
-rw-r--r--sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportWriterTest.java4
3 files changed, 4 insertions, 4 deletions
diff --git a/sonar-batch-protocol/src/main/protobuf/batch_report.proto b/sonar-batch-protocol/src/main/protobuf/batch_report.proto
index ae012d0fc2d..2913e856fb2 100644
--- a/sonar-batch-protocol/src/main/protobuf/batch_report.proto
+++ b/sonar-batch-protocol/src/main/protobuf/batch_report.proto
@@ -144,7 +144,7 @@ message Duplication {
// Used for cross project duplication
message CpdTextBlock {
- repeated int32 hash = 1 [packed = true];
+ optional string hash = 1;
optional int32 start_line = 2;
optional int32 end_line = 3;
optional int32 start_token_index = 4;
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 1cd26e0a34b..8a1d8f126da 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
@@ -181,7 +181,7 @@ public class BatchReportReaderTest {
.setRef(1).build());
BatchReport.CpdTextBlock duplicationBlock = BatchReport.CpdTextBlock.newBuilder()
- .addAllHash(asList(1, 2, 3, 5, 7))
+ .setHash("abcdefghijklmnop")
.setStartLine(1)
.setEndLine(2)
.setStartTokenIndex(10)
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 13f0765c83e..9af4b5dd6a6 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
@@ -194,7 +194,7 @@ public class BatchReportWriterTest {
assertThat(underTest.hasComponentData(FileStructure.Domain.CPD_TEXT_BLOCKS, 1)).isFalse();
BatchReport.CpdTextBlock duplicationBlock = BatchReport.CpdTextBlock.newBuilder()
- .addAllHash(asList(1, 2, 3, 5, 7))
+ .setHash("abcdefghijklmnop")
.setStartLine(1)
.setEndLine(2)
.setStartTokenIndex(10)
@@ -207,7 +207,7 @@ public class BatchReportWriterTest {
assertThat(file).exists().isFile();
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.getHash()).isEqualTo("abcdefghijklmnop");
assertThat(duplicationBlockResult.getStartLine()).isEqualTo(1);
assertThat(duplicationBlockResult.getEndLine()).isEqualTo(2);
assertThat(duplicationBlockResult.getStartTokenIndex()).isEqualTo(10);