]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5911 refactoring digest report steps
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 17 Dec 2014 15:04:33 +0000 (16:04 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 24 Dec 2014 12:08:56 +0000 (13:08 +0100)
server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java
server/sonar-server/src/main/java/org/sonar/server/computation/step/DigestReportStep.java
server/sonar-server/src/test/java/org/sonar/server/computation/AnalysisReportServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/step/DigestReportStepTest.java

index 30d3a04f06bb32636bcbaeedba664c30b0f9dfcc..07389ebab9625499247e5a27ba0c5a34088f5182 100644 (file)
@@ -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) {
index 61b0fd07d344a0cac41b63f1c3d9cb2b8664df87..57ac013ce6460c7991e646f9143d7599d62a56ad 100644 (file)
@@ -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
index 672e232f8e3abeee965718b04ec0b015e4f5ccb7..e0aa45482bd982fc5e20e28193cd49fd659c24a4 100644 (file)
@@ -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 {
index a7c9f1bd8da9104df34fc63bf2c080bc7da9e920..eaaca2c6bda30b8e1138c0adf08a515cc553c22a 100644 (file)
@@ -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));
   }
 }