aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-10-24 09:20:28 +0200
committerDavid Gageot <david@gageot.net>2012-10-24 09:20:28 +0200
commita34fafa1ca7025b1381192043920daae72de80a1 (patch)
treeba3c0e7b6e6a5819f3f685fda47266bd30040d0f /sonar-core
parent525b465edfbfe72f0e0959b75112e08d9420983e (diff)
downloadsonarqube-a34fafa1ca7025b1381192043920daae72de80a1.tar.gz
sonarqube-a34fafa1ca7025b1381192043920daae72de80a1.zip
SONAR-3895 Export more tables
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/LocalDatabaseFactory.java12
-rw-r--r--sonar-core/src/test/java/org/sonar/core/persistence/LocalDatabaseFactoryTest.java2
2 files changed, 11 insertions, 3 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/LocalDatabaseFactory.java b/sonar-core/src/main/java/org/sonar/core/persistence/LocalDatabaseFactory.java
index 94d83bfaf5c..f9bd10e9f1f 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/LocalDatabaseFactory.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/LocalDatabaseFactory.java
@@ -22,6 +22,7 @@ package org.sonar.core.persistence;
import com.google.common.io.Files;
import org.apache.commons.dbcp.BasicDataSource;
import org.sonar.api.ServerComponent;
+import org.sonar.api.platform.ServerFileSystem;
import org.sonar.api.utils.SonarException;
import javax.sql.DataSource;
@@ -38,12 +39,15 @@ public class LocalDatabaseFactory implements ServerComponent {
private static final String PASSWORD = "sonar";
private final Database database;
+ private final ServerFileSystem serverFileSystem;
- public LocalDatabaseFactory(Database database) {
+ public LocalDatabaseFactory(Database database, ServerFileSystem serverFileSystem) {
this.database = database;
+ this.serverFileSystem = serverFileSystem;
}
public byte[] createDatabaseForLocalMode() {
+ // serverFileSystem.getTempDir()
String name = System.getenv("java.io") + System.nanoTime(); // TODO
try {
@@ -64,7 +68,11 @@ public class LocalDatabaseFactory implements ServerComponent {
.copyTable(source, dest, "RULES_PARAMETERS", "SELECT * FROM RULES_PARAMETERS")
.copyTable(source, dest, "ACTIVE_RULES", "SELECT * FROM ACTIVE_RULES")
.copyTable(source, dest, "ACTIVE_RULE_PARAMETERS", "SELECT * FROM ACTIVE_RULE_PARAMETERS")
- .copyTable(source, dest, "METRICS", "SELECT * FROM METRICS");
+ .copyTable(source, dest, "METRICS", "SELECT * FROM METRICS")
+ .copyTable(source, dest, "CHARACTERISTICS", "SELECT * FROM CHARACTERISTICS")
+ .copyTable(source, dest, "CHARACTERISTIC_PROPERTIES", "SELECT * FROM CHARACTERISTIC_PROPERTIES")
+ .copyTable(source, dest, "CHARACTERISTIC_EDGES", "SELECT * FROM CHARACTERISTIC_EDGES")
+ .copyTable(source, dest, "QUALITY_MODELS", "SELECT * FROM QUALITY_MODELS");
}
private BasicDataSource create(String dialect, String driver, String user, String password, String url) {
diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/LocalDatabaseFactoryTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/LocalDatabaseFactoryTest.java
index 37f48eb2110..79ac446b7ec 100644
--- a/sonar-core/src/test/java/org/sonar/core/persistence/LocalDatabaseFactoryTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/persistence/LocalDatabaseFactoryTest.java
@@ -42,7 +42,7 @@ public class LocalDatabaseFactoryTest extends AbstractDaoTestCase {
@Before
public void setUp() {
- localDatabaseFactory = new LocalDatabaseFactory(getDatabase());
+ localDatabaseFactory = new LocalDatabaseFactory(getDatabase(), null);
}
@After