--- /dev/null
+/*
+ * 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.sonar.core.component.ComponentDto;
+import org.sonar.core.computation.db.AnalysisReportDto;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.core.resource.ResourceIndexerDao;
+
+public class ComponentIndexationInDatabaseStep implements ComputationStep {
+ private final ResourceIndexerDao resourceIndexerDao;
+
+ public ComponentIndexationInDatabaseStep(ResourceIndexerDao resourceIndexerDao) {
+ this.resourceIndexerDao = resourceIndexerDao;
+ }
+
+ @Override
+ public void execute(DbSession session, AnalysisReportDto analysisReportDto, ComponentDto project) {
+ resourceIndexerDao.indexProject(project.getId().intValue());
+ }
+
+ @Override
+ public String getDescription() {
+ return "Index project in database";
+ }
+}
steps.add(pico.getComponentByType(SynchronizeProjectPermissionsStep.class));
steps.add(pico.getComponentByType(SwitchSnapshotStep.class));
steps.add(pico.getComponentByType(InvalidatePreviewCacheStep.class));
+ steps.add(pico.getComponentByType(ComponentIndexationInDatabaseStep.class));
steps.add(pico.getComponentByType(DataCleanerStep.class));
- steps.add(pico.getComponentByType(ProjectDatabaseIndexationStep.class));
steps.add(pico.getComponentByType(IndexProjectIssuesStep.class));
return ImmutableList.copyOf(steps);
+++ /dev/null
-/*
- * 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.sonar.core.component.ComponentDto;
-import org.sonar.core.computation.db.AnalysisReportDto;
-import org.sonar.core.persistence.DbSession;
-import org.sonar.core.resource.ResourceIndexerDao;
-
-public class ProjectDatabaseIndexationStep implements ComputationStep {
- private final ResourceIndexerDao resourceIndexerDao;
-
- public ProjectDatabaseIndexationStep(ResourceIndexerDao resourceIndexerDao) {
- this.resourceIndexerDao = resourceIndexerDao;
- }
-
- @Override
- public void execute(DbSession session, AnalysisReportDto analysisReportDto, ComponentDto project) {
- resourceIndexerDao.indexProject(project.getId().intValue());
- }
-
- @Override
- public String getDescription() {
- return "Index project in database";
- }
-}
IndexProjectIssuesStep.class,
SwitchSnapshotStep.class,
InvalidatePreviewCacheStep.class,
- ProjectDatabaseIndexationStep.class,
+ ComponentIndexationInDatabaseStep.class,
DataCleanerStep.class));
pico.addSingleton(AnalysisReportQueue.class);
pico.addSingleton(AnalysisReportTaskLauncher.class);
--- /dev/null
+/*
+ * 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 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.*;
+
+public class ComponentIndexationInDatabaseStepTest {
+
+ private ComponentIndexationInDatabaseStep sut;
+ private ResourceIndexerDao resourceIndexerDao;
+
+ @Before
+ public void before() {
+ this.resourceIndexerDao = mock(ResourceIndexerDao.class);
+ this.sut = new ComponentIndexationInDatabaseStep(resourceIndexerDao);
+ }
+
+ @Test
+ public void call_indexProject_of_dao() {
+ ComponentDto project = mock(ComponentDto.class);
+ when(project.getId()).thenReturn(123L);
+
+ sut.execute(mock(DbSession.class), mock(AnalysisReportDto.class), project);
+
+ verify(resourceIndexerDao).indexProject(123);
+ }
+
+}
pico.addSingleton(mock(SwitchSnapshotStep.class));
pico.addSingleton(mock(DataCleanerStep.class));
pico.addSingleton(mock(InvalidatePreviewCacheStep.class));
- pico.addSingleton(mock(ProjectDatabaseIndexationStep.class));
+ pico.addSingleton(mock(ComponentIndexationInDatabaseStep.class));
sut = new ComputationStepRegistry(pico);
}
SynchronizeProjectPermissionsStep.class,
SwitchSnapshotStep.class,
InvalidatePreviewCacheStep.class,
+ ComponentIndexationInDatabaseStep.class,
DataCleanerStep.class,
- ProjectDatabaseIndexationStep.class,
IndexProjectIssuesStep.class
);
List<ComputationStep> steps = sut.steps();
+++ /dev/null
-/*
- * 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 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.*;
-
-public class ProjectDatabaseIndexationStepTest {
-
- private ProjectDatabaseIndexationStep sut;
- private ResourceIndexerDao resourceIndexerDao;
-
- @Before
- public void before() {
- this.resourceIndexerDao = mock(ResourceIndexerDao.class);
- this.sut = new ProjectDatabaseIndexationStep(resourceIndexerDao);
- }
-
- @Test
- public void call_indexProject_of_dao() {
- ComponentDto project = mock(ComponentDto.class);
- when(project.getId()).thenReturn(123L);
-
- sut.execute(mock(DbSession.class), mock(AnalysisReportDto.class), project);
-
- verify(resourceIndexerDao).indexProject(123);
- }
-
-}