diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-08-02 10:45:09 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-08-02 10:45:09 +0200 |
commit | 83b82ab901cc516b9628560989ef84a326e36e0d (patch) | |
tree | 11d3dd84a4c6d9e4c9c74b9463b7702e313b1874 /sonar-batch | |
parent | eb948a5d6043bbc73fa7449d912c7ad7cb0b0d94 (diff) | |
download | sonarqube-83b82ab901cc516b9628560989ef84a326e36e0d.tar.gz sonarqube-83b82ab901cc516b9628560989ef84a326e36e0d.zip |
Revert SONAR-4515 as current implementation breaks views
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/ProfileProvider.java | 12 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/ProfileProviderTest.java | 35 |
2 files changed, 3 insertions, 44 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProfileProvider.java b/sonar-batch/src/main/java/org/sonar/batch/ProfileProvider.java index a645c9e99a1..cc34e85c299 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/ProfileProvider.java +++ b/sonar-batch/src/main/java/org/sonar/batch/ProfileProvider.java @@ -19,15 +19,12 @@ */ package org.sonar.batch; -import com.google.common.base.Joiner; import org.picocontainer.injectors.ProviderAdapter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.config.Settings; import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Languages; import org.sonar.api.resources.Project; -import org.sonar.api.utils.SonarException; public class ProfileProvider extends ProviderAdapter { @@ -35,15 +32,8 @@ public class ProfileProvider extends ProviderAdapter { private RulesProfile profile; - public RulesProfile provide(Project project, ProfileLoader profileLoader, Settings settings, Languages languages) { + public RulesProfile provide(Project project, ProfileLoader profileLoader, Settings settings) { if (profile == null) { - // TODO Move this check to ProjectReactorValidator when Languages is available as TaskComponent - if (!languages.allKey().contains(project.getLanguageKey())) { - String languageList = Joiner.on(", ").join(languages.allKey()); - throw new SonarException("You must install a plugin that supports the language '" + project.getLanguageKey() + - "'. Supported language keys are: " + languageList); - } - profile = profileLoader.load(project, settings); LOG.info("Quality profile : {}", profile); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/ProfileProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/ProfileProviderTest.java index 4276ee3b404..f0bac78d121 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/ProfileProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/ProfileProviderTest.java @@ -26,11 +26,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.config.Settings; import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.AbstractLanguage; -import org.sonar.api.resources.Language; -import org.sonar.api.resources.Languages; import org.sonar.api.resources.Project; -import org.sonar.api.utils.SonarException; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; @@ -47,22 +43,9 @@ public class ProfileProviderTest { public ExpectedException thrown = ExpectedException.none(); private Project javaProject; - private Languages languages; @Before public void setUp() { - - Language java = new AbstractLanguage("java", "Java") { - public String[] getFileSuffixes() { - return null; - }; - }; - Language cobol = new AbstractLanguage("js", "JavaScript") { - public String[] getFileSuffixes() { - return null; - }; - }; - languages = new Languages(java, cobol); javaProject = newProject("java"); } @@ -73,26 +56,12 @@ public class ProfileProviderTest { RulesProfile profile = RulesProfile.create(); when(loader.load(eq(javaProject), any(Settings.class))).thenReturn(profile); - assertThat(provider.provide(javaProject, loader, new Settings(), languages), is(profile)); - assertThat(provider.provide(javaProject, loader, new Settings(), languages), is(profile)); + assertThat(provider.provide(javaProject, loader, new Settings()), is(profile)); + assertThat(provider.provide(javaProject, loader, new Settings()), is(profile)); verify(loader).load(eq(javaProject), any(Settings.class)); verifyNoMoreInteractions(loader); } - /** - * SONAR-4515 - */ - @Test - public void should_give_explicit_message_if_language_not_found() { - Project cobolProject = newProject("cobol"); - - ProfileProvider provider = new ProfileProvider(); - - thrown.expect(SonarException.class); - thrown.expectMessage("You must install a plugin that supports the language 'cobol'. Supported language keys are: java, js"); - provider.provide(cobolProject, mock(ProfileLoader.class), new Settings(), languages); - } - private Project newProject(String language) { PropertiesConfiguration configuration = new PropertiesConfiguration(); configuration.setProperty("sonar.language", language); |