]> source.dussan.org Git - sonarqube.git/commitdiff
Fix tests and missing components
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 28 Jul 2017 12:13:03 +0000 (14:13 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Mon, 7 Aug 2017 09:44:06 +0000 (11:44 +0200)
server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulator.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java

index dc65872c10b46e664f29904b1902154e8dea4f64..52c35f2b271c83b16ec6d501a9f416ad5d4e0222 100644 (file)
@@ -135,7 +135,7 @@ public class ComputeEngineContainerImplTest {
     assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(
       COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION
         + 25 // level 1
-        + 46 // content of DaoModule
+        + 47 // content of DaoModule
         + 3 // content of EsSearchModule
         + 58 // content of CorePropertyDefinitions
     );
index d9bf5132eccd698ca4dca6099479816d13343127..7b9392619c17fed22a1aad1ea623b11db11333dd 100644 (file)
@@ -60,6 +60,7 @@ import org.sonar.server.computation.task.projectanalysis.issue.IssueCounter;
 import org.sonar.server.computation.task.projectanalysis.issue.IssueCreationDateCalculator;
 import org.sonar.server.computation.task.projectanalysis.issue.IssueLifecycle;
 import org.sonar.server.computation.task.projectanalysis.issue.IssueVisitors;
+import org.sonar.server.computation.task.projectanalysis.issue.IssuesRepositoryVisitor;
 import org.sonar.server.computation.task.projectanalysis.issue.LoadComponentUuidsHavingOpenIssuesVisitor;
 import org.sonar.server.computation.task.projectanalysis.issue.MovedIssueVisitor;
 import org.sonar.server.computation.task.projectanalysis.issue.NewEffortAggregator;
@@ -210,6 +211,7 @@ public final class ProjectAnalysisTaskContainerPopulator implements ContainerPop
       IssueAssigner.class,
       IssueCounter.class,
       MovedIssueVisitor.class,
+      IssuesRepositoryVisitor.class,
 
       // visitors : order is important, measure computers must be executed at the end in order to access to every measures / issues
       LoadComponentUuidsHavingOpenIssuesVisitor.class,
index d4b29f1c99be3428dabf151b77c92cd64e3ab85e..e0d324a89c5508059c8baf380fdc253cbbc77fe8 100644 (file)
@@ -121,7 +121,7 @@ public class PersistFileSourcesStep implements ComputationStep {
       if (analysisMetadataHolder.isIncrementalAnalysis() && file.getStatus() == Status.SAME) {
         return;
       }
-      
+
       CloseableIterator<String> linesIterator = sourceLinesRepository.readLines(file);
       LineReaders lineReaders = new LineReaders(reportReader, scmInfoRepository, duplicationRepository, file);
       try {
@@ -178,7 +178,7 @@ public class PersistFileSourcesStep implements ComputationStep {
         }
       }
     }
-    
+
     @CheckForNull
     private String computeRevision(@Nullable Changeset latestChange) {
       if (latestChange == null) {
@@ -216,7 +216,6 @@ public class PersistFileSourcesStep implements ComputationStep {
       CloseableIterator<ScannerReport.Symbol> symbolsIt = reportReader.readComponentSymbols(componentRef);
       closeables.add(symbolsIt);
       readers.add(new SymbolsLineReader(component, symbolsIt, rangeOffsetConverter));
-
       readers.add(new DuplicationLineReader(duplicationRepository.getDuplications(component)));
     }
 
index a26c116bbfde6348eed8ee182c126be814a7fd62..33437bf9b65c3fbdf5b116b1fcf2fa4daa3281e6 100644 (file)
@@ -131,12 +131,10 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
   @Test
   public void dont_persist_unchanged_sources_if_incremental() {
     analysisMetadataHolder.setIncrementalAnalysis(true);
-    initReportWithUnchangedFile(2);
+    initIncrementalReport(2);
 
     underTest.execute();
-
     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
-
   }
 
   @Test
@@ -475,14 +473,30 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
     assertThat(fileSourceDto.getRevision()).isNull();
   }
 
-  private void initReportWithUnchangedFile(int numberOfLines) {
-    treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren(
-      ReportComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE").setKey("MODULE_KEY").addChildren(
-        ReportComponent.builder(Component.Type.FILE, FILE1_REF).setUuid(FILE1_UUID).setKey("MODULE_KEY:src/Foo.java")
-          .setFileAttributes(new FileAttributes(false, null, numberOfLines)).setStatus(Status.CHANGED).build())
-        .build(),
-      ReportComponent.builder(Component.Type.FILE, FILE2_REF).setUuid(FILE2_UUID).setKey("MODULE_KEY:src/Foo2.java")
-        .setStatus(Status.SAME).build())
+  private void initIncrementalReport(int numberOfLines) {
+    treeRootHolder.setRoot(ReportComponent
+      .builder(Component.Type.PROJECT, 1)
+      .setUuid(PROJECT_UUID)
+      .setKey(PROJECT_KEY)
+      .addChildren(
+        ReportComponent
+          .builder(Component.Type.MODULE, 2)
+          .setUuid("MODULE")
+          .setKey("MODULE_KEY")
+          .addChildren(
+            ReportComponent
+              .builder(Component.Type.FILE, FILE1_REF)
+              .setUuid(FILE1_UUID)
+              .setKey("MODULE_KEY:src/Foo.java")
+              .setFileAttributes(new FileAttributes(false, null, numberOfLines))
+              .setStatus(Status.CHANGED)
+              .build())
+          .build(),
+        ReportComponent
+          .builder(Component.Type.FILE, FILE2_REF)
+          .setUuid(FILE2_UUID)
+          .setKey("MODULE_KEY:src/Foo2.java")
+          .setStatus(Status.SAME).build())
       .build());
 
     reportReader.putComponent(ScannerReport.Component.newBuilder()