From a067ae93be8a7303a94b901b0b3e8cd212c19788 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Fri, 31 Oct 2014 10:54:32 +0100 Subject: SONAR-5795 Move project indexation post job on server side --- .../java/org/sonar/plugins/core/CorePlugin.java | 2 - .../plugins/core/batch/IndexProjectPostJob.java | 45 ------------------ .../org/sonar/plugins/core/batch/package-info.java | 26 ----------- .../core/batch/IndexProjectPostJobTest.java | 53 ---------------------- 4 files changed, 126 deletions(-) delete mode 100644 plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java delete mode 100644 plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/package-info.java delete mode 100644 plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.java (limited to 'plugins') 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/IndexProjectPostJob.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java deleted file mode 100644 index c8f73204e98..00000000000 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/IndexProjectPostJob.java +++ /dev/null @@ -1,45 +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.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; -import org.sonar.core.resource.ResourceIndexerDao; - -/** - * @since 2.13 - */ -@DryRunIncompatible -public class IndexProjectPostJob implements PostJob { - private ResourceIndexerDao indexer; - - public IndexProjectPostJob(ResourceIndexerDao indexer) { - this.indexer = indexer; - } - - @Override - public void executeOn(Project project, SensorContext context) { - if (project.getId() != null) { - indexer.indexProject(project.getId()); - } - } -} 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/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.java deleted file mode 100644 index c63e8908275..00000000000 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/batch/IndexProjectPostJobTest.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.plugins.core.batch; - -import org.junit.Test; -import org.sonar.api.resources.Project; -import org.sonar.core.resource.ResourceIndexerDao; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; - -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); - - job.executeOn(project, null); - - verify(indexer).indexProject(123); - } - - @Test - public void shouldNotIndexProjectIfMissingId() { - ResourceIndexerDao indexer = mock(ResourceIndexerDao.class); - IndexProjectPostJob job = new IndexProjectPostJob(indexer); - - job.executeOn(new Project("foo"), null); - - verifyZeroInteractions(indexer); - } - -} -- cgit v1.2.3