aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java9
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/config/DeprecatedConfigurationProvider.java33
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/config/ProjectSettings.java13
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java38
5 files changed, 16 insertions, 85 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
index 06ce83b81de..43ca03aa5c0 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
@@ -70,7 +70,6 @@ public class ProjectConfigurator implements BatchComponent {
Date analysisDate = loadAnalysisDate();
project
.setConfiguration(new PropertiesConfiguration()) // will be populated by ProjectSettings
- .setExclusionPatterns(loadExclusionPatterns())
.setAnalysisDate(analysisDate)
.setLatestAnalysis(isLatestAnalysis(project.getKey(), analysisDate))
.setAnalysisVersion(loadAnalysisVersion())
@@ -79,14 +78,6 @@ public class ProjectConfigurator implements BatchComponent {
return this;
}
- String[] loadExclusionPatterns() {
- String[] exclusionPatterns = settings.getStringArray(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY);
- for (int i = 0; i < exclusionPatterns.length; i++) {
- exclusionPatterns[i] = StringUtils.trim(exclusionPatterns[i]);
- }
- return exclusionPatterns;
- }
-
boolean isLatestAnalysis(String projectKey, Date analysisDate) {
ResourceModel persistedProject = databaseSession.getSingleResult(ResourceModel.class, "key", projectKey, "enabled", true);
if (persistedProject != null) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
index 73997640662..134c0b0f6d9 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
@@ -33,7 +33,6 @@ import org.sonar.api.utils.IocContainer;
import org.sonar.api.utils.SonarException;
import org.sonar.batch.*;
import org.sonar.batch.components.TimeMachineConfiguration;
-import org.sonar.batch.config.DeprecatedConfigurationProvider;
import org.sonar.batch.config.ProjectSettings;
import org.sonar.batch.events.EventBus;
import org.sonar.batch.index.DefaultIndex;
@@ -70,7 +69,6 @@ public class ProjectModule extends Module {
addCoreSingleton(project);
addCoreSingleton(project.getConfiguration());
addCoreSingleton(ProjectSettings.class);
- addAdapter(new DeprecatedConfigurationProvider());
addCoreSingleton(IocContainer.class);
for (Object component : projectDefinition.getContainerExtensions()) {
@@ -134,9 +132,9 @@ public class ProjectModule extends Module {
DefaultIndex index = getComponentByType(DefaultIndex.class);
index.setCurrentProject(project,
- getComponentByType(ResourceFilters.class),
- getComponentByType(ViolationFilters.class),
- getComponentByType(RulesProfile.class));
+ getComponentByType(ResourceFilters.class),
+ getComponentByType(ViolationFilters.class),
+ getComponentByType(RulesProfile.class));
// TODO See http://jira.codehaus.org/browse/SONAR-2126
// previously MavenProjectBuilder was responsible for creation of ProjectFileSystem
diff --git a/sonar-batch/src/main/java/org/sonar/batch/config/DeprecatedConfigurationProvider.java b/sonar-batch/src/main/java/org/sonar/batch/config/DeprecatedConfigurationProvider.java
deleted file mode 100644
index 636a5adde25..00000000000
--- a/sonar-batch/src/main/java/org/sonar/batch/config/DeprecatedConfigurationProvider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 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.apache.commons.configuration.Configuration;
-import org.picocontainer.injectors.ProviderAdapter;
-import org.sonar.api.resources.Project;
-
-public class DeprecatedConfigurationProvider extends ProviderAdapter {
-
- public Configuration provide(Project project, ProjectSettings settings) {//NOSONAR the parameter ProjectSettings is declared to be sure that it is initialized
- // configuration is valid because it has been updated by ProjectSettings
- return project.getConfiguration();
- }
-}
-
diff --git a/sonar-batch/src/main/java/org/sonar/batch/config/ProjectSettings.java b/sonar-batch/src/main/java/org/sonar/batch/config/ProjectSettings.java
index 7a7fb5a1886..6a37e61e5a5 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/config/ProjectSettings.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/config/ProjectSettings.java
@@ -29,6 +29,7 @@ import org.sonar.api.resources.Project;
import org.sonar.core.config.ConfigurationUtils;
import org.sonar.jpa.session.DatabaseSessionFactory;
+import java.util.Iterator;
import java.util.List;
/**
@@ -88,7 +89,19 @@ public class ProjectSettings extends Settings {
}
private void updateDeprecatedCommonsConfiguration() {
+ System.out.println("---------- SETTINGS -------------");
+ for (String s : properties.keySet()) {
+ System.out.println(s + "=" + properties.get(s));
+ }
ConfigurationUtils.copyToCommonsConfiguration(properties, deprecatedCommonsConf);
+
+ System.out.println("---------- DEP CONF -------------");
+ Iterator keys = deprecatedCommonsConf.getKeys();
+ while(keys.hasNext()) {
+ String key = (String)keys.next();
+ System.out.println(key + "=" + deprecatedCommonsConf.getString(key));
+ }
+ System.out.println("----------------------------------");
}
/**
diff --git a/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
index 3d556413ee8..ddeb6bd0204 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/ProjectConfiguratorTest.java
@@ -37,44 +37,6 @@ import static org.junit.Assert.assertTrue;
public class ProjectConfiguratorTest extends AbstractDbUnitTestCase {
@Test
- public void testNoExclusionPatterns() {
- Project project = new Project("key");
- new ProjectConfigurator(getSession(), new Settings()).configure(project);
- assertThat(project.getExclusionPatterns().length, is(0));
- }
-
- @Test
- public void testManyExclusionPatterns() {
- Settings settings = new Settings();
- settings.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, "**/*,foo,*/bar");
-
- Project project = new Project("key");
- new ProjectConfigurator(getSession(), settings).configure(project);
-
- assertThat(project.getExclusionPatterns().length, is(3));
- assertThat(project.getExclusionPatterns()[0], is("**/*"));
- assertThat(project.getExclusionPatterns()[1], is("foo"));
- assertThat(project.getExclusionPatterns()[2], is("*/bar"));
- }
-
- /**
- * See http://jira.codehaus.org/browse/SONAR-2261
- * Note that several exclusions separated by comma would be correctly trimmed by commons-configuration library.
- * So issue is only with a single pattern, which contains spaces.
- */
- @Test
- public void trimExclusionPatterns() {
- Settings configuration = new Settings();
- configuration.setProperty(CoreProperties.PROJECT_EXCLUSIONS_PROPERTY, " foo ");
-
- Project project = new Project("key");
- new ProjectConfigurator(getSession(), configuration).configure(project);
-
- assertThat(project.getExclusionPatterns().length, is(1));
- assertThat(project.getExclusionPatterns()[0], is("foo"));
- }
-
- @Test
public void getLanguageFromConfiguration() {
Settings configuration = new Settings();
configuration.setProperty(CoreProperties.PROJECT_LANGUAGE_PROPERTY, "foo");