From dc7fa6d03c5dbde59c3c6db9aeee9378c0692075 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 5 Sep 2013 15:56:56 +0200 Subject: [PATCH] SONAR-4594 Export events in dryRun database --- .../org/sonar/core/persistence/DryRunDatabaseFactory.java | 2 ++ .../org/sonar/core/persistence/DryRunDatabaseFactoryTest.java | 2 ++ .../DryRunDatabaseFactoryTest/should_create_database.xml | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java b/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java index 795714c3a6a..7369d11e8d0 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DryRunDatabaseFactory.java @@ -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); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java index 0875e0aba59..323e8e68fba 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/DryRunDatabaseFactoryTest.java @@ -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(); } diff --git a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database.xml b/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database.xml index 2678396e998..008976fde37 100644 --- a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database.xml +++ b/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database.xml @@ -25,4 +25,8 @@ + + + + -- 2.39.5