From a3caa98f84849143fa78f9fc286079e871b3c9dd Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Mon, 5 Oct 2015 12:55:35 +0200 Subject: SONAR-6397 Do not read SCM info from db on first analysis --- .../org/sonar/server/benchmark/PersistFileSourcesStepTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/sonar-server-benchmarks') 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 87ad097dbab..09520d5b788 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 @@ -37,6 +37,7 @@ import org.sonar.batch.protocol.output.BatchReportWriter; import org.sonar.core.util.Uuids; import org.sonar.db.DbClient; import org.sonar.db.DbTester; +import org.sonar.server.computation.analysis.MutableAnalysisMetadataHolderRule; import org.sonar.server.computation.batch.BatchReportDirectoryHolderImpl; import org.sonar.server.computation.batch.BatchReportReaderImpl; import org.sonar.server.computation.batch.TreeRootHolderRule; @@ -69,6 +70,9 @@ public class PersistFileSourcesStepTest { @Rule public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule(); + @Rule + public MutableAnalysisMetadataHolderRule analysisMetadataHolder = new MutableAnalysisMetadataHolderRule(); + @Test public void benchmark() throws Exception { File reportDir = prepareReport(); @@ -85,7 +89,8 @@ public class PersistFileSourcesStepTest { batchReportDirectoryHolder.setDirectory(reportDir); org.sonar.server.computation.batch.BatchReportReader batchReportReader = new BatchReportReaderImpl(batchReportDirectoryHolder); SourceService sourceService = new SourceService(dbClient, null); - ScmInfoRepositoryImpl scmInfoRepository = new ScmInfoRepositoryImpl(batchReportReader, dbClient, sourceService); + analysisMetadataHolder.setIsFirstAnalysis(false); + ScmInfoRepositoryImpl scmInfoRepository = new ScmInfoRepositoryImpl(batchReportReader, analysisMetadataHolder, dbClient, sourceService); PersistFileSourcesStep step = new PersistFileSourcesStep(dbClient, System2.INSTANCE, treeRootHolder, batchReportReader, new SourceLinesRepositoryImpl(batchReportReader), scmInfoRepository); step.execute(); -- cgit v1.2.3