From: Duarte Meneses Date: Thu, 26 Oct 2017 13:28:50 +0000 (+0200) Subject: SONAR-10002 Clear install error on restart X-Git-Tag: 6.7-RC1~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=47e73abe2717a0b673f15fefcdfa6e71907e1a09;p=sonarqube.git SONAR-10002 Clear install error on restart --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/edition/CommitPendingEditionOnStartup.java b/server/sonar-server/src/main/java/org/sonar/server/edition/CommitPendingEditionOnStartup.java index 050be2e30af..1c8c40435a8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/edition/CommitPendingEditionOnStartup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/edition/CommitPendingEditionOnStartup.java @@ -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: diff --git a/server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java b/server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java index 4346354c6a3..e1e1e910faf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java @@ -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();