diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-02-20 11:09:13 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-02-20 11:09:26 +0100 |
commit | 136e9739fbc318af18283b6e8cbcf671f6fa6b7e (patch) | |
tree | f74c0f5ee88167a0d4ea839545d13ad655351a20 | |
parent | 86dbe8cf7ca6e8483eff3ea8b66e2b3109a12b00 (diff) | |
download | sonarqube-136e9739fbc318af18283b6e8cbcf671f6fa6b7e.tar.gz sonarqube-136e9739fbc318af18283b6e8cbcf671f6fa6b7e.zip |
Add test for export for dry run database
2 files changed, 19 insertions, 5 deletions
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 2fb10669d8b..4df677020ba 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 @@ -58,7 +58,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase { } @Test - public void should_create_database() throws IOException, SQLException { + public void should_create_database_without_project() throws IOException, SQLException { setupData("should_create_database"); when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot()); @@ -71,7 +71,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase { } @Test - public void should_create_database_with_project_data() throws IOException, SQLException { + public void should_create_database_with_project() throws IOException, SQLException { setupData("should_create_database"); when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.getRoot()); @@ -80,7 +80,7 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase { dataSource = createDatabase(database); assertThat(rowCount("metrics")).isEqualTo(2); - assertThat(rowCount("projects")).isZero(); + assertThat(rowCount("projects")).isEqualTo(1); } private BasicDataSource createDatabase(byte[] db) throws IOException { 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 7eb86c2bfde..5dc8035b8e0 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 @@ -1,10 +1,24 @@ <dataset> <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]" /> + enabled="[true]" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" delete_historical_data="[null]"/> <metrics id="2" name="coverage" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" - enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]" /> + enabled="[true]" worst_value="0" optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" delete_historical_data="[null]"/> <rules_profiles id="1" name="Sonar way with Findbugs" language="java" parent_name="" version="1" used_profile="[false]"/> + + <projects id="123" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" + description="[null]" long_name="Apache Struts" + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" created_at="2013-01-25 02:04:06.00"/> + + <snapshots id="1000" project_id="123" root_project_id="123" root_snapshot_id="1000" parent_snapshot_id="[null]" + scope="PRJ" qualifier="TRK" path="1000." depth="1" + purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" + period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" + period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" + period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" + created_at="2013-01-25 02:04:06.00" build_date="2013-01-25 02:04:06.00" + version="1.0" status="P" islast="[true]"/> + </dataset>
\ No newline at end of file |