]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "SONAR-4490 When creating the H2 db, selected issues should be the unresolved...
authorJulien Lancelot <julien.lancelot@gmail.com>
Fri, 12 Jul 2013 09:51:16 +0000 (11:51 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Fri, 12 Jul 2013 09:51:16 +0000 (11:51 +0200)
This reverts commit 28287efade86c3b7ada5d38481c0b6b644fe6c0a.

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_with_issues.xml
sonar-core/src/test/resources/org/sonar/core/persistence/DryRunDatabaseFactoryTest/should_create_database_with_unresolved_issues.xml [deleted file]

index 7eb56e9b40c8296ab0591d164fbcaba626d97547..5f89ef9895f814231cc9da465509e61cde511dd1 100644 (file)
@@ -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 + "'");
     }
   }
 
index c4c7c9a1986a920863c5b0543ba71eb57b6e9f34..f430aa717715b94b40600c1fd0e440f2df0a5a5a 100644 (file)
@@ -96,18 +96,6 @@ public class DryRunDatabaseFactoryTest extends AbstractDaoTestCase {
     assertThat(rowCount("issues")).isEqualTo(1);
   }
 
-  @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");
index 04e17ab8f0d57afc7c98e6e3ba8c60d2ef14e28c..d25ce652ec83d75f464a20ee22497f6dbf14c086 100644 (file)
       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 (file)
index d25ce65..0000000
+++ /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