]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5186 Drop support of "sonar.phase"
authorJulien HENRY <julien.henry@sonarsource.com>
Thu, 3 Apr 2014 15:09:44 +0000 (17:09 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Thu, 3 Apr 2014 15:10:11 +0000 (17:10 +0200)
sonar-batch/src/main/java/org/sonar/batch/phases/PhaseExecutor.java
sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPhaseExecutor.java [deleted file]
sonar-batch/src/test/java/org/sonar/batch/scan/maven/MavenPhaseExecutorTest.java [deleted file]

index 840c9ec88693ab2cdf21bf279027ce3767306586..0ba16ea66d78cb223b9eb7f147b231d4645d3d3a 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader;
 import org.sonar.batch.rule.QProfileVerifier;
 import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem;
 import org.sonar.batch.scan.filesystem.FileSystemLogger;
-import org.sonar.batch.scan.maven.MavenPhaseExecutor;
 import org.sonar.batch.scan.maven.MavenPluginsConfigurator;
 import org.sonar.batch.scan.report.JsonReport;
 
@@ -46,7 +45,6 @@ public final class PhaseExecutor {
   private final EventBus eventBus;
   private final Phases phases;
   private final DecoratorsExecutor decoratorsExecutor;
-  private final MavenPhaseExecutor mavenPhaseExecutor;
   private final MavenPluginsConfigurator mavenPluginsConfigurator;
   private final PostJobsExecutor postJobsExecutor;
   private final InitializersExecutor initializersExecutor;
@@ -63,7 +61,7 @@ public final class PhaseExecutor {
   private final QProfileVerifier profileVerifier;
   private final IssueExclusionsLoader issueExclusionsLoader;
 
-  public PhaseExecutor(Phases phases, DecoratorsExecutor decoratorsExecutor, MavenPhaseExecutor mavenPhaseExecutor,
+  public PhaseExecutor(Phases phases, DecoratorsExecutor decoratorsExecutor,
     MavenPluginsConfigurator mavenPluginsConfigurator, InitializersExecutor initializersExecutor,
     PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor,
     PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index,
@@ -72,7 +70,6 @@ public final class PhaseExecutor {
     IssueExclusionsLoader issueExclusionsLoader) {
     this.phases = phases;
     this.decoratorsExecutor = decoratorsExecutor;
-    this.mavenPhaseExecutor = mavenPhaseExecutor;
     this.mavenPluginsConfigurator = mavenPluginsConfigurator;
     this.postJobsExecutor = postJobsExecutor;
     this.initializersExecutor = initializersExecutor;
@@ -91,18 +88,18 @@ public final class PhaseExecutor {
     this.issueExclusionsLoader = issueExclusionsLoader;
   }
 
-  public PhaseExecutor(Phases phases, DecoratorsExecutor decoratorsExecutor, MavenPhaseExecutor mavenPhaseExecutor,
+  public PhaseExecutor(Phases phases, DecoratorsExecutor decoratorsExecutor,
     MavenPluginsConfigurator mavenPluginsConfigurator, InitializersExecutor initializersExecutor,
     PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor,
     PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index,
     EventBus eventBus, ProjectInitializer pi, ScanPersister[] persisters, FileSystemLogger fsLogger, JsonReport jsonReport,
     DefaultModuleFileSystem fs, QProfileVerifier profileVerifier, IssueExclusionsLoader issueExclusionsLoader) {
-    this(phases, decoratorsExecutor, mavenPhaseExecutor, mavenPluginsConfigurator, initializersExecutor, postJobsExecutor,
+    this(phases, decoratorsExecutor, mavenPluginsConfigurator, initializersExecutor, postJobsExecutor,
       sensorsExecutor, persistenceManager, sensorContext, index, eventBus, null, pi, persisters, fsLogger, jsonReport, fs, profileVerifier, issueExclusionsLoader);
   }
 
   public static Collection<Class> getPhaseClasses() {
-    return Lists.<Class>newArrayList(DecoratorsExecutor.class, MavenPhaseExecutor.class, MavenPluginsConfigurator.class,
+    return Lists.<Class>newArrayList(DecoratorsExecutor.class, MavenPluginsConfigurator.class,
       PostJobsExecutor.class, SensorsExecutor.class,
       InitializersExecutor.class, ProjectInitializer.class, UpdateStatusJob.class);
   }
@@ -188,7 +185,6 @@ public final class PhaseExecutor {
     if (phases.isEnabled(Phases.Phase.MAVEN)) {
       eventBus.fireEvent(new MavenPhaseEvent(true));
       mavenPluginsConfigurator.execute(module);
-      mavenPhaseExecutor.execute(module);
       eventBus.fireEvent(new MavenPhaseEvent(false));
     }
   }
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPhaseExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/scan/maven/MavenPhaseExecutor.java
deleted file mode 100644 (file)
index 2712e2d..0000000
+++ /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.batch.scan.maven;
-
-import com.google.common.base.Strings;
-import org.sonar.api.BatchComponent;
-import org.sonar.api.config.Settings;
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.resources.Project;
-import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem;
-
-public class MavenPhaseExecutor implements BatchComponent {
-
-  public static final String PROP_PHASE = "sonar.phase";
-
-  private final MavenPluginExecutor executor;
-  private final DefaultModuleFileSystem fs;
-  private final Settings settings;
-  private final DatabaseSession session;
-
-  public MavenPhaseExecutor(DefaultModuleFileSystem fs, MavenPluginExecutor executor, Settings settings, DatabaseSession session) {
-    this.fs = fs;
-    this.executor = executor;
-    this.settings = settings;
-    this.session = session;
-  }
-
-  public void execute(Project project) {
-    // SONAR-2965 In case the Maven phase takes too much time we close the session to not face a timeout
-    session.commitAndClose();
-    String mavenPhase = settings.getString(PROP_PHASE);
-    if (!Strings.isNullOrEmpty(mavenPhase)) {
-      executor.execute(project, fs, mavenPhase);
-    }
-  }
-}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/maven/MavenPhaseExecutorTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/maven/MavenPhaseExecutorTest.java
deleted file mode 100644 (file)
index 7cae730..0000000
+++ /dev/null
@@ -1,60 +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.batch.scan.maven;
-
-import org.junit.Test;
-import org.sonar.api.config.Settings;
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.resources.Project;
-import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem;
-
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-public class MavenPhaseExecutorTest {
-
-  @Test
-  public void doNothingIfNoPhase() {
-    DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
-    MavenPluginExecutor mavenPluginExecutor = mock(MavenPluginExecutor.class);
-    MavenPhaseExecutor phaseExecutor = new MavenPhaseExecutor(fs, mavenPluginExecutor, new Settings(), mock(DatabaseSession.class));
-
-    Project project = new Project("key");
-    phaseExecutor.execute(project);
-
-    verify(mavenPluginExecutor, never()).execute(eq(project), eq(fs), anyString());
-  }
-
-  @Test
-  public void executePhase() {
-    DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
-    MavenPluginExecutor mavenPluginExecutor = mock(MavenPluginExecutor.class);
-    Settings settings = new Settings().setProperty(MavenPhaseExecutor.PROP_PHASE, "foo");
-    MavenPhaseExecutor phaseExecutor = new MavenPhaseExecutor(fs, mavenPluginExecutor, settings, mock(DatabaseSession.class));
-
-    Project project = mock(Project.class);
-    phaseExecutor.execute(project);
-
-    verify(mavenPluginExecutor).execute(project, fs, "foo");
-  }
-}