aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-03-14 06:27:15 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-03-14 06:27:15 +0100
commitea2bcfd9b0137fcff0e88404e9fa2cadbbfda6c6 (patch)
treec4797d996ee3822b4cf13b41029b7beb89367a06 /sonar-core
parente9b5cded528c6ad33d91fa61cd1be4b917983738 (diff)
downloadsonarqube-ea2bcfd9b0137fcff0e88404e9fa2cadbbfda6c6.tar.gz
sonarqube-ea2bcfd9b0137fcff0e88404e9fa2cadbbfda6c6.zip
Do not log 'require upgrade' on fresh installs
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java6
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/DatabaseVersionTest.java2
2 files changed, 5 insertions, 3 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
index 942d41eb61f..1d3b431a4e6 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
@@ -35,7 +35,7 @@ public class DatabaseVersion implements BatchComponent, ServerComponent {
public static final int LAST_VERSION = 263;
public static enum Status {
- UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE
+ UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
}
private MyBatis mybatis;
@@ -69,12 +69,14 @@ public class DatabaseVersion implements BatchComponent, ServerComponent {
@VisibleForTesting
static Status getStatus(Integer currentVersion, int lastVersion) {
- Status status = Status.REQUIRES_UPGRADE;
+ Status status = Status.FRESH_INSTALL;
if (currentVersion != null) {
if (currentVersion == lastVersion) {
status = Status.UP_TO_DATE;
} else if (currentVersion > lastVersion) {
status = Status.REQUIRES_DOWNGRADE;
+ } else {
+ status = Status.REQUIRES_UPGRADE;
}
}
return status;
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DatabaseVersionTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/DatabaseVersionTest.java
index 03d6033df55..9dbee6dbe21 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/DatabaseVersionTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/DatabaseVersionTest.java
@@ -47,7 +47,7 @@ public class DatabaseVersionTest extends DaoTestCase {
@Test
public void getStatus() {
- assertThat(DatabaseVersion.getStatus(null, 150), is(DatabaseVersion.Status.REQUIRES_UPGRADE));
+ assertThat(DatabaseVersion.getStatus(null, 150), is(DatabaseVersion.Status.FRESH_INSTALL));
assertThat(DatabaseVersion.getStatus(123, 150), is(DatabaseVersion.Status.REQUIRES_UPGRADE));
assertThat(DatabaseVersion.getStatus(150, 150), is(DatabaseVersion.Status.UP_TO_DATE));
assertThat(DatabaseVersion.getStatus(200, 150), is(DatabaseVersion.Status.REQUIRES_DOWNGRADE));