]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3895 Export more tables
authorDavid Gageot <david@gageot.net>
Wed, 24 Oct 2012 07:20:28 +0000 (09:20 +0200)
committerDavid Gageot <david@gageot.net>
Wed, 24 Oct 2012 07:20:28 +0000 (09:20 +0200)
sonar-core/src/main/java/org/sonar/core/persistence/LocalDatabaseFactory.java
sonar-core/src/test/java/org/sonar/core/persistence/LocalDatabaseFactoryTest.java

index 94d83bfaf5caa0ee2d0708c7e1e7cc5c3cbcdf7f..f9bd10e9f1fc84f5fdd0f73acc268e22e2bff31c 100644 (file)
@@ -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) {
index 37f48eb21100e3f9694a7095bbba11476372b449..79ac446b7ec3fc8b776b86bbe6297580103dc4ca 100644 (file)
@@ -42,7 +42,7 @@ public class LocalDatabaseFactoryTest extends AbstractDaoTestCase {
 
   @Before
   public void setUp() {
-    localDatabaseFactory = new LocalDatabaseFactory(getDatabase());
+    localDatabaseFactory = new LocalDatabaseFactory(getDatabase(), null);
   }
 
   @After