diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-06-09 14:42:48 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-06-09 14:42:48 +0200 |
commit | fd22355194b557f8b30cc5932d4bacb6a64b2a28 (patch) | |
tree | aaa7fd24917a973679c8d9ff5e6f4caf9a3f8380 | |
parent | dfa2f95f01b348afce27c2cc04a3898f8534e887 (diff) | |
download | sonarqube-fd22355194b557f8b30cc5932d4bacb6a64b2a28.tar.gz sonarqube-fd22355194b557f8b30cc5932d4bacb6a64b2a28.zip |
Remove deprecated stuff.
4 files changed, 0 insertions, 196 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/Batch.java b/sonar-batch/src/main/java/org/sonar/batch/Batch.java deleted file mode 100644 index 447161d3797..00000000000 --- a/sonar-batch/src/main/java/org/sonar/batch/Batch.java +++ /dev/null @@ -1,105 +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; - -import org.apache.commons.configuration.Configuration; -import org.apache.commons.lang.StringUtils; -import org.sonar.api.batch.bootstrap.ProjectReactor; -import org.sonar.batch.bootstrapper.Reactor; - -import java.util.Iterator; -import java.util.Properties; - -/** - * @deprecated in 2.14. Replaced by {@link org.sonar.batch.bootstrapper.Batch}. - */ -@Deprecated -public final class Batch { - - private Object[] bootstrapExtensions; - private ProjectReactor reactor; - - public Batch(ProjectReactor reactor, Object... bootstrapperComponents) { - this.reactor = reactor; - this.bootstrapExtensions = bootstrapperComponents; - } - - /** - * Used by sonar-runner 1.x and ant-task 1.x - * - * @deprecated since 2.9 because commons-configuration is replaced by ProjectDefinition#properties. Used by Ant Task 1.1 - */ - @Deprecated - public Batch(Configuration configuration, Object... bootstrapperComponents) { - // configuration is not needed - // because it's already included in ProjectDefinition. - this.bootstrapExtensions = bootstrapperComponents; - this.reactor = extractProjectReactor(bootstrapperComponents); - } - - /** - * Used by sonar-runner 2.0. - * - * @deprecated in version 2.12. - */ - @Deprecated - public static Batch create(ProjectReactor projectReactor, Configuration configuration, Object... bootstrapperComponents) { - if (configuration != null) { - projectReactor.getRoot().setProperties(convertToProperties(configuration)); - } - return new Batch(projectReactor, bootstrapperComponents); - } - - static Properties convertToProperties(Configuration configuration) { - Properties props = new Properties(); - Iterator keys = configuration.getKeys(); - while (keys.hasNext()) { - String key = (String) keys.next(); - // Configuration#getString() automatically splits strings by comma separator. - String value = StringUtils.join(configuration.getStringArray(key), ","); - props.setProperty(key, value); - } - return props; - } - - static ProjectReactor extractProjectReactor(Object[] components) { - Reactor deprecatedReactor = null; - for (Object component : components) { - if (component instanceof ProjectReactor) { - return (ProjectReactor) component; - } - if (component instanceof Reactor) { - deprecatedReactor = (Reactor) component; - } - } - - if (deprecatedReactor == null) { - throw new IllegalArgumentException("Project reactor is not defined"); - } - return deprecatedReactor.toProjectReactor(); - } - - public void execute() { - org.sonar.batch.bootstrapper.Batch.Builder builder = org.sonar.batch.bootstrapper.Batch.builder(); - builder.setProjectReactor(reactor); - builder.addComponents(bootstrapExtensions); - builder.build().execute(); - } -} diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java index fc5da97d56d..6e4ebd39b6a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ModuleScanContainer.java @@ -112,7 +112,6 @@ public class ModuleScanContainer extends ComponentContainer { EventBus.class, PhaseExecutor.class, PhasesTimeProfiler.class, - UnsupportedProperties.class, PhaseExecutor.getPhaseClasses(), moduleDefinition.getContainerExtensions(), diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/UnsupportedProperties.java b/sonar-batch/src/main/java/org/sonar/batch/scan/UnsupportedProperties.java deleted file mode 100644 index e7ec0b09f2a..00000000000 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/UnsupportedProperties.java +++ /dev/null @@ -1,42 +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; - -import org.sonar.api.BatchComponent; -import org.sonar.api.config.Settings; -import org.sonar.api.utils.MessageException; - -public class UnsupportedProperties implements BatchComponent { - private final Settings settings; - - public UnsupportedProperties(Settings settings) { - this.settings = settings; - } - - public void start() { - verify("sonar.light", "The property 'sonar.light' is no longer supported. Please use 'sonar.dynamicAnalysis'"); - } - - private void verify(String key, String message) { - if (settings.hasKey(key)) { - throw MessageException.of(message); - } - } -} diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/UnsupportedPropertiesTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/UnsupportedPropertiesTest.java deleted file mode 100644 index 2896b7f604c..00000000000 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/UnsupportedPropertiesTest.java +++ /dev/null @@ -1,48 +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; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.config.Settings; -import org.sonar.api.utils.MessageException; - -public class UnsupportedPropertiesTest { - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Test - public void should_fail_if_sonar_light_is_set() { - thrown.expect(MessageException.class); - thrown.expectMessage("The property 'sonar.light' is no longer supported. Please use 'sonar.dynamicAnalysis'"); - - Settings settings = new Settings(); - settings.setProperty("sonar.light", true); - new UnsupportedProperties(settings).start(); - } - - @Test - public void should_not_fail_if_sonar_light_is_not_set() { - Settings settings = new Settings(); - new UnsupportedProperties(settings).start(); - } -} |