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 | |
parent | cefeabcce2dc82c4987e2337df8075647a70f3e6 (diff) | |
download | sonarqube-dd16b88717a81272e50624bd60ece463fae8ec76.tar.gz sonarqube-dd16b88717a81272e50624bd60ece463fae8ec76.zip |
SONAR-6993 Rename DuplicationBlock into CpdTextBlock
Diffstat (limited to 'sonar-batch')
3 files changed, 9 insertions, 14 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/cpd/index/SonarDuplicationsIndex.java b/sonar-batch/src/main/java/org/sonar/batch/cpd/index/SonarDuplicationsIndex.java index 51a094a869e..ca331ebeb2c 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/cpd/index/SonarDuplicationsIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/cpd/index/SonarDuplicationsIndex.java @@ -28,7 +28,6 @@ import org.sonar.api.batch.fs.InputFile; import org.sonar.api.config.Settings; import org.sonar.batch.index.BatchComponentCache; import org.sonar.batch.protocol.output.BatchReport; -import org.sonar.batch.protocol.output.BatchReport.DuplicationBlock; import org.sonar.batch.report.ReportPublisher; import org.sonar.duplications.block.Block; import org.sonar.duplications.block.ByteArray; @@ -52,10 +51,10 @@ public class SonarDuplicationsIndex extends AbstractCloneIndex { public void insert(InputFile inputFile, Collection<Block> blocks) { if (isCrossProjectDuplicationEnabled(settings)) { int id = batchComponentCache.get(inputFile).batchId(); - final BatchReport.DuplicationBlock.Builder builder = BatchReport.DuplicationBlock.newBuilder(); - publisher.getWriter().writeDuplicationBlocks(id, Iterables.transform(blocks, new Function<Block, BatchReport.DuplicationBlock>() { + final BatchReport.CpdTextBlock.Builder builder = BatchReport.CpdTextBlock.newBuilder(); + publisher.getWriter().writeCpdTextBlocks(id, Iterables.transform(blocks, new Function<Block, BatchReport.CpdTextBlock>() { @Override - public DuplicationBlock apply(Block input) { + public BatchReport.CpdTextBlock apply(Block input) { builder.clear(); builder.setStartLine(input.getStartLine()); builder.setEndLine(input.getEndLine()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java index 2254fa0798f..d823886ad08 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java +++ b/sonar-batch/src/main/java/org/sonar/batch/mediumtest/TaskResult.java @@ -19,11 +19,8 @@ */ package org.sonar.batch.mediumtest; -import org.sonar.batch.issue.tracking.TrackedIssue; - import com.google.common.collect.Iterators; import com.google.common.collect.Lists; - import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; @@ -31,10 +28,8 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - import javax.annotation.CheckForNull; import javax.annotation.Nullable; - import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,6 +43,7 @@ import org.sonar.api.batch.fs.internal.DefaultInputDir; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.sensor.highlighting.TypeOfText; import org.sonar.batch.issue.IssueCache; +import org.sonar.batch.issue.tracking.TrackedIssue; import org.sonar.batch.protocol.output.BatchReport; import org.sonar.batch.protocol.output.BatchReport.Component; import org.sonar.batch.protocol.output.BatchReport.Metadata; @@ -231,10 +227,10 @@ public class TaskResult implements org.sonar.batch.mediumtest.ScanTaskObserver { return result; } - public List<BatchReport.DuplicationBlock> duplicationBlocksFor(InputFile file) { - List<BatchReport.DuplicationBlock> result = new ArrayList<>(); + public List<BatchReport.CpdTextBlock> duplicationBlocksFor(InputFile file) { + List<BatchReport.CpdTextBlock> result = new ArrayList<>(); int ref = reportComponents.get(((DefaultInputFile) file).key()).getRef(); - try (CloseableIterator<BatchReport.DuplicationBlock> it = getReportReader().readComponentDuplicationBlocks(ref)) { + try (CloseableIterator<BatchReport.CpdTextBlock> it = getReportReader().readCpdTextBlocks(ref)) { while (it.hasNext()) { result.add(it.next()); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cpd/CpdMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cpd/CpdMediumTest.java index 2e734e0063d..acc0f5255ac 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cpd/CpdMediumTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/cpd/CpdMediumTest.java @@ -37,7 +37,7 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.measures.CoreMetrics; import org.sonar.batch.mediumtest.BatchMediumTester; import org.sonar.batch.mediumtest.TaskResult; -import org.sonar.batch.protocol.output.BatchReport.DuplicationBlock; +import org.sonar.batch.protocol.output.BatchReport; import org.sonar.batch.protocol.output.BatchReport.Measure; import org.sonar.xoo.XooPlugin; @@ -152,7 +152,7 @@ public class CpdMediumTest { InputFile inputFile1 = result.inputFile("src/sample1.xoo"); - List<DuplicationBlock> duplicationBlocks = result.duplicationBlocksFor(inputFile1); + List<BatchReport.CpdTextBlock> duplicationBlocks = result.duplicationBlocksFor(inputFile1); assertThat(duplicationBlocks).hasSize(3); assertThat(duplicationBlocks.get(0).getStartLine()).isEqualTo(1); assertThat(duplicationBlocks.get(0).getEndLine()).isEqualTo(5); |