From: Julien Lancelot Date: Wed, 30 Sep 2015 16:44:04 +0000 (+0200) Subject: SONAR-6397 Use ScmInfoRepo in PersistFileSourcesStep X-Git-Tag: 5.2-RC1~111 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=29eab470eb9886f3474d724a0c2f7dcdc7c2d5d1;p=sonarqube.git SONAR-6397 Use ScmInfoRepo in PersistFileSourcesStep --- diff --git a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java index e57ba565c94..87ad097dbab 100644 --- a/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java +++ b/server/sonar-server-benchmarks/src/test/java/org/sonar/server/benchmark/PersistFileSourcesStepTest.java @@ -42,8 +42,10 @@ import org.sonar.server.computation.batch.BatchReportReaderImpl; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.ReportComponent; +import org.sonar.server.computation.scm.ScmInfoRepositoryImpl; import org.sonar.server.computation.source.SourceLinesRepositoryImpl; import org.sonar.server.computation.step.PersistFileSourcesStep; +import org.sonar.server.source.SourceService; import static org.assertj.core.api.Assertions.assertThat; @@ -82,7 +84,10 @@ public class PersistFileSourcesStepTest { BatchReportDirectoryHolderImpl batchReportDirectoryHolder = new BatchReportDirectoryHolderImpl(); batchReportDirectoryHolder.setDirectory(reportDir); org.sonar.server.computation.batch.BatchReportReader batchReportReader = new BatchReportReaderImpl(batchReportDirectoryHolder); - PersistFileSourcesStep step = new PersistFileSourcesStep(dbClient, System2.INSTANCE, treeRootHolder, batchReportReader, new SourceLinesRepositoryImpl(batchReportReader)); + SourceService sourceService = new SourceService(dbClient, null); + ScmInfoRepositoryImpl scmInfoRepository = new ScmInfoRepositoryImpl(batchReportReader, dbClient, sourceService); + PersistFileSourcesStep step = new PersistFileSourcesStep(dbClient, System2.INSTANCE, treeRootHolder, batchReportReader, + new SourceLinesRepositoryImpl(batchReportReader), scmInfoRepository); step.execute(); long end = System.currentTimeMillis(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/source/ScmLineReader.java b/server/sonar-server/src/main/java/org/sonar/server/computation/source/ScmLineReader.java index 35bacf16ffb..17d17e4e2ff 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/source/ScmLineReader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/source/ScmLineReader.java @@ -21,55 +21,46 @@ package org.sonar.server.computation.source; import javax.annotation.CheckForNull; -import org.sonar.batch.protocol.output.BatchReport; import org.sonar.db.protobuf.DbFileSources; - -import static com.google.common.base.Preconditions.checkArgument; +import org.sonar.server.computation.scm.Changeset; +import org.sonar.server.computation.scm.ScmInfo; public class ScmLineReader implements LineReader { - private final BatchReport.Changesets scmReport; + private final ScmInfo scmReport; @CheckForNull - private BatchReport.Changesets.Changeset latestChange; + private Changeset latestChange; - public ScmLineReader(BatchReport.Changesets scmReport) { + public ScmLineReader(ScmInfo scmReport) { this.scmReport = scmReport; } @Override public void read(DbFileSources.Line.Builder lineBuilder) { - int changeSetIndex = scmReport.getChangesetIndexByLine(lineBuilder.getLine() - 1); - BatchReport.Changesets.Changeset changeset = scmReport.getChangeset(changeSetIndex); - boolean hasAuthor = changeset.hasAuthor(); - if (hasAuthor) { - lineBuilder.setScmAuthor(changeset.getAuthor()); - } - boolean hasRevision = changeset.hasRevision(); - if (hasRevision) { - lineBuilder.setScmRevision(changeset.getRevision()); + Changeset changeset = scmReport.getChangesetForLine(lineBuilder.getLine()); + String author = changeset.getAuthor(); + if (author != null) { + lineBuilder.setScmAuthor(author); } - boolean hasDate = changeset.hasDate(); - if (hasDate) { - lineBuilder.setScmDate(changeset.getDate()); - } - - checkArgument( - hasAuthor || hasRevision || hasDate, - "A changeset must contain at least one of : author, revision or date"); + lineBuilder.setScmRevision(changeset.getRevision()); + lineBuilder.setScmDate(changeset.getDate()); updateLatestChange(changeset); } - private void updateLatestChange(BatchReport.Changesets.Changeset newChangeSet) { - if (this.latestChange == null) { - this.latestChange = newChangeSet; - } else if (newChangeSet.hasDate() && this.latestChange.hasDate() - && newChangeSet.getDate() > this.latestChange.getDate()) { - this.latestChange = newChangeSet; + private void updateLatestChange(Changeset newChangeSet) { + if (latestChange == null) { + latestChange = newChangeSet; + } else { + long newChangesetDate = newChangeSet.getDate(); + long latestChangeDate = latestChange.getDate(); + if (newChangesetDate > latestChangeDate) { + latestChange = newChangeSet; + } } } @CheckForNull - public BatchReport.Changesets.Changeset getLatestChange() { + public Changeset getLatestChange() { return latestChange; } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java index 49f9d86eac1..adf2201b00d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java @@ -20,13 +20,8 @@ package org.sonar.server.computation.step; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; import org.apache.commons.codec.digest.DigestUtils; import org.apache.ibatis.session.ResultContext; import org.apache.ibatis.session.ResultHandler; @@ -45,6 +40,9 @@ import org.sonar.server.computation.component.CrawlerDepthLimit; import org.sonar.server.computation.component.DepthTraversalTypeAwareCrawler; import org.sonar.server.computation.component.TreeRootHolder; import org.sonar.server.computation.component.TypeAwareVisitorAdapter; +import org.sonar.server.computation.scm.Changeset; +import org.sonar.server.computation.scm.ScmInfo; +import org.sonar.server.computation.scm.ScmInfoRepository; import org.sonar.server.computation.source.ComputeFileSourceData; import org.sonar.server.computation.source.CoverageLineReader; import org.sonar.server.computation.source.DuplicationLineReader; @@ -54,6 +52,14 @@ import org.sonar.server.computation.source.ScmLineReader; import org.sonar.server.computation.source.SourceLinesRepository; import org.sonar.server.computation.source.SymbolsLineReader; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER; public class PersistFileSourcesStep implements ComputationStep { @@ -63,13 +69,16 @@ public class PersistFileSourcesStep implements ComputationStep { private final TreeRootHolder treeRootHolder; private final BatchReportReader reportReader; private final SourceLinesRepository sourceLinesRepository; + private final ScmInfoRepository scmInfoRepository; - public PersistFileSourcesStep(DbClient dbClient, System2 system2, TreeRootHolder treeRootHolder, BatchReportReader reportReader, SourceLinesRepository sourceLinesRepository) { + public PersistFileSourcesStep(DbClient dbClient, System2 system2, TreeRootHolder treeRootHolder, BatchReportReader reportReader, SourceLinesRepository sourceLinesRepository, + ScmInfoRepository scmInfoRepository) { this.dbClient = dbClient; this.system2 = system2; this.treeRootHolder = treeRootHolder; this.reportReader = reportReader; this.sourceLinesRepository = sourceLinesRepository; + this.scmInfoRepository = scmInfoRepository; } @Override @@ -114,7 +123,7 @@ public class PersistFileSourcesStep implements ComputationStep { int fileRef = file.getReportAttributes().getRef(); BatchReport.Component component = reportReader.readComponent(fileRef); CloseableIterator linesIterator = sourceLinesRepository.readLines(file); - LineReaders lineReaders = new LineReaders(reportReader, fileRef); + LineReaders lineReaders = new LineReaders(reportReader, scmInfoRepository, file); try { ComputeFileSourceData computeFileSourceData = new ComputeFileSourceData(linesIterator, lineReaders.readers(), component.getLines()); ComputeFileSourceData.Data fileSourceData = computeFileSourceData.compute(); @@ -128,7 +137,7 @@ public class PersistFileSourcesStep implements ComputationStep { } private void persistSource(ComputeFileSourceData.Data fileSourceData, String componentUuid, - @Nullable BatchReport.Changesets.Changeset latestChange) { + @Nullable Changeset latestChange) { DbFileSources.Data fileData = fileSourceData.getFileSourceData(); byte[] data = FileSourceDto.encodeSourceData(fileData); @@ -171,7 +180,7 @@ public class PersistFileSourcesStep implements ComputationStep { } @CheckForNull - private static String computeRevision(FileSourceDto previousDto, @Nullable BatchReport.Changesets.Changeset latestChange) { + private static String computeRevision(FileSourceDto previousDto, @Nullable Changeset latestChange) { if (latestChange == null) { return previousDto.getRevision(); } @@ -179,7 +188,7 @@ public class PersistFileSourcesStep implements ComputationStep { } @CheckForNull - private static String computeRevision(@Nullable BatchReport.Changesets.Changeset latestChange) { + private static String computeRevision(@Nullable Changeset latestChange) { if (latestChange == null) { return null; } @@ -192,14 +201,15 @@ public class PersistFileSourcesStep implements ComputationStep { @CheckForNull private final ScmLineReader scmLineReader; - LineReaders(BatchReportReader reportReader, int componentRef) { + LineReaders(BatchReportReader reportReader, ScmInfoRepository scmInfoRepository, Component component) { + int componentRef = component.getReportAttributes().getRef(); CloseableIterator coverageIt = reportReader.readComponentCoverage(componentRef); closeables.add(coverageIt); readers.add(new CoverageLineReader(coverageIt)); - BatchReport.Changesets scmReport = reportReader.readChangesets(componentRef); - if (scmReport != null) { - this.scmLineReader = new ScmLineReader(scmReport); + Optional scmInfoOptional = scmInfoRepository.getScmInfo(component); + if (scmInfoOptional.isPresent()) { + this.scmLineReader = new ScmLineReader(scmInfoOptional.get()); readers.add(scmLineReader); } else { this.scmLineReader = null; @@ -229,7 +239,7 @@ public class PersistFileSourcesStep implements ComputationStep { } @CheckForNull - public BatchReport.Changesets.Changeset getLatestChange() { + public Changeset getLatestChange() { if (scmLineReader == null) { return null; } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java index 30ce8f560ff..5fb2f9b972b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/source/ScmLineReaderTest.java @@ -20,27 +20,30 @@ package org.sonar.server.computation.source; +import com.google.common.collect.ImmutableList; +import java.util.List; import org.junit.Test; -import org.sonar.batch.protocol.output.BatchReport; import org.sonar.db.protobuf.DbFileSources; +import org.sonar.server.computation.scm.Changeset; +import org.sonar.server.computation.scm.ScmInfo; +import org.sonar.server.computation.scm.ScmInfoImpl; +import static com.google.common.collect.Lists.newArrayList; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class ScmLineReaderTest { @Test public void set_scm() { - BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() - .addChangeset(newChangeSetBuilder() + ScmInfo scmInfo = new ScmInfoImpl(newArrayList( + Changeset.newChangesetBuilder() .setAuthor("john") .setDate(123456789L) .setRevision("rev-1") - .build()) - .addChangesetIndexByLine(0) - .build(); + .build() + )); - ScmLineReader lineScm = new ScmLineReader(scmReport); + ScmLineReader lineScm = new ScmLineReader(scmInfo); DbFileSources.Line.Builder lineBuilder = DbFileSources.Data.newBuilder().addLinesBuilder().setLine(1); lineScm.read(lineBuilder); @@ -51,90 +54,33 @@ public class ScmLineReaderTest { } @Test - public void set_only_author() { - BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() - .addChangeset(newChangeSetBuilder() - .setAuthor("john") - .build()) - .addChangesetIndexByLine(0) - .build(); - - ScmLineReader lineScm = new ScmLineReader(scmReport); - - DbFileSources.Line.Builder lineBuilder = DbFileSources.Data.newBuilder().addLinesBuilder().setLine(1); - lineScm.read(lineBuilder); - - assertThat(lineBuilder.getScmAuthor()).isEqualTo("john"); - assertThat(lineBuilder.hasScmDate()).isFalse(); - assertThat(lineBuilder.hasScmRevision()).isFalse(); - } - - @Test - public void set_only_date() { - BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() - .addChangeset(newChangeSetBuilder() + public void set_scm_with_minim_fields() { + ScmInfo scmInfo = new ScmInfoImpl(newArrayList( + Changeset.newChangesetBuilder() .setDate(123456789L) - .build()) - .addChangesetIndexByLine(0) - .build(); - - ScmLineReader lineScm = new ScmLineReader(scmReport); - - DbFileSources.Line.Builder lineBuilder = DbFileSources.Data.newBuilder().addLinesBuilder().setLine(1); - lineScm.read(lineBuilder); - - assertThat(lineBuilder.hasScmAuthor()).isFalse(); - assertThat(lineBuilder.getScmDate()).isEqualTo(123456789L); - assertThat(lineBuilder.hasScmRevision()).isFalse(); - } - - @Test - public void set_only_revision() { - BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() - .addChangeset(newChangeSetBuilder() .setRevision("rev-1") - .build()) - .addChangesetIndexByLine(0) - .build(); + .build() + )); - ScmLineReader lineScm = new ScmLineReader(scmReport); + ScmLineReader lineScm = new ScmLineReader(scmInfo); DbFileSources.Line.Builder lineBuilder = DbFileSources.Data.newBuilder().addLinesBuilder().setLine(1); lineScm.read(lineBuilder); assertThat(lineBuilder.hasScmAuthor()).isFalse(); - assertThat(lineBuilder.hasScmDate()).isFalse(); + assertThat(lineBuilder.getScmDate()).isEqualTo(123456789L); assertThat(lineBuilder.getScmRevision()).isEqualTo("rev-1"); } - @Test - public void fail_when_changeset_is_empty() { - BatchReport.Changesets scmReport = BatchReport.Changesets.newBuilder() - .addChangeset(newChangeSetBuilder() - .build()) - .addChangesetIndexByLine(0) - .build(); - - ScmLineReader lineScm = new ScmLineReader(scmReport); - - DbFileSources.Line.Builder lineBuilder = DbFileSources.Data.newBuilder().addLinesBuilder().setLine(1); - try { - lineScm.read(lineBuilder); - failBecauseExceptionWasNotThrown(IllegalArgumentException.class); - } catch (IllegalArgumentException e) { - assertThat(e).hasMessage("A changeset must contain at least one of : author, revision or date"); - } - } - @Test public void getLatestChange_returns_changeset_with_highest_date_of_read_lines() { long refDate = 123456789L; - BatchReport.Changesets.Changeset changeset0 = newChangeSetBuilder().setDate(refDate - 636).build(); - BatchReport.Changesets.Changeset changeset1 = newChangeSetBuilder().setDate(refDate + 1).build(); - BatchReport.Changesets.Changeset changeset2 = newChangeSetBuilder().setDate(refDate + 2).build(); - BatchReport.Changesets scmReport = setup8LinesChangeset(changeset0, changeset1, changeset2); + Changeset changeset0 = Changeset.newChangesetBuilder().setDate(refDate - 636).setRevision("rev-1").build(); + Changeset changeset1 = Changeset.newChangesetBuilder().setDate(refDate + 1).setRevision("rev-2").build(); + Changeset changeset2 = Changeset.newChangesetBuilder().setDate(refDate + 2).setRevision("rev-3").build(); + ScmInfo scmInfo = new ScmInfoImpl(setup8LinesChangeset(changeset0, changeset1, changeset2)); - ScmLineReader lineScm = new ScmLineReader(scmReport); + ScmLineReader lineScm = new ScmLineReader(scmInfo); // before any line is read, the latest change is null assertThat(lineScm.getLatestChange()).isNull(); @@ -158,78 +104,14 @@ public class ScmLineReaderTest { readLineAndAssertLatestChangeDate(lineScm, 8, changeset2); } - @Test - public void getLatestChange_returns_first_changeset_when_none_have_dates() { - BatchReport.Changesets.Changeset changeset0 = newChangeSetBuilder().setRevision("0").build(); - BatchReport.Changesets.Changeset changeset1 = newChangeSetBuilder().setRevision("1").build(); - BatchReport.Changesets.Changeset changeset2 = newChangeSetBuilder().setRevision("2").build(); - BatchReport.Changesets scmReport = setup8LinesChangeset(changeset0, changeset1, changeset2); - - ScmLineReader lineScm = new ScmLineReader(scmReport); - - // before any line is read, the latest change is null - assertThat(lineScm.getLatestChange()).isNull(); - - // read lines 1 to 8, no date => changeset 0 - readLineAndAssertLatestChangeDate(lineScm, 1, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 2, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 3, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 4, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 5, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 6, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 7, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 8, changeset0); + private static List setup8LinesChangeset(Changeset changeset0, Changeset changeset1, Changeset changeset2) { + return ImmutableList.of(changeset0, changeset1, changeset1, changeset2, changeset0, changeset1, changeset0, changeset0); } - @Test - public void getLatestChange_returns_first_changeset_when_the_first_one_has_no_date() { - BatchReport.Changesets.Changeset changeset0 = newChangeSetBuilder().setRevision("0").build(); - BatchReport.Changesets.Changeset changeset1 = newChangeSetBuilder().setRevision("1").setDate(95454154L).build(); - BatchReport.Changesets.Changeset changeset2 = newChangeSetBuilder().setRevision("2").setDate(9654545444L).build(); - BatchReport.Changesets scmReport = setup8LinesChangeset(changeset0, changeset1, changeset2); - - ScmLineReader lineScm = new ScmLineReader(scmReport); - - // before any line is read, the latest change is null - assertThat(lineScm.getLatestChange()).isNull(); - - // read lines 1 to 8, first encountered changeset has no date => changeset 0 - readLineAndAssertLatestChangeDate(lineScm, 1, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 2, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 3, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 4, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 5, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 6, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 7, changeset0); - readLineAndAssertLatestChangeDate(lineScm, 8, changeset0); - } - - private static BatchReport.Changesets setup8LinesChangeset(BatchReport.Changesets.Changeset changeset0, - BatchReport.Changesets.Changeset changeset1, - BatchReport.Changesets.Changeset changeset2) { - return BatchReport.Changesets.newBuilder() - .addChangeset(changeset0) - .addChangeset(changeset1) - .addChangeset(changeset2) - .addChangesetIndexByLine(0) - .addChangesetIndexByLine(1) - .addChangesetIndexByLine(1) - .addChangesetIndexByLine(2) - .addChangesetIndexByLine(0) - .addChangesetIndexByLine(1) - .addChangesetIndexByLine(0) - .addChangesetIndexByLine(0) - .build(); - } - - private void readLineAndAssertLatestChangeDate(ScmLineReader lineScm, int line, BatchReport.Changesets.Changeset expectedChangeset) { + private void readLineAndAssertLatestChangeDate(ScmLineReader lineScm, int line, Changeset expectedChangeset) { DbFileSources.Line.Builder lineBuilder = DbFileSources.Data.newBuilder().addLinesBuilder().setLine(line); lineScm.read(lineBuilder); assertThat(lineScm.getLatestChange()).isSameAs(expectedChangeset); } - private static BatchReport.Changesets.Changeset.Builder newChangeSetBuilder() { - return BatchReport.Changesets.Changeset.newBuilder(); - } - } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java index 54af795b529..d8909a5104e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java @@ -37,6 +37,8 @@ import org.sonar.server.computation.batch.BatchReportReaderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.ReportComponent; +import org.sonar.server.computation.scm.Changeset; +import org.sonar.server.computation.scm.ScmInfoRepositoryRule; import org.sonar.server.computation.source.SourceLinesRepositoryRule; import org.sonar.test.DbTests; @@ -66,6 +68,9 @@ public class PersistFileSourcesStepTest extends BaseStepTest { @Rule public BatchReportReaderRule reportReader = new BatchReportReaderRule(); + @Rule + public ScmInfoRepositoryRule scmInfoRepository = new ScmInfoRepositoryRule(); + @Rule public SourceLinesRepositoryRule fileSourceRepository = new SourceLinesRepositoryRule(); @@ -80,7 +85,7 @@ public class PersistFileSourcesStepTest extends BaseStepTest { public void setup() { dbTester.truncateTables(); when(system2.now()).thenReturn(now); - underTest = new PersistFileSourcesStep(dbClient, system2, treeRootHolder, reportReader, fileSourceRepository); + underTest = new PersistFileSourcesStep(dbClient, system2, treeRootHolder, reportReader, fileSourceRepository, scmInfoRepository); } @Override @@ -189,15 +194,10 @@ public class PersistFileSourcesStepTest extends BaseStepTest { @Test public void persist_scm() { initBasicReport(1); - - reportReader.putChangesets(BatchReport.Changesets.newBuilder() - .setComponentRef(FILE_REF) - .addChangeset(BatchReport.Changesets.Changeset.newBuilder() - .setAuthor("john") - .setDate(123456789L) - .setRevision("rev-1") - .build()) - .addChangesetIndexByLine(0) + scmInfoRepository.setScmInfo(FILE_REF, Changeset.newChangesetBuilder() + .setAuthor("john") + .setDate(123456789L) + .setRevision("rev-1") .build()); underTest.execute(); @@ -357,15 +357,12 @@ public class PersistFileSourcesStepTest extends BaseStepTest { initBasicReport(1); - reportReader.putChangesets(BatchReport.Changesets.newBuilder() - .setComponentRef(FILE_REF) - .addChangeset(BatchReport.Changesets.Changeset.newBuilder() - .setAuthor("john") - .setDate(123456789L) - .setRevision("rev-1") - .build()) - .addChangesetIndexByLine(0) - .build()); + scmInfoRepository.setScmInfo(FILE_REF, Changeset.newChangesetBuilder() + .setAuthor("john") + .setDate(123456789L) + .setRevision("rev-1") + .build()); + underTest.execute();