diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-07-12 11:51:16 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-07-12 11:51:16 +0200 |
commit | ff0991df5ead28b7b27672563291a0cbf24afcc4 (patch) | |
tree | a04c6eeb394c96d19f49079a317ed531b61ec97e | |
parent | b889735a47b32c6b7eb42325ea8d578f4917e0b6 (diff) | |
download | sonarqube-ff0991df5ead28b7b27672563291a0cbf24afcc4.tar.gz sonarqube-ff0991df5ead28b7b27672563291a0cbf24afcc4.zip |
Revert "SONAR-4490 When creating the H2 db, selected issues should be the unresolved ones and not ones with status != CLOSED"
This reverts commit 28287efade86c3b7ada5d38481c0b6b644fe6c0a.
4 files changed, 26 insertions, 83 deletions
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 7eb56e9b40c..5f89ef9895f 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 @@ -22,12 +22,12 @@ 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.issue.Issue; import org.sonar.api.platform.ServerFileSystem; import org.sonar.api.utils.SonarException; import javax.annotation.Nullable; import javax.sql.DataSource; - import java.io.File; import java.io.IOException; import java.sql.SQLException; @@ -86,7 +86,7 @@ public class DryRunDatabaseFactory implements ServerComponent { String forRootModule = "(root_component_id in (select id from projects where id=" + projectId + " and qualifier='TRK'))"; String forSubModule = "(component_id in (select id from projects where id=" + projectId + " or root_id=" + projectId + "))"; - template.copyTable(source, dest, "issues", "(" + forRootModule + ") or( " + forSubModule + ")", "resolution is null"); + template.copyTable(source, dest, "issues", "(" + forRootModule + ") or( " + forSubModule + ")", "status<>'" + Issue.STATUS_CLOSED + "'"); } } 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 c4c7c9a1986..f430aa71771 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 @@ -97,18 +97,6 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase { } @Test - public void should_create_database_with_unresolved_issues() throws IOException, SQLException { - setupData("should_create_database_with_unresolved_issues"); - - when(serverFileSystem.getTempDir()).thenReturn(temporaryFolder.newFolder()); - - byte[] database = localDatabaseFactory.createDatabaseForDryRun(399L); - dataSource = createDatabase(database); - - assertThat(rowCount("issues")).isEqualTo(1); - } - - @Test public void should_export_issues_of_project_tree() throws IOException, SQLException { setupData("multi-modules-with-issues"); diff --git a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_issues.xml b/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_issues.xml index 04e17ab8f0d..d25ce652ec8 100644 --- a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_issues.xml +++ b/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_issues.xml @@ -42,4 +42,28 @@ updated_at="[null]" /> + <issues + id="101" + kee="101" + component_id="401" + rule_id="501" + severity="MAJOR" + manual_severity="[false]" + message="[null]" + line="120" + effort_to_fix="[null]" + status="CLOSED" + resolution="FIXED" + checksum="[null]" + reporter="[null]" + assignee="user" + author_login="[null]" + issue_attributes="[null]" + issue_creation_date="2013-04-16" + issue_update_date="2013-04-16" + issue_close_date="2013-04-16" + created_at="[null]" + updated_at="[null]" + /> + </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_unresolved_issues.xml b/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_unresolved_issues.xml deleted file mode 100644 index d25ce652ec8..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_unresolved_issues.xml +++ /dev/null @@ -1,69 +0,0 @@ -<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]"/> - <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]"/> - - <rules_profiles id="1" name="Sonar way with Findbugs" language="java" parent_name="" version="1" - used_profile="[false]"/> - - <projects id="399" kee="struts" root_id="[null]"/> - <projects id="400" kee="Action.java" root_id="399"/> - <projects id="401" kee="Filter.java" root_id="399"/> - - <snapshots id="100" project_id="399" root_snapshot_id="[null]" path="" islast="[true]"/> - <snapshots id="101" project_id="400" root_snapshot_id="100" path="100." islast="[true]"/> - <snapshots id="102" project_id="401" root_snapshot_id="100" path="100." islast="[true]"/> - - <rules id="500" plugin_rule_key="AvoidCycle" plugin_name="squid"/> - <rules id="501" plugin_rule_key="NullRef" plugin_name="squid"/> - - <issues - id="100" - kee="100" - component_id="400" - rule_id="500" - severity="BLOCKER" - manual_severity="[false]" - message="[null]" - line="200" - effort_to_fix="[null]" - status="OPEN" - resolution="[null]" - checksum="[null]" - reporter="user" - assignee="user" - author_login="[null]" - issue_attributes="[null]" - issue_creation_date="2013-04-16" - issue_update_date="2013-04-16" - issue_close_date="2013-04-16" - created_at="[null]" - updated_at="[null]" - /> - - <issues - id="101" - kee="101" - component_id="401" - rule_id="501" - severity="MAJOR" - manual_severity="[false]" - message="[null]" - line="120" - effort_to_fix="[null]" - status="CLOSED" - resolution="FIXED" - checksum="[null]" - reporter="[null]" - assignee="user" - author_login="[null]" - issue_attributes="[null]" - issue_creation_date="2013-04-16" - issue_update_date="2013-04-16" - issue_close_date="2013-04-16" - created_at="[null]" - updated_at="[null]" - /> - -</dataset>
\ No newline at end of file |