]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10002 Clear install error on restart
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 26 Oct 2017 13:28:50 +0000 (15:28 +0200)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 26 Oct 2017 14:59:58 +0000 (16:59 +0200)
server/sonar-server/src/main/java/org/sonar/server/edition/CommitPendingEditionOnStartup.java
server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java

index 050be2e30afb0501e45dc5cdd7e67ccb1f999f3e..1c8c40435a8ff103e5180a5c5bf8f4bdc5146dce 100644 (file)
@@ -34,7 +34,7 @@ public class CommitPendingEditionOnStartup implements Startable {
   private final LicenseCommit licenseCommit;
 
   /**
-   * Used by Pico when license-manager is not installed and therefor no implementation of {@link LicenseCommit} is
+   * Used by Pico when license-manager is not installed and therefore no implementation of {@link LicenseCommit} is
    * is available.
    */
   public CommitPendingEditionOnStartup(MutableEditionManagementState editionManagementState) {
@@ -51,6 +51,7 @@ public class CommitPendingEditionOnStartup implements Startable {
     EditionManagementState.PendingStatus status = editionManagementState.getPendingInstallationStatus();
     switch (status) {
       case NONE:
+        editionManagementState.clearInstallErrorMessage();
         return;
       case MANUAL_IN_PROGRESS:
       case AUTOMATIC_READY:
index 4346354c6a3519f43b6bb47fc32127b3c94139ff..e1e1e910faf83dca089926c2becbe2b3ecbb5506 100644 (file)
@@ -52,28 +52,30 @@ public class CommitPendingEditionOnStartupTest {
   private CommitPendingEditionOnStartup underTestWithLicenseCommit = new CommitPendingEditionOnStartup(editionManagementState, licenseCommit);
 
   @Test
-  public void start_has_no_effect_when_status_is_NONE_without_LicenseCommit() {
+  public void start_clears_error_message_when_status_is_NONE_without_LicenseCommit() {
     when(editionManagementState.getPendingInstallationStatus()).thenReturn(NONE);
 
     underTest.start();
 
     verify(editionManagementState).getPendingInstallationStatus();
+    verify(editionManagementState).clearInstallErrorMessage();
     verifyNoMoreInteractions(editionManagementState);
   }
 
   @Test
-  public void start_has_no_effect_when_status_is_NONE_with_LicenseCommit() {
+  public void start_clears_error_message_when_status_is_NONE_with_LicenseCommit() {
     when(editionManagementState.getPendingInstallationStatus()).thenReturn(NONE);
 
     underTestWithLicenseCommit.start();
 
     verify(editionManagementState).getPendingInstallationStatus();
+    verify(editionManagementState).clearInstallErrorMessage();
     verifyNoMoreInteractions(editionManagementState);
     verifyZeroInteractions(licenseCommit);
   }
 
   @Test
-  public void starts_has_no_effect_when_status_is_AUTOMATIC_READY_and_no_LicenseCommit_is_available_but_logs_at_debug_level() {
+  public void start_has_no_effect_when_status_is_AUTOMATIC_READY_and_no_LicenseCommit_is_available_but_logs_at_debug_level() {
     when(editionManagementState.getPendingInstallationStatus()).thenReturn(AUTOMATIC_READY);
 
     underTest.start();