]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4594 Export events in dryRun database
authorJulien HENRY <julien.henry@sonarsource.com>
Thu, 5 Sep 2013 13:56:56 +0000 (15:56 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Thu, 5 Sep 2013 13:57:34 +0000 (15:57 +0200)
sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java
sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java
sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database.xml

index 795714c3a6aa0843d7ae670e95fe063ba62c66f6..7369d11e8d057146bb9680542b5f3a69a27a57bc 100644 (file)
@@ -170,6 +170,8 @@ public class DryRunDatabaseFactory implements ServerComponent {
     if (projectId != null) {
       template.copyTable(source, dest, "projects", projectQuery(projectId, false));
 
+      template.copyTable(source, dest, "events", "SELECT * FROM events WHERE resource_id=" + projectId);
+
       template.copyTable(source, dest, "snapshots", "SELECT * FROM snapshots WHERE project_id=" + projectId);
       template.copyTable(source, dest, "project_measures", "SELECT m.* FROM project_measures m INNER JOIN snapshots s on m.snapshot_id=s.id WHERE s.project_id=" + projectId);
 
index 0875e0aba59dd8e56408867853aedf331b3d3ce9..323e8e68fba25db29662c3eb9d38a43c1a7250f0 100644 (file)
@@ -79,6 +79,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
     assertThat(rowCount("metrics")).isEqualTo(2);
     assertThat(rowCount("projects")).isZero();
     assertThat(rowCount("alerts")).isEqualTo(1);
+    assertThat(rowCount("events")).isZero();
 
     assertThat(dryRunCacheFolder).isDirectory();
   }
@@ -129,6 +130,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
     assertThat(rowCount("projects")).isEqualTo(1);
     assertThat(rowCount("snapshots")).isEqualTo(1);
     assertThat(rowCount("project_measures")).isEqualTo(1);
+    assertThat(rowCount("events")).isEqualTo(2);
 
     assertThat(dryRunCacheFolder).isDirectory();
   }
index 2678396e998d74495dab0bbceb4ea1c57fb3d313..008976fde378294fcd9f1e6f64bf58f14879779b 100644 (file)
@@ -25,4 +25,8 @@
 
   <project_measures id="1" value="10" metric_id="1" snapshot_id="1000" />
 
+  <events id="1" name="1.0-SNAPSHOT" resource_id="123" />
+  <events id="2" name="2.0-SNAPSHOT" resource_id="123" />
+  <events id="3" name="1.0-SNAPSHOT" resource_id="456" />
+
 </dataset>