aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-10-26 15:28:50 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2017-10-26 16:59:58 +0200
commit47e73abe2717a0b673f15fefcdfa6e71907e1a09 (patch)
tree27678ee82389e4e85db4b3f66733acabd3d47084
parent1b9d60f26535f3412ce4cd9ccf65ccb0e1b3af03 (diff)
downloadsonarqube-47e73abe2717a0b673f15fefcdfa6e71907e1a09.tar.gz
sonarqube-47e73abe2717a0b673f15fefcdfa6e71907e1a09.zip
SONAR-10002 Clear install error on restart
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/edition/CommitPendingEditionOnStartup.java3
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/edition/CommitPendingEditionOnStartupTest.java8
2 files changed, 7 insertions, 4 deletions
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();