diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-27 14:27:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-28 09:29:05 +0200 |
commit | 386e6a13b460e25ad032004d3635b071bf91e104 (patch) | |
tree | fd223fb5d79b39e6882ab83e5bf5dec5f5fed0db /sonar-core/src/test | |
parent | 92f01954fc68bcbe8004b1e8433a469ca67118e7 (diff) | |
download | sonarqube-386e6a13b460e25ad032004d3635b071bf91e104.tar.gz sonarqube-386e6a13b460e25ad032004d3635b071bf91e104.zip |
SONAR-6370 drop core plugin
The core plugin was highly coupled with core, so it did not respect classloader isolation
as other plugins.
Diffstat (limited to 'sonar-core/src/test')
-rw-r--r-- | sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java b/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java index 110694aff65..9cd5a7ff7bc 100644 --- a/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java +++ b/sonar-core/src/test/java/org/sonar/core/i18n/DefaultI18nTest.java @@ -19,6 +19,10 @@ */ package org.sonar.core.i18n; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -29,13 +33,6 @@ import org.sonar.api.utils.System2; import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; -import java.util.TimeZone; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -51,7 +48,7 @@ public class DefaultI18nTest { @Before public void before() { PluginRepository pluginRepository = mock(PluginRepository.class); - List<PluginInfo> plugins = Arrays.asList(newPlugin("core"), newPlugin("sqale"), newPlugin("frpack"), newPlugin("checkstyle"), newPlugin("other")); + List<PluginInfo> plugins = Arrays.asList(newPlugin("sqale"), newPlugin("frpack"), newPlugin("checkstyle"), newPlugin("other")); when(pluginRepository.getPluginInfos()).thenReturn(plugins); manager = new DefaultI18n(pluginRepository, system2); @@ -59,12 +56,8 @@ public class DefaultI18nTest { } @Test - public void load_core_bundle_when_no_plugin() { - DefaultI18n manager = new DefaultI18n(mock(PluginRepository.class), system2); - manager.doStart(getClass().getClassLoader()); - - assertThat(manager.getPropertyKeys().contains("any")).isTrue(); - assertThat(manager.getPropertyKeys().contains("assignee")).isTrue(); + public void load_core_bundle() { + assertThat(manager.message(Locale.ENGLISH, "any", null)).isEqualTo("Any"); } @Test @@ -196,32 +189,6 @@ public class DefaultI18nTest { assertThat(manager.formatInteger(Locale.ENGLISH, 100000)).isEqualTo("100,000"); } - static URLClassLoader newCheckstyleClassloader() { - return newClassLoader("/org/sonar/core/i18n/I18nClassloaderTest/"); - } - - /** - * Example of plugin that embeds its own translations (English + French). - */ - static URLClassLoader newSqaleClassloader() { - return newClassLoader("/org/sonar/core/i18n/sqalePlugin/"); - } - - /** - * "Language Pack" contains various translations for different plugins. - */ - static URLClassLoader newFrenchPackClassloader() { - return newClassLoader("/org/sonar/core/i18n/frenchPack/"); - } - - private static URLClassLoader newClassLoader(String... resourcePaths) { - URL[] urls = new URL[resourcePaths.length]; - for (int index = 0; index < resourcePaths.length; index++) { - urls[index] = DefaultI18nTest.class.getResource(resourcePaths[index]); - } - return new URLClassLoader(urls); - } - private PluginInfo newPlugin(String key) { PluginInfo plugin = mock(PluginInfo.class); when(plugin.getKey()).thenReturn(key); |