aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2019-07-02 09:52:05 +0200
committersonartech <sonartech@sonarsource.com>2019-07-10 08:36:52 +0200
commitae5d2b804c69e4cd19ec13880b913881f620e518 (patch)
tree05e762638e8053663c0b6053e09f3e2feb38fd47
parent5b6b842644ad9ead70064e8f52b2697a60d5f1ac (diff)
downloadsonarqube-ae5d2b804c69e4cd19ec13880b913881f620e518.tar.gz
sonarqube-ae5d2b804c69e4cd19ec13880b913881f620e518.zip
SONAR-12246 Remove MySQL check for DCE
It's redundant with global end-of-support of MySQL
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/startup/ClusterConfigurationCheck.java50
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/platform/platformlevel/PlatformLevel2Test.java26
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/startup/ClusterConfigurationCheckTest.java71
4 files changed, 0 insertions, 151 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java
index 4930ca75cf2..26da9589616 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java
@@ -46,7 +46,6 @@ import org.sonar.server.plugins.PluginFileSystem;
import org.sonar.server.plugins.ServerPluginJarExploder;
import org.sonar.server.plugins.ServerPluginRepository;
import org.sonar.server.plugins.WebServerExtensionInstaller;
-import org.sonar.server.startup.ClusterConfigurationCheck;
import static org.sonar.core.extension.CoreExtensionsInstaller.noAdditionalSideFilter;
import static org.sonar.core.extension.PlatformLevelPredicates.hasPlatformLevel;
@@ -93,9 +92,6 @@ public class PlatformLevel2 extends PlatformLevel {
DatabaseMigrationStateImpl.class,
DatabaseMigrationExecutorServiceImpl.class);
- addIfCluster(
- ClusterConfigurationCheck.class);
-
addIfStartupLeader(
DatabaseCharsetChecker.class,
CheckDatabaseCharsetAtStartup.class);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/startup/ClusterConfigurationCheck.java b/server/sonar-server/src/main/java/org/sonar/server/startup/ClusterConfigurationCheck.java
deleted file mode 100644
index 92a1f6e0829..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/startup/ClusterConfigurationCheck.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.startup;
-
-import org.picocontainer.Startable;
-import org.sonar.db.Database;
-import org.sonar.db.dialect.MySql;
-
-/**
- * This class will be check the configuration for a SonarQube cluster
- *
- * See SONAR-10420
- */
-public class ClusterConfigurationCheck implements Startable {
-
- private final Database database;
-
- public ClusterConfigurationCheck(Database database) {
- this.database = database;
- }
-
- @Override
- public void start() {
- if (MySql.ID.equals(database.getDialect().getId())) {
- throw new IllegalStateException("MySQL is not supported for Data Center Edition. Please connect to a supported database: Oracle, PostgreSQL, Microsoft SQL Server.");
- }
- }
-
- @Override
- public void stop() {
- // Nothing to do
- }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/platformlevel/PlatformLevel2Test.java b/server/sonar-server/src/test/java/org/sonar/server/platform/platformlevel/PlatformLevel2Test.java
index 9aa5f4d17bf..f196aa6f135 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/platform/platformlevel/PlatformLevel2Test.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/platform/platformlevel/PlatformLevel2Test.java
@@ -29,7 +29,6 @@ import org.sonar.core.platform.PluginRepository;
import org.sonar.server.platform.Platform;
import org.sonar.server.platform.WebServer;
import org.sonar.server.platform.db.migration.charset.DatabaseCharsetChecker;
-import org.sonar.server.startup.ClusterConfigurationCheck;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -88,29 +87,4 @@ public class PlatformLevel2Test {
// level2 component that is injected only on "startup leaders"
assertThat(underTest.getOptional(DatabaseCharsetChecker.class)).isNotPresent();
}
-
- @Test
- public void add_ClusterConfigurationCheck_when_cluster_mode_activated() {
- props.setProperty("sonar.cluster.enabled", "true");
- PlatformLevel1 level1 = new PlatformLevel1(mock(Platform.class), props);
- level1.configure();
-
- PlatformLevel2 underTest = new PlatformLevel2(level1);
- underTest.configure();
-
- assertThat(underTest.getOptional(ClusterConfigurationCheck.class)).isPresent();
- }
-
- @Test
- public void do_NOT_add_ClusterConfigurationCheck_when_cluster_mode_NOT_activated() {
- props.setProperty("sonar.cluster.enabled", "false");
- PlatformLevel1 level1 = new PlatformLevel1(mock(Platform.class), props);
- level1.configure();
-
- PlatformLevel2 underTest = new PlatformLevel2(level1);
- underTest.configure();
-
- assertThat(underTest.getOptional(ClusterConfigurationCheck.class)).isNotPresent();
-
- }
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/ClusterConfigurationCheckTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/ClusterConfigurationCheckTest.java
deleted file mode 100644
index 43838ebc642..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/startup/ClusterConfigurationCheckTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.startup;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.db.Database;
-import org.sonar.db.dialect.MsSql;
-import org.sonar.db.dialect.MySql;
-import org.sonar.db.dialect.Oracle;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class ClusterConfigurationCheckTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private Database database = mock(Database.class);
- private ClusterConfigurationCheck underTest = new ClusterConfigurationCheck(database);
-
- @Test
- public void when_SQ_is_connected_to_MySql_an_ISE_should_be_thrown() {
- when(database.getDialect()).thenReturn(new MySql());
-
- expectedException.expect(IllegalStateException.class);
- expectedException.expectMessage("MySQL is not supported for Data Center Edition. Please connect to a supported database: Oracle, PostgreSQL, Microsoft SQL Server.");
-
- underTest.start();
- }
-
- @Test
- public void when_SQ_is_connected_to_MsSql_an_ISE_should_NOT_be_thrown() {
- when(database.getDialect()).thenReturn(new MsSql());
-
- underTest.start();
- }
-
- @Test
- public void when_SQ_is_connected_to_Oracle_an_ISE_should_NOT_be_thrown() {
- when(database.getDialect()).thenReturn(new Oracle());
-
- underTest.start();
- }
-
- @Test
- public void when_SQ_is_connected_to_Postgres_an_ISE_should_NOT_be_thrown() {
- when(database.getDialect()).thenReturn(new Oracle());
-
- underTest.start();
- }
-}