aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin/src
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-07-13 18:08:34 +0200
committerFabrice Bellingard <bellingard@gmail.com>2011-07-13 18:08:34 +0200
commit868c0dfe9c18db210ddb9043ef53d69b0e59c4ca (patch)
treeacd82072b510ff1da7c7e577837574b3bd9688e0 /plugins/sonar-core-plugin/src
parentdff9de8cb6b737135050e29bde0c558dee88424a (diff)
downloadsonarqube-868c0dfe9c18db210ddb9043ef53d69b0e59c4ca.tar.gz
sonarqube-868c0dfe9c18db210ddb9043ef53d69b0e59c4ca.zip
SONAR-2589 Creation of a I18n English Pack
- Creation of the plugin - Modification the I18nManager to read keys from this plugin in the first place
Diffstat (limited to 'plugins/sonar-core-plugin/src')
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java24
-rwxr-xr-xplugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties595
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java39
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java18
-rwxr-xr-xplugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jarbin0 -> 767 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/META-INF/MANIFEST.MF (renamed from plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/META-INF/MANIFEST.MF)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test.properties (renamed from plugins/sonar-core-plugin/src/test/resources/StandardPlugin/org/sonar/i18n/test.properties)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jar (renamed from plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jar)bin1058 -> 1058 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/META-INF/MANIFEST.MF (renamed from plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/META-INF/MANIFEST.MF)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties (renamed from plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin.jar (renamed from plugins/sonar-core-plugin/src/test/resources/QuebecPlugin.jar)bin1051 -> 1051 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/META-INF/MANIFEST.MF (renamed from plugins/sonar-core-plugin/src/test/resources/StandardPlugin/META-INF/MANIFEST.MF)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties (renamed from plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jarbin1068 -> 0 bytes
14 files changed, 71 insertions, 605 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
index 50df7fc5dfd..b8a4c4e5472 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
@@ -76,12 +76,31 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
void doStart(List<InstalledPlugin> installedPlugins) {
Logs.INFO.info("Loading i18n bundles");
Set<URI> alreadyLoadedResources = Sets.newHashSet();
+ LanguagePack englishPack = findEnglishPack();
+
for (InstalledPlugin plugin : installedPlugins) {
- searchAndStoreBundleNames(plugin.key, plugin.classloader, alreadyLoadedResources);
+ searchAndStoreBundleNames(plugin.key, englishPack.getClass().getClassLoader(), alreadyLoadedResources);
}
+
for (LanguagePack pack : languagePacks) {
- addLanguagePack(pack);
+ if ( !pack.equals(englishPack)) {
+ addLanguagePack(pack);
+ }
+ }
+ }
+
+ private LanguagePack findEnglishPack() {
+ LanguagePack englishPack = null;
+ for (LanguagePack pack : languagePacks) {
+ if (pack.getLocales().contains(Locale.ENGLISH)) {
+ englishPack = pack;
+ break;
+ }
+ }
+ if (englishPack == null) {
+ throw new SonarException("The I18n English Pack was not found.");
}
+ return englishPack;
}
private void addLanguagePack(LanguagePack languagePack) {
@@ -102,6 +121,7 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
return packagePathToSearchIn + "/" + pluginKey;
}
+ @SuppressWarnings("unchecked")
private void searchAndStoreBundleNames(String pluginKey, ClassLoader classloader, Set<URI> alreadyLoadedResources) {
String bundleBaseName = buildBundleBaseName(pluginKey);
String bundleDefaultPropertiesFile = bundleBaseName + ".properties";
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties
deleted file mode 100755
index f3f0233862e..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties
+++ /dev/null
@@ -1,595 +0,0 @@
-view.coverage.title=Coverage
-view.org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.title=Duplications
-view.source.title=Source
-view.violations.title=Violations
-
-view.size.lines_of_code=Lines of code
-view.size.classes=Classes
-view.size.files=Files
-view.size.generated_suffix=\ generated
-view.size.lines_suffix=\ lines
-view.size.statements_suffix=\ statements
-view.size.files_suffix=\ files
-view.size.packages_suffix=\ packages
-view.size.directories_suffix=\ directories
-view.size.methods_suffix=\ methods
-view.size.accessors_suffix=\ accessors
-view.size.paragraphs_suffix=\ paragraphs
-
-
-#------------------------------------------------------------------------------
-#
-# GENERIC WORDS, sorted alphabetically
-#
-#------------------------------------------------------------------------------
-
-add_verb=Add
-and=And
-author=Author
-ascending=Ascending
-build_date=Build date
-cancel=Cancel
-change_verb=Change
-class=Class
-classes=Classes
-color=Color
-criteria=Criteria
-date=Date
-days=Days
-delete=Delete
-descending=Descending
-directory=Directory
-directories=Directories
-display=Display
-edit=Edit
-file=File
-files=Files
-key=Key
-language=Language
-library=Library
-links=Links
-login=Login
-max=Max
-min=Min
-name=Name
-none=None
-operations=Operations
-order=Order
-package=Package
-packages=Packages
-password=Password
-path=Path
-project=Project
-projects=Projects
-reset_verb=Reset
-search_verb=Search
-shared=Shared
-view=View
-views=Views
-result=Result
-select_verb=Select
-size=Size
-sub_project=Sub-project
-sub_projects=Sub-projects
-sub_view=Sub-view
-sub_views=Sub-views
-table=Table
-treemap=Treemap
-unfollow=Unfollow
-unit_test=Unit test
-unit_tests=Unit tests
-value=Value
-variarion=Variation
-version=Version
-
-
-#------------------------------------------------------------------------------
-#
-# GENERIC EXPRESSIONS, sorted alphabetically
-#
-#------------------------------------------------------------------------------
-
-alerts_feed=Alerts feed
-delta_since_previous_analysis=&Delta; since previous analysis
-delta_over_x_days=&Delta; over {0} days
-delta_since=&Delta; since {0}
-delta_since_version=&Delta; since version {0}
-equals=Equals
-greater_or_equals=Greater or equals
-greater_than=Greater than
-less_or_equals=Less or equals
-less_than=Less than
-move_left=Move left
-move_right=Move right
-no_results=No results
-page_size=Page size
-remove_column=Remove this column
-results_not_display_due_to_security=Due to security settings, some results are not being displayed.
-save_and_close=Save & Close
-save_and_preview=Save & Preview
-select_a_metric=Select a metric
-time_changes=Time changes
-
-
-#------------------------------------------------------------------------------
-#
-# LAYOUT
-#
-#------------------------------------------------------------------------------
-
-layout.home=Home
-layout.login=Log in
-layout.logout=Log out
-layout.configuration=Configuration
-layout.print=Print
-layout.permalink=Permalink
-layout.sonar.slogan=Embrace Quality
-layout.powered_by=Powered by
-layout.plugins=Plugins
-layout.documentation=Documentation
-layout.ask_a_questions=Ask a question
-layout.bug_feature_request=Bug/feature request
-
-sidebar.project_system=System
-sidebar.security=Security
-sidebar.system=System
-
-
-#------------------------------------------------------------------------------
-#
-# PAGES
-#
-#------------------------------------------------------------------------------
-
-clouds.page=Clouds
-
-components.page=Components
-components.size=Size
-components.color=Color
-
-backup.page=Backup
-default_dashboards.page=Default dashboards
-default_filters.page=Default filters
-dependencies.page=Dependencies
-event_categories.page=Event categories
-filters.page=Filters
-filters.size=Size
-filters.color=Color
-global_roles.page=Global roles
-manual_metrics.page=Manual metrics
-my_profile.page=My profile
-project_roles.page=Project roles
-project_settings.page=Settings
-quality_profiles.page=Quality profiles
-reviews.page=Reviews
-settings.page=Settings
-timemachine.page=Time Machine
-user_groups.page=Groups
-users.page=Users
-violations_drilldown.page=Violations drilldown
-system_info.page=System Info
-update_center.page=Update Center
-org.sonar.plugins.core.hotspots.GwtHotspots.page=Hotspots
-
-
-#------------------------------------------------------------------------------
-#
-# SESSION
-#
-#------------------------------------------------------------------------------
-
-sessions.remember_me=Remember me on this computer
-sessions.log_in=Log in
-
-
-#------------------------------------------------------------------------------
-#
-# FILTERS
-#
-#------------------------------------------------------------------------------
-
-filters.add_filter=Add filter
-filters.edit_filter=Edit filter
-filters.manage_filters=Manage filters
-filters.search_for=Search for
-filters.advanced_search=Advanced search
-filters.default_period=Default period
-filters.when_no_language_no_filter_apply=When no language is selected, no filter will apply
-filters.favourite_only=Favourites only
-filters.resource_key_like=Resource key like
-filters.use_star_to_match=Use the character * to match zero or more characters.
-filters.resource_name_like=Resource name like
-filters.do_you_want_to_delete=Do you want to delete this filter ?
-filters.during_last=During last
-filters.prior_to_last=Prior to last
-filters.search_by_name=Search by name
-filters.display_as=Display as
-filters.add_column=Add column
-filters.default_sorted_column=Default sorted column
-filters.treemap_not_supported_for_period_selection=Treemap does not support yet the selection of a period.
-filters.my_filters=My filters
-filters.no_filters=No filters
-filters.do_you_want_to_stop_following=Do you want to stop following this filter ?
-filters.shared_filters=Shared filters
-filters.shared_filters_description=These filters are shared by administrators and can be followed without copying them.
-
-
-#------------------------------------------------------------------------------
-#
-# METRIC DOMAINS
-#
-#------------------------------------------------------------------------------
-
-domain.Size=Size
-domain.Tests=Tests
-domain.Complexity=Complexity
-domain.Documentation=Documentation
-domain.Rules=Rules
-domain.General=General
-domain.Duplication=Duplication
-domain.Design=Design
-domain.SCM=SCM
-domain.Management=Management
-
-
-#------------------------------------------------------------------------------
-#
-# METRICS
-#
-#------------------------------------------------------------------------------
-
-metric.accessors.name=Accessors
-metric.accessors.description=Accessors
-
-metric.alert_status.name=Alert
-metric.alert_status.description=Alert
-
-metric.classes.name=Classes
-metric.classes.description=Classes
-
-metric.comment_blank_lines.name=Blank comments
-metric.comment_blank_lines.description=Comments that do not contain comments
-
-metric.comment_lines.name=Comment lines
-metric.comment_lines.description=Number of comment lines
-
-metric.comment_lines_density.name=Comments (%)
-metric.comment_lines_density.description=Comments balanced by ncloc + comment lines
-
-metric.commented_out_code_lines.name=Commented LOCs
-metric.commented_out_code_lines.description=Commented lines of code
-
-metric.complexity.name=Complexity
-metric.complexity.description=Cyclomatic complexity
-
-metric.directories.name=Directories
-metric.directories.description=Directories
-
-metric.files.name=Files
-metric.files.description=Number of files
-
-metric.functions.name=Methods
-metric.functions.description=Methods
-
-metric.generated_lines.name=Generated Lines
-metric.generated_lines.description=Number of generated lines
-
-metric.generated_ncloc.name=Generated lines of code
-metric.generated_ncloc.description=Generated non Commenting Lines of Code
-
-metric.lines.name=Lines
-metric.lines.description=Lines
-
-metric.ncloc.name=Lines of code
-metric.ncloc.description=Non Commenting Lines of Code
-
-metric.packages.name=Packages
-metric.packages.description=Packages
-
-metric.paragraphs.name=Paragraphs
-metric.paragraphs.description=Number of paragraphs
-
-metric.public_api.name=Public API
-metric.public_api.description=Public API
-
-metric.public_documented_api_density.name=Public documented API (%)
-metric.public_documented_api_density.description=Public documented classes and methods balanced by ncloc
-
-metric.public_undocumented_api.name=Public undocumented API
-metric.public_undocumented_api.description=Public undocumented classes, methods and variables
-
-metric.statements.name=Statements
-metric.statements.description=Number of statements
-
-
-
-metric.class_complexity.name=Complexity /class
-metric.class_complexity.description=Complexity average by class
-
-metric.function_complexity.name=Complexity /method
-metric.function_complexity.description=Complexity average by method
-
-metric.file_complexity.name=Complexity /file
-metric.file_complexity.description=Complexity average by file
-
-metric.paragraph_complexity.name=Complexity /paragraph
-metric.paragraph_complexity.description=Complexity average by paragraph
-
-metric.class_complexity_distribution.name=Classes distribution /complexity
-metric.class_complexity_distribution.description=Classes distribution /complexity
-
-metric.function_complexity_distribution.name=Functions distribution /complexity
-metric.function_complexity_distribution.description=Functions distribution /complexity
-
-metric.file_complexity_distribution.name=Files distribution /complexity
-metric.file_complexity_distribution.description=Files distribution /complexity
-
-metric.paragraph_complexity_distribution.name=Paragraph distribution /complexity
-metric.paragraph_complexity_distribution.description=Paragraph distribution /complexity
-
-#--------------------------------------------------------------------------------------------------------------------
-#
-# UNIT TESTS
-#
-#--------------------------------------------------------------------------------------------------------------------
-
-metric.tests.name=Unit tests
-metric.tests.description=Number of unit tests
-
-metric.test_execution_time.name=Unit tests duration
-metric.test_execution_time.description=Execution duration of unit tests
-
-metric.test_errors.name=Unit test errors
-metric.test_errors.description=Number of unit test errors
-
-metric.skipped_tests.name=Skipped unit tests
-metric.skipped_tests.description=Number of skipped unit tests
-
-metric.test_failures.name=Unit test failures
-metric.test_failures.description=Number of unit test failures
-
-metric.test_success_density.name=Unit test success (%)
-metric.test_success_density.description=Density of successful unit tests
-
-metric.test_data.name=Unit tests details
-metric.test_data.description=Unit tests details
-
-metric.coverage.name=Coverage
-metric.coverage.description=Coverage by unit tests
-
-metric.new_coverage.name=New coverage
-metric.new_coverage.description=Coverage of new/changed code
-
-metric.lines_to_cover.name=Lines to cover
-metric.lines_to_cover.description=Lines to cover
-
-metric.new_lines_to_cover.name=New lines to cover
-metric.new_lines_to_cover.description=New lines to cover
-
-metric.uncovered_lines.name=Uncovered lines
-metric.uncovered_lines.description=Uncovered lines
-
-metric.new_uncovered_lines.name=New uncovered lines
-metric.new_uncovered_lines.description=New uncovered lines
-
-metric.line_coverage.name=Line coverage
-metric.line_coverage.description=Line coverage
-
-metric.new_line_coverage.name=New line coverage
-metric.new_line_coverage.description=Line coverage of added/changed code
-
-metric.coverage_line_hits_data.name=Coverage hits by line
-metric.coverage_line_hits_data.description=Coverage hits by line
-
-metric.conditions_to_cover.name=Conditions to cover
-metric.conditions_to_cover.description=Conditions to cover
-
-metric.new_conditions_to_cover.name=New conditions to cover
-metric.new_conditions_to_cover.description=New conditions to cover
-
-metric.uncovered_conditions.name=Uncovered conditions
-metric.uncovered_conditions.description=Uncovered conditions
-
-metric.new_uncovered_conditions.name=New uncovered conditions
-metric.new_uncovered_conditions.description=New uncovered conditions
-
-metric.branch_coverage.name=Branch coverage
-metric.branch_coverage.description=Branch coverage
-
-metric.new_branch_coverage.name=New branch coverage
-metric.new_branch_coverage.description=Branch coverage of new/changed code
-
-metric.branch_coverage_hits_data.name=Branch coverage hits
-metric.branch_coverage_hits_data.description=Branch coverage hits
-
-metric.conditions_by_line.name=Conditions by line
-metric.conditions_by_line.description=Conditions by line
-
-metric.covered_conditions_by_line.name=Covered conditions by line
-metric.covered_conditions_by_line.description=Covered conditions by line
-
-#--------------------------------------------------------------------------------------------------------------------
-#
-# DUPLICATIONS
-#
-#--------------------------------------------------------------------------------------------------------------------
-
-metric.duplicated_lines.name=Duplicated lines
-metric.duplicated_lines.description=Duplicated lines
-
-metric.duplicated_blocks.name=Duplicated blocks
-metric.duplicated_blocks.description=Duplicated blocks
-
-metric.duplicated_files.name=Duplicated files
-metric.duplicated_files.description=Duplicated files
-
-metric.duplicated_lines_density.name=Duplicated lines (%)
-metric.duplicated_lines_density.description=Duplicated lines balanced by statements
-
-metric.duplications_data.name=Duplications details
-metric.duplications_data.description=Duplications details
-
-#--------------------------------------------------------------------------------------------------------------------
-#
-# CODING RULES
-#
-#--------------------------------------------------------------------------------------------------------------------
-
-metric.usability.name=Usability
-metric.usability.description=Usability
-
-metric.reliability.name=Reliability
-metric.reliability.description=Reliability
-
-metric.efficiency.name=Efficiency
-metric.efficiency.description=Efficiency
-
-metric.portability.name=Portability
-metric.portability.description=Portability
-
-metric.maintainability.name=Maintainability
-metric.maintainability.description=Maintainability
-
-metric.weighted_violations.name=Weighted violations
-metric.weighted_violations.description=Weighted Violations
-
-metric.violations_density.name=Rules compliance
-metric.violations_density.description=Rules compliance
-
-metric.violations.name=Violations
-metric.violations.description=Violations
-
-metric.blocker_violations.name=Blocker violations
-metric.blocker_violations.description=Blocker violations
-
-metric.critical_violations.name=Critical violations
-metric.critical_violations.description=Critical violations
-
-metric.major_violations.name=Major violations
-metric.major_violations.description=Major violations
-
-metric.minor_violations.name=Minor violations
-metric.minor_violations.description=Minor violations
-
-metric.info_violations.name=Info violations
-metric.info_violations.description=Info violations
-
-metric.new_violations.name=New Violations
-metric.new_violations.description=New Violations
-
-metric.new_blocker_violations.name=New Blocker violations
-metric.new_blocker_violations.description=New Blocker violations
-
-metric.new_critical_violations.name=New Critical violations
-metric.new_critical_violations.description=New Critical violations
-
-metric.new_major_violations.name=New Major violations
-metric.new_major_violations.description=New Major violations
-
-metric.new_minor_violations.name=New Minor violations
-metric.new_minor_violations.description=New Minor violations
-
-metric.new_info_violations.name=New Info violations
-metric.new_info_violations.description=New Info violations
-
-#--------------------------------------------------------------------------------------------------------------------
-#
-# DESIGN
-#
-#--------------------------------------------------------------------------------------------------------------------
-
-metric.abstractness.name=Abstractness
-metric.abstractness.description=Abstractness
-
-metric.instability.name=Instability
-metric.instability.description=Instability
-
-metric.distance.name=Distance
-metric.distance.description=Distance
-
-metric.dit.name=Depth in Tree
-metric.dit.description=Depth in Inheritance Tree
-
-metric.noc.name=Number of Children
-metric.noc.description=Number of Children
-
-metric.rfc.name=RFC
-metric.rfc.description=Response for Class
-
-metric.rfc_distribution.name=Class distribution /RFC
-metric.rfc_distribution.description=Class distribution /RFC
-
-metric.lcom4.name=LCOM4
-metric.lcom4.description=Lack of Cohesion of Methods
-
-metric.lcom4_blocks.name=LCOM4 blocks
-metric.lcom4_blocks.description=LCOM4 blocks
-
-metric.lcom4_distribution.name=Class distribution /LCOM4
-metric.lcom4_distribution.description=Class distribution /LCOM4
-
-metric.suspect_lcom4_density.name=Suspect LCOM4 density
-metric.suspect_lcom4_density.description=Density of classes having LCOM4>1
-
-metric.ca.name=Afferent couplings
-metric.ca.description=Afferent couplings
-
-metric.ce.name=Efferent couplings
-metric.ce.description=Efferent couplings
-
-metric.dsm.name=Dependency Matrix
-metric.dsm.description=Dependency Matrix
-
-metric.package_cycles.name=Package cycles
-metric.package_cycles.description=Package cycles
-
-metric.package_tangle_index.name=Package tangle index
-metric.package_tangle_index.description=Package tangle index
-
-metric.package_tangles.name=File dependencies to cut
-metric.package_tangles.description=File dependencies to cut
-
-metric.package_feedback_edges.name=Package dependencies to cut
-metric.package_feedback_edges.description=Package dependencies to cut
-
-metric.package_edges_weight.name=Package edges weight
-metric.package_edges_weight.description=Package edges weight
-
-metric.file_cycles.name=File cycles
-metric.file_cycles.description=File cycles
-
-metric.file_tangle_index.name=File tangle index
-metric.file_tangle_index.description=File tangle index
-
-metric.file_tangles.name=File tangles
-metric.file_tangles.description=Files tangles
-
-metric.file_feedback_edges.name=Suspect file dependencies
-metric.file_feedback_edges.description=Suspect file dependencies
-
-metric.file_edges_weight.name=File edges weight
-metric.file_edges_weight.description=File edges weight
-
-metric.commits.name=Commits
-metric.commits.description=Commits
-
-metric.last_commit_date.name=Last commit
-metric.last_commit_date.description=Last commit
-
-metric.revision.name=Revision
-metric.revision.description=Revision
-
-metric.authors_by_line.name=Authors by line
-metric.authors_by_line.description=Authors by line
-
-metric.revisions_by_line.name=Revisions by line
-metric.revisions_by_line.description=Revisions by line
-
-metric.last_commit_datetimes_by_line.name=Last commit dates by line
-metric.last_commit_datetimes_by_line.description=Last commit dates by line
-
-metric.profile.name=Profile
-metric.profile.description=Selected quality profile
-
-metric.profile_version.name=Profile version
-metric.profile_version.description=Selected quality profile version \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java
new file mode 100644
index 00000000000..0660fd60527
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java
@@ -0,0 +1,39 @@
+/*
+ * 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.plugins.core.i18n;
+
+import org.sonar.api.i18n.LanguagePack;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+public class EnglishLanguagePack extends LanguagePack {
+
+ @Override
+ public List<String> getPluginKeys() {
+ return Arrays.asList("test");
+ }
+
+ @Override
+ public List<Locale> getLocales() {
+ return Arrays.asList(Locale.ENGLISH);
+ }
+} \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
index be700a32015..f8b8a299975 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
@@ -38,7 +38,7 @@ import com.google.common.collect.Lists;
public class I18nManagerTest {
- public static String TEST_PLUGIN_CLASS_NAME = "org.sonar.plugins.core.i18n.StandardPlugin";
+ public static String ENGLISH_PACK_CLASS_NAME = "org.sonar.plugins.core.i18n.EnglishLanguagePack";
public static String FRENCH_PACK_CLASS_NAME = "org.sonar.plugins.core.i18n.FrenchLanguagePack";
public static String QUEBEC_PACK_CLASS_NAME = "org.sonar.plugins.core.i18n.QuebecLanguagePack";
@@ -47,17 +47,19 @@ public class I18nManagerTest {
@Before
public void createManager() throws Exception {
- List<InstalledPlugin> plugins = Lists.newArrayList(new InstalledPlugin("test", new TestClassLoader(getClass().getClassLoader()
- .getResource("StandardPlugin.jar"))), new InstalledPlugin("fake1", getClass().getClassLoader()), new InstalledPlugin("fake2",
- getClass().getClassLoader()));
+ List<InstalledPlugin> plugins = Lists.newArrayList(new InstalledPlugin("test", getClass().getClassLoader()), new InstalledPlugin(
+ "fake1", getClass().getClassLoader()), new InstalledPlugin("fake2", getClass().getClassLoader()));
- TestClassLoader frenchPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("FrenchPlugin.jar"));
+ TestClassLoader englishPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("I18n/EnglishPlugin.jar"));
+ LanguagePack englishPack = (LanguagePack) englishPackClassLoader.loadClass(ENGLISH_PACK_CLASS_NAME).newInstance();
+
+ TestClassLoader frenchPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("I18n/FrenchPlugin.jar"));
LanguagePack frenchPack = (LanguagePack) frenchPackClassLoader.loadClass(FRENCH_PACK_CLASS_NAME).newInstance();
- TestClassLoader quebecPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("QuebecPlugin.jar"));
+ TestClassLoader quebecPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("I18n/QuebecPlugin.jar"));
LanguagePack quebecPack = (LanguagePack) quebecPackClassLoader.loadClass(QUEBEC_PACK_CLASS_NAME).newInstance();
- manager = new I18nManager(mock(PluginRepository.class), new LanguagePack[] { frenchPack, quebecPack });
+ manager = new I18nManager(mock(PluginRepository.class), new LanguagePack[] { frenchPack, quebecPack, englishPack });
manager.doStart(plugins);
}
@@ -113,7 +115,7 @@ public class I18nManagerTest {
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class c = findLoadedClass(name);
if (c == null) {
- if (name.equals(TEST_PLUGIN_CLASS_NAME) || name.equals(QUEBEC_PACK_CLASS_NAME) || name.equals(FRENCH_PACK_CLASS_NAME)) {
+ if (name.equals(ENGLISH_PACK_CLASS_NAME) || name.equals(QUEBEC_PACK_CLASS_NAME) || name.equals(FRENCH_PACK_CLASS_NAME)) {
c = findClass(name);
} else {
return super.loadClass(name, resolve);
diff --git a/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jar
new file mode 100755
index 00000000000..a0398457179
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jar
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/META-INF/MANIFEST.MF b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/META-INF/MANIFEST.MF
index a45029d3531..a45029d3531 100644
--- a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/META-INF/MANIFEST.MF
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/META-INF/MANIFEST.MF
diff --git a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/org/sonar/i18n/test.properties b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test.properties
index 88aabfe61a2..88aabfe61a2 100644
--- a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/org/sonar/i18n/test.properties
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test.properties
diff --git a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jar
index ab61bd88697..ab61bd88697 100644
--- a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jar
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jar
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/META-INF/MANIFEST.MF b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/META-INF/MANIFEST.MF
index a45029d3531..a45029d3531 100644
--- a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/META-INF/MANIFEST.MF
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/META-INF/MANIFEST.MF
diff --git a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties
index cc8efa7afc3..cc8efa7afc3 100644
--- a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties
diff --git a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin.jar
index 101df34ba6d..101df34ba6d 100644
--- a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin.jar
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin.jar
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/META-INF/MANIFEST.MF b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/META-INF/MANIFEST.MF
index a45029d3531..a45029d3531 100644
--- a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/META-INF/MANIFEST.MF
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/META-INF/MANIFEST.MF
diff --git a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties
index 38b5b84ccdf..38b5b84ccdf 100644
--- a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties
diff --git a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jar
deleted file mode 100644
index 73deac7e8b6..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jar
+++ /dev/null
Binary files differ