From: Teryk Bellahsene Date: Wed, 17 Dec 2014 15:04:33 +0000 (+0100) Subject: SONAR-5911 refactoring digest report steps X-Git-Tag: latest-silver-master-#65~417 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cfc1fa782ca3636b409f2825ca908e8275ff4ebc;p=sonarqube.git SONAR-5911 refactoring digest report steps --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java index 30d3a04f06b..07389ebab96 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java @@ -20,6 +20,7 @@ package org.sonar.server.computation; +import com.google.common.annotations.VisibleForTesting; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,9 +42,16 @@ public class AnalysisReportService implements ServerComponent { this.dbClient = dbClient; } - public void decompress(DbSession session, ComputeEngineContext context) { + public void digest(DbSession session, ComputeEngineContext context) { + decompress(session, context); + } + + @VisibleForTesting + void decompress(DbSession session, ComputeEngineContext context) { AnalysisReportDto report = context.getReportDto(); - context.setReportDirectory(dbClient.analysisReportDao().getDecompressedReport(session, report.getId())); + + File decompressedDirectory = dbClient.analysisReportDao().getDecompressedReport(session, report.getId()); + context.setReportDirectory(decompressedDirectory); } public void clean(@Nullable File directory) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/DigestReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/DigestReportStep.java index 61b0fd07d34..57ac013ce64 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/DigestReportStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/DigestReportStep.java @@ -33,7 +33,7 @@ public class DigestReportStep implements ComputationStep { @Override public void execute(DbSession session, ComputeEngineContext context) { - reportService.decompress(session, context); + reportService.digest(session, context); } @Override diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java index 672e232f8e3..e0aa45482bd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java @@ -36,7 +36,6 @@ import static org.mockito.Mockito.*; public class AnalysisReportServiceTest { private AnalysisReportService sut; - private AnalysisReportDao dao; @Test public void call_dao_to_decompress_report() throws Exception { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/DigestReportStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/DigestReportStepTest.java index a7c9f1bd8da..eaaca2c6bda 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/DigestReportStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/DigestReportStepTest.java @@ -44,6 +44,6 @@ public class DigestReportStepTest { sut.execute(mock(DbSession.class), context); - verify(service).decompress(any(DbSession.class), eq(context)); + verify(service).digest(any(DbSession.class), eq(context)); } }