diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-03-30 23:21:45 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-03-30 23:21:45 +0200 |
commit | c16247472c9413b0ce9012cadfcd9108f88d8a4a (patch) | |
tree | ef7a635d5b08ae148476d462f997a70526f07f9c /sonar-application/src | |
parent | 3b75c616894d079d86b2f218315da33a4636382d (diff) | |
download | sonarqube-c16247472c9413b0ce9012cadfcd9108f88d8a4a.tar.gz sonarqube-c16247472c9413b0ce9012cadfcd9108f88d8a4a.zip |
Remove bad comment of sonar.properties about encoding
Encoding is UTF-8, but not ISO-8859-1 as documented.
Diffstat (limited to 'sonar-application/src')
-rw-r--r-- | sonar-application/src/main/assembly/conf/sonar.properties | 4 | ||||
-rw-r--r-- | sonar-application/src/test/java/org/sonar/application/PropsBuilderTest.java | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index d5209054161..a022c3c1021 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -1,11 +1,7 @@ -# This file must contain only ISO 8859-1 characters. -# See http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Properties.html#load(java.io.InputStream) -# # Property values can: # - reference an environment variable, for example sonar.jdbc.url= ${env:SONAR_JDBC_URL} # - be encrypted. See http://redirect.sonarsource.com/doc/settings-encryption.html - #-------------------------------------------------------------------------------------------------- # DATABASE # diff --git a/sonar-application/src/test/java/org/sonar/application/PropsBuilderTest.java b/sonar-application/src/test/java/org/sonar/application/PropsBuilderTest.java index 91f5d6f15d1..82c0cd8c99d 100644 --- a/sonar-application/src/test/java/org/sonar/application/PropsBuilderTest.java +++ b/sonar-application/src/test/java/org/sonar/application/PropsBuilderTest.java @@ -101,6 +101,11 @@ public class PropsBuilderTest { } } + //Remove bad comment of sonar.properties about encoding + + //Encoding is UTF-8, but not ISO-8859-1 as documented + + @Test public void load_properties_file_if_exists() throws Exception { FileUtils.write(new File(homeDir, "conf/sonar.properties"), "sonar.jdbc.username=angela\nsonar.origin=file"); @@ -112,12 +117,21 @@ public class PropsBuilderTest { rawProperties.setProperty("sonar.origin", "raw"); Props props = new PropsBuilder(rawProperties, jdbcSettings, homeDir).build(); + // properties loaded from file assertThat(props.value("sonar.jdbc.username")).isEqualTo("angela"); + // command-line arguments override sonar.properties file assertThat(props.value("sonar.origin")).isEqualTo("raw"); } @Test + public void utf8_file_encoding() throws Exception { + FileUtils.write(new File(homeDir, "conf/sonar.properties"), "utf8prop=Thônes"); + Props props = new PropsBuilder(new Properties(), jdbcSettings, homeDir).build(); + assertThat(props.value("utf8prop")).isEqualTo("Thônes"); + } + + @Test public void do_not_load_properties_file_if_not_exists() throws Exception { FileUtils.forceMkdir(dataDir); FileUtils.forceMkdir(webDir); |