aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-11-02 10:33:33 +0100
committerDavid Gageot <david@gageot.net>2012-11-02 10:45:05 +0100
commit175c0e69eec53fa8cf17da39a6dfa4691325073b (patch)
treeaec39cc24a905389933c50b49785d6d963fb542a /sonar-batch
parent8bccd3cd3d8ae636a070fc325e38a45d7fdd8438 (diff)
downloadsonarqube-175c0e69eec53fa8cf17da39a6dfa4691325073b.tar.gz
sonarqube-175c0e69eec53fa8cf17da39a6dfa4691325073b.zip
SONAR-3895 Clear DryRun database schema
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/local/DryRunDatabase.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/local/DryRunDatabase.java b/sonar-batch/src/main/java/org/sonar/batch/local/DryRunDatabase.java
index 56f00e1e64c..8a5bf928576 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/local/DryRunDatabase.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/local/DryRunDatabase.java
@@ -21,6 +21,8 @@ package org.sonar.batch.local;
import com.google.common.base.Throwables;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonar.api.BatchComponent;
import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.config.Settings;
@@ -39,6 +41,8 @@ import java.io.IOException;
* @since 3.4
*/
public class DryRunDatabase implements BatchComponent {
+ private static final Logger LOG = LoggerFactory.getLogger(DryRunDatabase.class);
+
private static final String API_SYNCHRO = "/api/synchro";
private static final String DIALECT = "h2";
private static final String DRIVER = "org.h2.Driver";
@@ -53,8 +57,8 @@ public class DryRunDatabase implements BatchComponent {
private final ProjectReactor reactor;
public DryRunDatabase(DryRun dryRun, Settings settings, ServerClient server, TempDirectories tempDirectories, ProjectReactor reactor,
- // project reactor must be completely built
- ProjectReactorReady reactorReady) {
+ // project reactor must be completely built
+ ProjectReactorReady reactorReady) {
this.dryRun = dryRun;
this.settings = settings;
this.server = server;
@@ -75,6 +79,8 @@ public class DryRunDatabase implements BatchComponent {
}
private void downloadDatabase(String projectKey, File toFile) {
+ LOG.info("Downloading DryRun database for project [{}]", projectKey);
+
try {
server.download(API_SYNCHRO + "?resource=" + projectKey, toFile);
} catch (SonarException e) {
@@ -88,12 +94,15 @@ public class DryRunDatabase implements BatchComponent {
}
}
- private void replaceSettings(String h2DatabasePath) {
+ private void replaceSettings(String databasePath) {
+ LOG.info("Overriding database settings");
+
settings
+ .setProperty("sonar.jdbc.schema", "")
.setProperty(DatabaseProperties.PROP_DIALECT, DIALECT)
.setProperty(DatabaseProperties.PROP_DRIVER, DRIVER)
.setProperty(DatabaseProperties.PROP_USER, USER)
.setProperty(DatabaseProperties.PROP_PASSWORD, PASSWORD)
- .setProperty(DatabaseProperties.PROP_URL, URL + h2DatabasePath);
+ .setProperty(DatabaseProperties.PROP_URL, URL + databasePath);
}
}