aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2014-10-31 10:54:32 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2014-10-31 13:53:23 +0100
commita067ae93be8a7303a94b901b0b3e8cd212c19788 (patch)
treed1b096521679d413f4bac57c4c8c9912f7f19a6b
parentac5b044e84b65a1b0fae568070049c3ba1e675fd (diff)
downloadsonarqube-a067ae93be8a7303a94b901b0b3e8cd212c19788.tar.gz
sonarqube-a067ae93be8a7303a94b901b0b3e8cd212c19788.zip
SONAR-5795 Move project indexation post job on server side
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/package-info.java26
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStepRegistry.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/DataCleanerStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/IndexProjectIssuesStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/InvalidatePreviewCacheStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ProjectDatabaseIndexationStep.java (renamed from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java)33
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/SwitchSnapshotStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/SynchronizeProjectPermissionsStep.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java7
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryMediumTest.java82
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryTest.java53
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/ProjectDatabaseIndexationStepTest.java (renamed from plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.java)38
15 files changed, 143 insertions, 136 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index e1965074eb8..0fddfec9456 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList;
import org.sonar.api.*;
import org.sonar.api.checks.NoSonarFilter;
import org.sonar.core.timemachine.Periods;
-import org.sonar.plugins.core.batch.IndexProjectPostJob;
import org.sonar.plugins.core.charts.DistributionAreaChart;
import org.sonar.plugins.core.charts.DistributionBarChart;
import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
@@ -312,7 +311,6 @@ public final class CorePlugin extends SonarPlugin {
NoSonarFilter.class,
DirectoriesDecorator.class,
FilesDecorator.class,
- IndexProjectPostJob.class,
ManualMeasureDecorator.class,
FileHashSensor.class,
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/package-info.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/package-info.java
deleted file mode 100644
index 53156e11908..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-/**
- * Deprecated in 4.5.1. JFreechart charts are replaced by Javascript charts.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.plugins.core.batch;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
index b49f2dce617..afb6b8542b6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
@@ -65,7 +65,7 @@ public class ComputationService implements ServerComponent {
try {
report.succeed();
for (ComputationStep step : stepRegistry.steps()) {
- TimeProfiler stepProfiler = new TimeProfiler(LOG).start(step.description());
+ TimeProfiler stepProfiler = new TimeProfiler(LOG).start(step.getDescription());
step.execute(session, report, project);
session.commit();
stepProfiler.stop();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStep.java
index a451f09da94..ed52abee335 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStep.java
@@ -29,5 +29,5 @@ public interface ComputationStep extends ServerComponent {
void execute(DbSession session, AnalysisReportDto analysisReportDto, ComponentDto project);
- String description();
+ String getDescription();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStepRegistry.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStepRegistry.java
index 0e392ca2aad..f5140b19d25 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStepRegistry.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationStepRegistry.java
@@ -21,24 +21,30 @@
package org.sonar.server.computation;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
import org.sonar.api.ServerComponent;
+import org.sonar.api.platform.ComponentContainer;
import java.util.List;
public class ComputationStepRegistry implements ServerComponent {
- private final List<ComputationStep> steps;
+ private final ComponentContainer pico;
+
+ public ComputationStepRegistry(ComponentContainer pico) {
+ this.pico = pico;
- public ComputationStepRegistry(
- SynchronizeProjectPermissionsStep synchronizeProjectPermissionsStep,
- IndexProjectIssuesStep indexProjectIssuesStep,
- SwitchSnapshotStep switchSnapshotStep,
- DataCleanerStep dataCleanerStep,
- InvalidatePreviewCacheStep invalidatePreviewCacheStep) {
- steps = ImmutableList.of(synchronizeProjectPermissionsStep, switchSnapshotStep, invalidatePreviewCacheStep, dataCleanerStep, indexProjectIssuesStep);
}
public List<ComputationStep> steps() {
- return steps;
+ List<ComputationStep> steps = Lists.newArrayList();
+ steps.add(pico.getComponentByType(SynchronizeProjectPermissionsStep.class));
+ steps.add(pico.getComponentByType(SwitchSnapshotStep.class));
+ steps.add(pico.getComponentByType(InvalidatePreviewCacheStep.class));
+ steps.add(pico.getComponentByType(DataCleanerStep.class));
+ steps.add(pico.getComponentByType(ProjectDatabaseIndexationStep.class));
+ steps.add(pico.getComponentByType(IndexProjectIssuesStep.class));
+
+ return ImmutableList.copyOf(steps);
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/DataCleanerStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/DataCleanerStep.java
index fcd0de2e2b4..8532f486ad1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/DataCleanerStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/DataCleanerStep.java
@@ -53,7 +53,7 @@ public class DataCleanerStep implements ComputationStep {
}
@Override
- public String description() {
+ public String getDescription() {
return "Purge database";
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/IndexProjectIssuesStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/IndexProjectIssuesStep.java
index d84cff541ac..34936e7febe 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/IndexProjectIssuesStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/IndexProjectIssuesStep.java
@@ -47,7 +47,7 @@ public class IndexProjectIssuesStep implements ComputationStep {
}
@Override
- public String description() {
+ public String getDescription() {
return "Update issues index";
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/InvalidatePreviewCacheStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/InvalidatePreviewCacheStep.java
index dcdf9c822d1..e71ee278627 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/InvalidatePreviewCacheStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/InvalidatePreviewCacheStep.java
@@ -46,7 +46,7 @@ public class InvalidatePreviewCacheStep implements ComputationStep {
}
@Override
- public String description() {
+ public String getDescription() {
return "Invalidate preview cache";
}
}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ProjectDatabaseIndexationStep.java
index c8f73204e98..7f2c5d33503 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ProjectDatabaseIndexationStep.java
@@ -17,29 +17,28 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.plugins.core.batch;
-import org.sonar.core.DryRunIncompatible;
-import org.sonar.api.batch.PostJob;
-import org.sonar.api.batch.SensorContext;
-import org.sonar.api.resources.Project;
+package org.sonar.server.computation;
+
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.computation.db.AnalysisReportDto;
+import org.sonar.core.persistence.DbSession;
import org.sonar.core.resource.ResourceIndexerDao;
-/**
- * @since 2.13
- */
-@DryRunIncompatible
-public class IndexProjectPostJob implements PostJob {
- private ResourceIndexerDao indexer;
+public class ProjectDatabaseIndexationStep implements ComputationStep {
+ private final ResourceIndexerDao resourceIndexerDao;
- public IndexProjectPostJob(ResourceIndexerDao indexer) {
- this.indexer = indexer;
+ public ProjectDatabaseIndexationStep(ResourceIndexerDao resourceIndexerDao) {
+ this.resourceIndexerDao = resourceIndexerDao;
+ }
+
+ @Override
+ public void execute(DbSession session, AnalysisReportDto analysisReportDto, ComponentDto project) {
+ resourceIndexerDao.indexProject(project.getId().intValue());
}
@Override
- public void executeOn(Project project, SensorContext context) {
- if (project.getId() != null) {
- indexer.indexProject(project.getId());
- }
+ public String getDescription() {
+ return "Index project in database";
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/SwitchSnapshotStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/SwitchSnapshotStep.java
index 1fe6f0a29b9..c1109ed6310 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/SwitchSnapshotStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/SwitchSnapshotStep.java
@@ -43,7 +43,7 @@ public class SwitchSnapshotStep implements ComputationStep {
}
@Override
- public String description() {
+ public String getDescription() {
return "Switch last snapshot flag";
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/SynchronizeProjectPermissionsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/SynchronizeProjectPermissionsStep.java
index 7d388dd8e08..01815b0a857 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/SynchronizeProjectPermissionsStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/SynchronizeProjectPermissionsStep.java
@@ -47,7 +47,7 @@ public class SynchronizeProjectPermissionsStep implements ComputationStep {
}
@Override
- public String description() {
+ public String getDescription() {
return "Synchronize project permissions";
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
index cefc8430479..03132c8a74b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
@@ -271,7 +271,7 @@ class ServerComponents {
ActivityNormalizer.class,
ActivityIndex.class,
ActivityDao.class
- ));
+ ));
components.addAll(CorePropertyDefinitions.all());
components.addAll(DatabaseMigrations.CLASSES);
components.addAll(DaoUtils.getDaoClasses());
@@ -304,7 +304,7 @@ class ServerComponents {
// ws
RestartHandler.class,
SystemWs.class
- );
+ );
}
/**
@@ -321,7 +321,7 @@ class ServerComponents {
HttpDownloader.class,
UriReader.class,
ServerIdGenerator.class
- );
+ );
}
void startLevel4Components(ComponentContainer pico) {
@@ -598,6 +598,7 @@ class ServerComponents {
IndexProjectIssuesStep.class,
SwitchSnapshotStep.class,
InvalidatePreviewCacheStep.class,
+ ProjectDatabaseIndexationStep.class,
DataCleanerStep.class));
pico.addSingleton(AnalysisReportQueue.class);
pico.addSingleton(AnalysisReportTaskLauncher.class);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryMediumTest.java
new file mode 100644
index 00000000000..cdf59656cc9
--- /dev/null
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryMediumTest.java
@@ -0,0 +1,82 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.server.computation;
+
+import com.google.common.collect.Lists;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.api.platform.ComponentContainer;
+import org.sonar.server.tester.ServerTester;
+
+import java.util.List;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+
+public class ComputationStepRegistryMediumTest {
+
+ @ClassRule
+ public static ServerTester tester = new ServerTester();
+
+ private ComputationStepRegistry sut;
+
+ @Before
+ public void before() {
+ ComponentContainer pico = new ComponentContainer();
+
+ pico.addSingleton(mock(SynchronizeProjectPermissionsStep.class));
+ pico.addSingleton(mock(IndexProjectIssuesStep.class));
+ pico.addSingleton(mock(SwitchSnapshotStep.class));
+ pico.addSingleton(mock(DataCleanerStep.class));
+ pico.addSingleton(mock(InvalidatePreviewCacheStep.class));
+ pico.addSingleton(mock(ProjectDatabaseIndexationStep.class));
+
+ sut = new ComputationStepRegistry(pico);
+ }
+
+ @Test
+ public void steps_returned_in_the_right_order() throws Exception {
+ List<Class<? extends ComputationStep>> wishStepsClasses = Lists.newArrayList(
+ SynchronizeProjectPermissionsStep.class,
+ SwitchSnapshotStep.class,
+ InvalidatePreviewCacheStep.class,
+ DataCleanerStep.class,
+ ProjectDatabaseIndexationStep.class,
+ IndexProjectIssuesStep.class
+ );
+ List<ComputationStep> steps = sut.steps();
+
+ assertThat(steps).hasSize(wishStepsClasses.size());
+ for (int i = 0; i < steps.size(); i++) {
+ assertThat(steps.get(i)).isInstanceOf(wishStepsClasses.get(i));
+ }
+ }
+
+ @Test
+ public void steps_have_a_non_empty_description() {
+ ComputationStepRegistry sut = tester.get(ComputationStepRegistry.class);
+
+ List<ComputationStep> steps = sut.steps();
+
+ assertThat(steps).onProperty("description").excludes(null, "");
+ }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryTest.java
deleted file mode 100644
index b47cdcf6521..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/ComputationStepRegistryTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-package org.sonar.server.computation;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.fest.assertions.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class ComputationStepRegistryTest {
-
- private ComputationStepRegistry sut;
- private SynchronizeProjectPermissionsStep synchronizeProjectPermissionsStep;
- private IndexProjectIssuesStep indexProjectIssuesStep;
- private SwitchSnapshotStep switchSnapshotStep;
- private DataCleanerStep dataCleanerStep;
- private InvalidatePreviewCacheStep invalidatePreviewCacheStep;
-
- @Before
- public void before() {
- synchronizeProjectPermissionsStep = mock(SynchronizeProjectPermissionsStep.class);
- indexProjectIssuesStep = mock(IndexProjectIssuesStep.class);
- switchSnapshotStep = mock(SwitchSnapshotStep.class);
- dataCleanerStep = mock(DataCleanerStep.class);
- invalidatePreviewCacheStep = mock(InvalidatePreviewCacheStep.class);
-
- sut = new ComputationStepRegistry(synchronizeProjectPermissionsStep, indexProjectIssuesStep, switchSnapshotStep, dataCleanerStep, invalidatePreviewCacheStep);
- }
-
- @Test
- public void steps_returned_in_the_right_order() throws Exception {
- assertThat(sut.steps()).containsExactly(synchronizeProjectPermissionsStep, switchSnapshotStep, invalidatePreviewCacheStep, dataCleanerStep, indexProjectIssuesStep);
- }
-}
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ProjectDatabaseIndexationStepTest.java
index c63e8908275..fdc9a57d55b 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ProjectDatabaseIndexationStepTest.java
@@ -17,37 +17,37 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.plugins.core.batch;
+package org.sonar.server.computation;
+
+import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.resources.Project;
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.computation.db.AnalysisReportDto;
+import org.sonar.core.persistence.DbSession;
import org.sonar.core.resource.ResourceIndexerDao;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.*;
-public class IndexProjectPostJobTest {
- @Test
- public void shouldIndexProject() {
- ResourceIndexerDao indexer = mock(ResourceIndexerDao.class);
- IndexProjectPostJob job = new IndexProjectPostJob(indexer);
- Project project = new Project("foo");
- project.setId(123);
+public class ProjectDatabaseIndexationStepTest {
- job.executeOn(project, null);
+ private ProjectDatabaseIndexationStep sut;
+ private ResourceIndexerDao resourceIndexerDao;
- verify(indexer).indexProject(123);
+ @Before
+ public void before() {
+ this.resourceIndexerDao = mock(ResourceIndexerDao.class);
+ this.sut = new ProjectDatabaseIndexationStep(resourceIndexerDao);
}
@Test
- public void shouldNotIndexProjectIfMissingId() {
- ResourceIndexerDao indexer = mock(ResourceIndexerDao.class);
- IndexProjectPostJob job = new IndexProjectPostJob(indexer);
+ public void call_indexProject_of_dao() {
+ ComponentDto project = mock(ComponentDto.class);
+ when(project.getId()).thenReturn(123L);
- job.executeOn(new Project("foo"), null);
+ sut.execute(mock(DbSession.class), mock(AnalysisReportDto.class), project);
- verifyZeroInteractions(indexer);
+ verify(resourceIndexerDao).indexProject(123);
}
}