diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2019-07-02 23:12:14 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-07-10 08:36:52 +0200 |
commit | 983f593231da12bd64d9df23c18d4f2c7aaa6da1 (patch) | |
tree | 7cb059b67a55896fdee6a845a33cd1b7abcf6193 /server/sonar-main | |
parent | ae5d2b804c69e4cd19ec13880b913881f620e518 (diff) | |
download | sonarqube-983f593231da12bd64d9df23c18d4f2c7aaa6da1.tar.gz sonarqube-983f593231da12bd64d9df23c18d4f2c7aaa6da1.zip |
SONAR-12246 remove MySQL dialect
Diffstat (limited to 'server/sonar-main')
4 files changed, 3 insertions, 38 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java b/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java index 6e17eb46d04..5fec2b7c401 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java +++ b/server/sonar-main/src/main/java/org/sonar/application/config/JdbcSettings.java @@ -47,7 +47,7 @@ public class JdbcSettings implements Consumer<Props> { private static final int JDBC_EMBEDDED_PORT_DEFAULT_VALUE = 9092; enum Provider { - H2("lib/jdbc/h2"), SQLSERVER("lib/jdbc/mssql"), MYSQL("lib/jdbc/mysql"), ORACLE("extensions/jdbc-driver/oracle"), + H2("lib/jdbc/h2"), SQLSERVER("lib/jdbc/mssql"), ORACLE("extensions/jdbc-driver/oracle"), POSTGRESQL("lib/jdbc/postgresql"); final String path; @@ -61,8 +61,6 @@ public class JdbcSettings implements Consumer<Props> { public void accept(Props props) { File homeDir = props.nonNullValueAsFile(PATH_HOME.getKey()); Provider provider = resolveProviderAndEnforceNonnullJdbcUrl(props); - String url = props.value(JDBC_URL.getKey()); - checkUrlParameters(provider, url); String driverPath = driverPath(homeDir, provider); props.set(JDBC_DRIVER_PATH.getKey(), driverPath); } @@ -124,15 +122,6 @@ public class JdbcSettings implements Consumer<Props> { return format("jdbc:h2:tcp://%s:%d/sonar", host, embeddedDatabasePort); } - void checkUrlParameters(Provider provider, String url) { - if (Provider.MYSQL.equals(provider)) { - checkRequiredParameter(url, "useUnicode=true"); - checkRequiredParameter(url, "characterEncoding=utf8"); - checkRecommendedParameter(url, "rewriteBatchedStatements=true"); - checkRecommendedParameter(url, "useConfigs=maxPerformance"); - } - } - private static void warnIfUrlIsSet(int port, String existing, String expectedUrl) { if (isNotEmpty(existing)) { Logger logger = LoggerFactory.getLogger(JdbcSettings.class); diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java index 22081fdaa74..0ab663485be 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsLoopbackTest.java @@ -99,7 +99,7 @@ public class ClusterSettingsLoopbackTest { .set(CLUSTER_HZ_HOSTS.getKey(), nonLoopbackLocal.getHostAddress()) .set(CLUSTER_SEARCH_HOSTS.getKey(), nonLoopbackLocal.getHostAddress()) .set("sonar.auth.jwtBase64Hs256Secret", "abcde") - .set(JDBC_URL.getKey(), "jdbc:mysql://localhost:3306/sonar"); + .set(JDBC_URL.getKey(), "jdbc:postgresql://localhost:3306/sonar"); } private TestAppSettings newSettingsForSearchNode() { diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java index 010561804ba..b74b4b74efd 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/ClusterSettingsTest.java @@ -280,7 +280,7 @@ public class ClusterSettingsTest { .set(CLUSTER_HZ_HOSTS.getKey(), nonLoopbackLocal.getHostAddress()) .set(CLUSTER_SEARCH_HOSTS.getKey(), nonLoopbackLocal.getHostAddress()) .set("sonar.auth.jwtBase64Hs256Secret", "abcde") - .set(JDBC_URL.getKey(), "jdbc:mysql://localhost:3306/sonar"); + .set(JDBC_URL.getKey(), "jdbc:postgresql://localhost/sonar"); } private TestAppSettings newSettingsForSearchNode() { diff --git a/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java index 5dddb4ac11d..29b29d1d409 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/config/JdbcSettingsTest.java @@ -68,13 +68,6 @@ public class JdbcSettingsTest { } @Test - public void resolve_MySql_when_jdbc_url_contains_mysql_in_any_case() { - checkProviderForUrlAndUnchangedUrl("jdbc:mysql:foo", Provider.MYSQL); - - checkProviderForUrlAndUnchangedUrl("jdbc:mYsQL:foo", Provider.MYSQL); - } - - @Test public void resolve_SqlServer_when_jdbc_url_contains_sqlserver_in_any_case() { checkProviderForUrlAndUnchangedUrl("jdbc:sqlserver:foo", Provider.SQLSERVER); @@ -116,23 +109,6 @@ public class JdbcSettingsTest { } @Test - public void check_mysql_parameters() { - // minimal -> ok - underTest.checkUrlParameters(Provider.MYSQL, - "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8"); - - // full -> ok - underTest.checkUrlParameters(Provider.MYSQL, - "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance"); - - // missing required -> ko - expectedException.expect(MessageException.class); - expectedException.expectMessage("JDBC URL must have the property 'useUnicode=true'"); - - underTest.checkUrlParameters(Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?characterEncoding=utf8"); - } - - @Test public void checkAndComplete_sets_driver_path_for_oracle() throws Exception { File driverFile = new File(homeDir, "extensions/jdbc-driver/oracle/ojdbc6.jar"); FileUtils.touch(driverFile); |