Quellcode durchsuchen

SONAR-12246 remove mysql specific error message

tags/8.0
Simon Brandhof vor 5 Jahren
Ursprung
Commit
78580333f0

+ 0
- 14
server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java Datei anzeigen

@@ -33,7 +33,6 @@ import org.apache.commons.dbcp2.BasicDataSourceFactory;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.config.Settings;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.db.dialect.Dialect;
@@ -97,23 +96,10 @@ public class DefaultDatabase implements Database {
doCompleteProperties(properties);

String jdbcUrl = properties.getProperty(JDBC_URL.getKey());
failIfMySql(jdbcUrl);
dialect = DialectUtils.find(properties.getProperty(SONAR_JDBC_DIALECT), jdbcUrl);
properties.setProperty(SONAR_JDBC_DRIVER, dialect.getDefaultDriverClassName());
}

private static void failIfMySql(String jdbcUrl) {
if (StringUtils.startsWithIgnoreCase(jdbcUrl, "jdbc:mysql")) {
throw MessageException.of("\n" +
"#############################################################################################################\n" +
"# End of Life of MySQL Support : SonarQube 7.9 and future versions do not support MySQL. #\n" +
"# Please migrate to a supported database. Get more details at #\n" +
"# https://community.sonarsource.com/t/end-of-life-of-mysql-support #\n" +
"# and https://github.com/SonarSource/mysql-migrator #\n" +
"#############################################################################################################\n");
}
}

private void initDataSource() throws Exception {
// but it's correctly caught by start()
LOG.info("Create JDBC data source for {}", properties.getProperty(JDBC_URL.getKey()), DEFAULT_URL);

+ 0
- 13
server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java Datei anzeigen

@@ -29,7 +29,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.MessageException;
import org.sonar.db.dialect.PostgreSql;
import org.sonar.process.logging.LogbackHelper;

@@ -155,18 +154,6 @@ public class DefaultDatabaseTest {
assertThat(database.getProperties().getProperty("sonar.jdbc.driverClassName")).isEqualTo("org.postgresql.Driver");
}

@Test
public void fail_when_mysql_is_used() {
MapSettings settings = new MapSettings();
settings.setProperty("sonar.jdbc.url", "jdbc:mysql://localhost/sonar");

DefaultDatabase database = new DefaultDatabase(logbackHelper, settings);

expectedException.expect(MessageException.class);
expectedException.expectMessage("End of Life of MySQL Support");
database.start();
}

@DataProvider
public static Object[][] sonarJdbcAndDbcpProperties() {
return new Object[][] {

Laden…
Abbrechen
Speichern