Project.AnalysisType loadAnalysisType() {
String value = settings.getString(CoreProperties.DYNAMIC_ANALYSIS_PROPERTY);
if (value == null) {
- return ("true".equals(settings.getString("sonar.light")) ? Project.AnalysisType.STATIC : Project.AnalysisType.DYNAMIC);
+ return Project.AnalysisType.DYNAMIC;
}
if ("true".equals(value)) {
return Project.AnalysisType.DYNAMIC;
import org.sonar.batch.*;
import org.sonar.batch.components.TimeMachineConfiguration;
import org.sonar.batch.config.ProjectSettings;
+import org.sonar.batch.config.UnsupportedProperties;
import org.sonar.batch.events.EventBus;
import org.sonar.batch.index.DefaultIndex;
import org.sonar.batch.index.DefaultResourcePersister;
addCoreSingleton(project.getConfiguration());
addCoreSingleton(ProjectInitializer.class);
addCoreSingleton(ProjectSettings.class);
+ addCoreSingleton(UnsupportedProperties.class);
addCoreSingleton(IocContainer.class);
for (Object component : projectDefinition.getContainerExtensions()) {
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar 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.
+ *
+ * Sonar 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 Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.batch.config;
+
+import org.sonar.api.BatchComponent;
+import org.sonar.api.config.Settings;
+
+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 new IllegalArgumentException(message);
+ }
+ }
+}
new ProjectConfigurator(getSession(), configuration).configure(project);
}
- @Test
- public void sonarLightIsDeprecated() {
- Settings configuration = new Settings();
- configuration.setProperty("sonar.light", "true");
- Project project = new Project("key");
- new ProjectConfigurator(getSession(), configuration).configure(project);
-
- assertThat(project.getAnalysisType(), is(Project.AnalysisType.STATIC));
- }
-
@Test
public void defaultAnalysisTypeIsDynamic() {
Project project = new Project("key");
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar 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.
+ *
+ * Sonar 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 Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.batch.config;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.sonar.api.config.Settings;
+
+public class UnsupportedPropertiesTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void should_fail_if_sonar_light_is_set() {
+ Settings settings = new Settings();
+ settings.setProperty("sonar.light", true);
+
+ thrown.expect(IllegalArgumentException.class);
+ new UnsupportedProperties(settings).start();
+ }
+
+ @Test
+ public void should_not_fail_if_sonar_light_is_not_set() {
+ Settings settings = new Settings();
+ new UnsupportedProperties(settings).start();
+ }
+}