]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 5 Dec 2012 07:38:50 +0000 (08:38 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 5 Dec 2012 07:38:50 +0000 (08:38 +0100)
sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java
sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java
sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/batch_bootstrap_controller.rb

index 6530140510da24403bcb34805164aa9e09f86030..91ebe74f100f285e5c5c76c7e6a3517ef5934833 100644 (file)
@@ -46,14 +46,14 @@ public class DryRunDatabaseFactory implements ServerComponent {
     this.serverFileSystem = serverFileSystem;
   }
 
-  public byte[] createDatabaseForDryRun(Integer resourceId) {
+  public byte[] createDatabaseForDryRun() {
     String name = serverFileSystem.getTempDir().getAbsolutePath() + "db-" + System.nanoTime();
 
     try {
       DataSource source = database.getDataSource();
       BasicDataSource destination = create(DIALECT, DRIVER, USER, PASSWORD, URL + name);
 
-      copy(source, destination, resourceId);
+      copy(source, destination);
       close(destination);
 
       return dbFileContent(name);
@@ -62,7 +62,7 @@ public class DryRunDatabaseFactory implements ServerComponent {
     }
   }
 
-  private void copy(DataSource source, DataSource dest, Integer resourceId) {
+  private void copy(DataSource source, DataSource dest) {
     new DbTemplate()
         .copyTable(source, dest, "active_rules")
         .copyTable(source, dest, "active_rule_parameters")
index aa284c22e13e30f2d84e8bab0c88bac544e2e8c2..2832446ae5345027d31ed7bc145a3ec4d569ec6c 100644 (file)
@@ -63,7 +63,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
 
     when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot());
 
-    byte[] database = localDatabaseFactory.createDatabaseForDryRun(1);
+    byte[] database = localDatabaseFactory.createDatabaseForDryRun();
     dataSource = createDatabase(database);
 
     assertThat(rowCount("metrics")).isEqualTo(2);
index ab58927f5fe7e631c26981c7ffa2d92e73030ecb..681912fd13a7d783ee03a688711d479f85111879 100644 (file)
@@ -517,7 +517,7 @@ public final class JRubyFacade {
     }
   }
 
-  public byte[] createDatabaseForDryRun(int resourceId) {
-    return get(DryRunDatabaseFactory.class).createDatabaseForDryRun(resourceId);
+  public byte[] createDatabaseForDryRun() {
+    return get(DryRunDatabaseFactory.class).createDatabaseForDryRun();
   }
 }
index 592870aa354f9386ced2f11ab7b1604f668b4af0..45fd241e2f4f91e652f80d3211f7466138ec8cbc 100644 (file)
@@ -25,7 +25,7 @@ class BatchBootstrapController < Api::ApiController
   def db
     require_parameters :project
     project = load_project()
-    db_content = java_facade.createDatabaseForDryRun(project ? project.id : nil)
+    db_content = java_facade.createDatabaseForDryRun()
 
     send_data String.from_java_bytes(db_content)
   end