aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java/org/sonar
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-04-07 12:06:59 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-04-07 12:07:06 +0200
commitf03d90c5d72b1f258d1a4ceb594b261a1204cbf7 (patch)
tree2bbdfba04e0604b6a8aa774b33c27a5730bdfc4d /sonar-batch/src/main/java/org/sonar
parent5cb674fc459becdb0a76a42e3ac295918cfb4369 (diff)
downloadsonarqube-f03d90c5d72b1f258d1a4ceb594b261a1204cbf7.tar.gz
sonarqube-f03d90c5d72b1f258d1a4ceb594b261a1204cbf7.zip
SONAR-5105 Verify config using DB connection instead of settings that come from WS
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java
index 8f2fcbbaed3..e2e9ccc1ada 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/DatabaseCompatibility.java
@@ -25,6 +25,7 @@ import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseProperties;
import org.sonar.api.utils.MessageException;
import org.sonar.core.persistence.DatabaseVersion;
+import org.sonar.core.properties.PropertiesDao;
/**
* Detects if database is not up-to-date with the version required by the batch.
@@ -33,13 +34,15 @@ public class DatabaseCompatibility implements BatchComponent {
private DatabaseVersion version;
private Settings settings;
+ private PropertiesDao propertiesDao;
private ServerMetadata server;
private AnalysisMode analysisMode;
- public DatabaseCompatibility(DatabaseVersion version, ServerMetadata server, Settings settings, AnalysisMode mode) {
+ public DatabaseCompatibility(DatabaseVersion version, ServerMetadata server, Settings settings, PropertiesDao propertiesDao, AnalysisMode mode) {
this.version = version;
this.server = server;
this.settings = settings;
+ this.propertiesDao = propertiesDao;
this.analysisMode = mode;
}
@@ -51,7 +54,7 @@ public class DatabaseCompatibility implements BatchComponent {
}
private void checkCorrectServerId() {
- if (!settings.getString(CoreProperties.SERVER_ID).equals(server.getServerId())) {
+ if (!propertiesDao.selectGlobalProperty(CoreProperties.SERVER_ID).getValue().equals(server.getServerId())) {
StringBuilder message = new StringBuilder("The current batch process and the configured remote server do not share the same DB configuration.\n");
message.append("\t- Batch side: ");
message.append(settings.getString(DatabaseProperties.PROP_URL));