From 252fbe63ae0edb86307e54c5c5fbfe83e47b965e Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 12 Oct 2017 10:00:14 +0200 Subject: SONAR-9863 replace old "permanent server ID" by the new one --- .../ce/container/ComputeEngineContainerImpl.java | 2 - .../container/ComputeEngineContainerImplTest.java | 2 +- .../db/migration/MigrationConfigurationModule.java | 2 + .../server/platform/db/migration/step/Select.java | 5 - .../version/v66/CopyDeprecatedServerId.java | 64 ++++++++++ .../db/migration/version/v67/DbVersion67.java | 33 +++++ .../db/migration/version/v67/package-info.java | 24 ++++ .../MigrationConfigurationModuleTest.java | 2 +- .../version/v67/CopyDeprecatedServerIdTest.java | 91 +++++++++++++ .../db/migration/version/v67/DbVersion67Test.java | 42 ++++++ .../v67/CopyDeprecatedServerIdTest/properties.sql | 11 ++ .../java/org/sonar/server/platform/ServerId.java | 41 ------ .../sonar/server/platform/ServerIdGenerator.java | 140 -------------------- .../org/sonar/server/platform/ServerIdLoader.java | 51 -------- .../java/org/sonar/server/platform/ServerImpl.java | 2 +- .../server/platform/StartupMetadataProvider.java | 3 +- .../monitoring/StandaloneSystemSection.java | 12 +- .../monitoring/cluster/GlobalSystemSection.java | 13 +- .../platform/platformlevel/PlatformLevel3.java | 5 - .../platform/platformlevel/PlatformLevel4.java | 2 + .../sonar/server/setting/ws/ScannerSettings.java | 3 +- .../java/org/sonar/server/startup/LogServerId.java | 49 +------ .../server/platform/ServerIdGeneratorTest.java | 142 --------------------- .../sonar/server/platform/ServerIdLoaderTest.java | 121 ------------------ .../org/sonar/server/platform/ServerImplTest.java | 9 +- .../monitoring/StandaloneSystemSectionTest.java | 40 +----- .../cluster/GlobalSystemSectionTest.java | 46 +------ .../server/setting/ws/ScannerSettingsTest.java | 2 +- .../sonar/server/setting/ws/ValuesActionTest.java | 2 +- .../org/sonar/server/startup/LogServerIdTest.java | 94 ++------------ .../main/java/org/sonar/api/CoreProperties.java | 6 + .../src/main/java/org/sonar/api/PropertyType.java | 2 + .../main/java/org/sonar/api/platform/Server.java | 11 +- .../scanner/bootstrap/GlobalConfiguration.java | 2 +- .../org/sonar/scanner/platform/DefaultServer.java | 2 +- .../sonar/scanner/platform/DefaultServerTest.java | 3 +- .../java/org/sonarqube/tests/Category5Suite.java | 2 - .../sonarqube/tests/settings/LicensesPageTest.java | 93 -------------- 38 files changed, 323 insertions(+), 853 deletions(-) create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CopyDeprecatedServerId.java create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67.java create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/package-info.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerIdTest.java create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67Test.java create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerIdTest/properties.sql delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/platform/ServerId.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdGenerator.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/platform/ServerIdLoader.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdGeneratorTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/platform/ServerIdLoaderTest.java delete mode 100644 tests/src/test/java/org/sonarqube/tests/settings/LicensesPageTest.java diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index da99c929216..9e214a27a86 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -145,7 +145,6 @@ import org.sonar.server.search.EsSearchModule; import org.sonar.server.setting.DatabaseSettingLoader; import org.sonar.server.setting.DatabaseSettingsEnabler; import org.sonar.server.setting.ThreadLocalSettings; -import org.sonar.server.startup.LogServerId; import org.sonar.server.test.index.TestIndexer; import org.sonar.server.user.DefaultUserFinder; import org.sonar.server.user.DeprecatedUserFinder; @@ -442,7 +441,6 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { private static Object[] startupComponents() { return new Object[] { - LogServerId.class, ServerLifecycleNotifier.class, PurgeCeActivities.class, CeQueueCleaner.class diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java index 8a003284a5d..3a6b1a74cf2 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java @@ -146,7 +146,7 @@ public class ComputeEngineContainerImplTest { ); assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize( CONTAINER_ITSELF - + 12 // MigrationConfigurationModule + + 13 // MigrationConfigurationModule + 17 // level 2 ); assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize( diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java index 43de1b33971..5f7026a9b4d 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java @@ -32,6 +32,7 @@ import org.sonar.server.platform.db.migration.version.v63.DbVersion63; import org.sonar.server.platform.db.migration.version.v64.DbVersion64; import org.sonar.server.platform.db.migration.version.v65.DbVersion65; import org.sonar.server.platform.db.migration.version.v66.DbVersion66; +import org.sonar.server.platform.db.migration.version.v67.DbVersion67; public class MigrationConfigurationModule extends Module { @Override @@ -47,6 +48,7 @@ public class MigrationConfigurationModule extends Module { DbVersion64.class, DbVersion65.class, DbVersion66.class, + DbVersion67.class, // migration steps MigrationStepRegistryImpl.class, diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/Select.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/Select.java index 471e1641ce1..b2430466afd 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/Select.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/Select.java @@ -144,17 +144,12 @@ public interface Select extends SqlStatement