]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10707 deprecate MySQL
authorG. Ann Campbell <ann.campbell@sonarsource.com>
Tue, 29 May 2018 07:00:20 +0000 (09:00 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 29 May 2018 18:20:47 +0000 (20:20 +0200)
server/sonar-db-core/src/main/java/org/sonar/db/DatabaseChecker.java
server/sonar-db-core/src/test/java/org/sonar/db/DatabaseCheckerTest.java
sonar-application/src/main/assembly/conf/sonar.properties

index 925960ce1201dbfda69b8e4a1a2c412b58363dfd..e4e1054b8abab38407f473cdbe7151322fa53897 100644 (file)
@@ -61,7 +61,9 @@ public class DatabaseChecker implements Startable {
 
       // additional checks
       if (H2.ID.equals(db.getDialect().getId())) {
-        Loggers.get(DatabaseChecker.class).warn("H2 database should be used for evaluation purpose only");
+        Loggers.get(DatabaseChecker.class).warn("H2 database should be used for evaluation purpose only.");
+      } else if (MySql.ID.equals(db.getDialect().getId())) {
+        Loggers.get(DatabaseChecker.class).warn("MySQL support is deprecated and will be dropped soon.");
       } else if (Oracle.ID.equals(db.getDialect().getId())) {
         checkOracleDriverVersion();
       }
index a2132bcc77f77a2a43933e57c65f7dc9ec99b18b..ad496abfe6c8dce65096b6a920e08ba0f40d17a6 100644 (file)
@@ -25,6 +25,8 @@ import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 import org.sonar.api.utils.MessageException;
+import org.sonar.api.utils.log.LogTester;
+import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.db.dialect.Dialect;
 import org.sonar.db.dialect.H2;
 import org.sonar.db.dialect.MsSql;
@@ -41,6 +43,9 @@ public class DatabaseCheckerTest {
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
 
+  @Rule
+  public LogTester logTester = new LogTester();
+
   @Test
   public void requires_oracle_driver_11_2() throws Exception {
     Database db = mockDb(new Oracle(), 11, 2, "11.2.0.0.1");
@@ -98,14 +103,17 @@ public class DatabaseCheckerTest {
     DatabaseChecker checker = new DatabaseChecker(db);
     checker.start();
     checker.stop();
-    // TODO test log
+
+    assertThat(logTester.logs(LoggerLevel.WARN)).contains("H2 database should be used for evaluation purpose only.");
   }
 
   @Test
   public void test_mysql() throws Exception {
     Database db = mockDb(new MySql(), 5, 7, "5.7");
     new DatabaseChecker(db).start();
-    // no error
+
+    // no error but warning
+    assertThat(logTester.logs(LoggerLevel.WARN)).contains("MySQL support is deprecated and will be dropped soon.");
   }
 
   @Test
index 4eba16bb859ce5fdd48b1e11e8a50b5573236532..4a254d6b4cf684593c2ff9c30af41b5594f827d5 100644 (file)
@@ -20,7 +20,9 @@
 # H2 embedded database server listening port, defaults to 9092
 #sonar.embeddedDatabase.port=9092
 
-#----- MySQL 5.6 or greater
+#----- DEPRECATED 
+#----- MySQL >=5.6 && <8.0
+# Support of MySQL is dropped in Data Center Editions and deprecated in all other editions
 # Only InnoDB storage engine is supported (not myISAM).
 # Only the bundled driver is supported. It can not be changed.
 #sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false