]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9951 move edition install commit to startup level
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 19 Oct 2017 09:13:39 +0000 (11:13 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 23 Oct 2017 15:01:13 +0000 (08:01 -0700)
because extensions from plugins (including license-manager) are loaded at startup level

server/sonar-server/src/main/java/org/sonar/server/edition/EditionManagementCommitModule.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/edition/EditionsWsModule.java
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel3.java
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java
server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java
server/sonar-server/src/test/java/org/sonar/server/edition/EditionManagementCommitModuleTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/edition/EditionsWsModuleTest.java

diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/EditionManagementCommitModule.java b/server/sonar-server/src/main/java/org/sonar/server/edition/EditionManagementCommitModule.java
deleted file mode 100644 (file)
index 6e417a4..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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.edition;
-
-import org.sonar.core.platform.Module;
-
-public class EditionManagementCommitModule extends Module {
-  @Override
-  protected void configureModule() {
-    add(
-      // TODO add cluster ready implementation when not running Standalone
-      // Edition management WebServices also depend on this class
-      StandaloneEditionManagementStateImpl.class,
-      CommitPendingEditionOnStartup.class);
-  }
-}
index 37027d6c5f04f941b4eedc1dc88d249a31ae547d..75f2da37c91b696c8465a2331837487a16062f89 100644 (file)
@@ -32,6 +32,7 @@ public class EditionsWsModule extends Module {
   @Override
   protected void configureModule() {
     add(
+      StandaloneEditionManagementStateImpl.class,
       StatusAction.class,
       ApplyLicenseAction.class,
       PreviewAction.class,
index 8df49bfdf3aa4148b4e3074c0dad3959d09f7b33..d7c3a3753b6c6bdcf6d3fa24444445a2ec1e65f9 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.platform.platformlevel;
 
 import org.sonar.api.utils.UriReader;
 import org.sonar.core.util.DefaultHttpDownloader;
-import org.sonar.server.edition.EditionManagementCommitModule;
 import org.sonar.server.organization.DefaultOrganizationProviderImpl;
 import org.sonar.server.organization.OrganizationFlagsImpl;
 import org.sonar.server.platform.ServerIdManager;
@@ -48,7 +47,6 @@ public class PlatformLevel3 extends PlatformLevel {
       UriReader.class,
       DefaultHttpDownloader.class,
       DefaultOrganizationProviderImpl.class,
-      OrganizationFlagsImpl.class,
-      EditionManagementCommitModule.class);
+      OrganizationFlagsImpl.class);
   }
 }
index f8c07e82b44a8966c69684599002acc1ce0dac33..f8229f4f65a36551aaab35828f044eebfb90a8c4 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.platform.platformlevel;
 
 import org.sonar.server.app.ProcessCommandWrapper;
+import org.sonar.server.edition.CommitPendingEditionOnStartup;
 import org.sonar.server.es.IndexerStartupTask;
 import org.sonar.server.organization.DefaultOrganizationEnforcer;
 import org.sonar.server.platform.ServerLifecycleNotifier;
@@ -52,7 +53,8 @@ public class PlatformLevelStartup extends PlatformLevel {
     add(GeneratePluginIndex.class,
       RegisterPlugins.class,
       ServerLifecycleNotifier.class,
-      DefaultOrganizationEnforcer.class);
+      DefaultOrganizationEnforcer.class,
+      CommitPendingEditionOnStartup.class);
 
     addIfStartupLeader(
       IndexerStartupTask.class,
index 5318e3a894489f116f1f4549c477afd0b720a7af..94c128fcec268245da2c9544e5eea02f6c05d8e0 100644 (file)
@@ -44,7 +44,7 @@ public class CommitPendingEditionOnStartupTest {
   public ExpectedException expectedException = ExpectedException.none();
   @Rule
   public LogTester logTester = new LogTester()
-      .setLevel(LoggerLevel.DEBUG);
+    .setLevel(LoggerLevel.DEBUG);
 
   private MutableEditionManagementState editionManagementState = mock(MutableEditionManagementState.class);
   private LicenseCommit licenseCommit = mock(LicenseCommit.class);
@@ -83,7 +83,7 @@ public class CommitPendingEditionOnStartupTest {
     verifyZeroInteractions(licenseCommit);
     assertThat(logTester.logs()).hasSize(1);
     assertThat(logTester.logs(LoggerLevel.DEBUG))
-        .containsOnly("No LicenseCommit instance is not available, can not finalize installation");
+      .containsOnly("No LicenseCommit instance is not available, can not finalize installation");
   }
 
   @Test
@@ -113,7 +113,7 @@ public class CommitPendingEditionOnStartupTest {
     verifyZeroInteractions(licenseCommit);
     assertThat(logTester.logs()).hasSize(1);
     assertThat(logTester.logs(LoggerLevel.DEBUG))
-        .containsOnly("No LicenseCommit instance is not available, can not finalize installation");
+      .containsOnly("No LicenseCommit instance is not available, can not finalize installation");
   }
 
   @Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/edition/EditionManagementCommitModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/edition/EditionManagementCommitModuleTest.java
deleted file mode 100644 (file)
index 859f877..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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.edition;
-
-import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
-
-public class EditionManagementCommitModuleTest {
-  private EditionManagementCommitModule underTest = new EditionManagementCommitModule();
-
-  @Test
-  public void verify_component_count() {
-    ComponentContainer container = new ComponentContainer();
-    underTest.configure(container);
-
-    assertThat(container.getPicoContainer().getComponentAdapters())
-      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2);
-  }
-
-}
index 0a801053276e2d15a919acb01d18f240d80a8219..7a164d50b42718a84d5a540ff892586c4b965079 100644 (file)
@@ -34,6 +34,6 @@ public class EditionsWsModuleTest {
     underTest.configure(container);
 
     assertThat(container.getPicoContainer().getComponentAdapters())
-      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 7);
+      .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 8);
   }
 }