From: Simon Brandhof Date: Fri, 23 Jan 2015 08:28:43 +0000 (+0100) Subject: SONAR-3499 do not update tags when issues are unchanged X-Git-Tag: latest-silver-master-#65~107 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=97ca9e16fc27e19f021558502fdce23fe9a77460;p=sonarqube.git SONAR-3499 do not update tags when issues are unchanged --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java index 9a48c923812..98af67b2546 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/AnalysisReportService.java @@ -109,6 +109,7 @@ public class AnalysisReportService { setDebt(defaultIssue, issue.debt()); setFieldDiffs(defaultIssue, issue.diffFields(), context.getAnalysisDate()); defaultIssue.setStatus(issue.status()); + defaultIssue.setTags(issue.tags()); defaultIssue.setResolution(issue.resolution()); defaultIssue.setReporter(issue.reporter()); defaultIssue.setAssignee(issue.assignee()); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/757_feed_issue_tags.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/757_feed_issue_tags.rb deleted file mode 100644 index 1d897a52bea..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/757_feed_issue_tags.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -# -# SonarQube 5.1 -# SONAR-5897 -# -class FeedIssueTags < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v51.FeedIssueTags') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/770_feed_issue_tags.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/770_feed_issue_tags.rb new file mode 100644 index 00000000000..1d897a52bea --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/770_feed_issue_tags.rb @@ -0,0 +1,31 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# SonarQube 5.1 +# SONAR-5897 +# +class FeedIssueTags < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.server.db.migrations.v51.FeedIssueTags') + end + +end diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java index dc545559938..0de8dd5803e 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/issue/ReportIssue.java @@ -21,6 +21,7 @@ package org.sonar.batch.protocol.output.issue; import javax.annotation.Nullable; +import java.util.Collection; import java.util.Date; public class ReportIssue { @@ -32,6 +33,7 @@ public class ReportIssue { private String message; private Double effortToFix; private String severity; + private Collection tags; // Temporary fields that should be removed when aggregation/issue tracking is done by computation private boolean isNew; @@ -53,6 +55,7 @@ public class ReportIssue { private String diffFields; private boolean isChanged; + public ReportIssue setKey(String key) { this.key = key; return this; @@ -179,6 +182,15 @@ public class ReportIssue { return assignee; } + public Collection tags() { + return tags; + } + + public ReportIssue setTags(Collection s) { + this.tags = s; + return this; + } + public ReportIssue setRuleKey(String ruleRepo, String ruleKey) { this.ruleRepo = ruleRepo; this.ruleKey = ruleKey; diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java index 5399b1ac149..4edf13d2e18 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java @@ -81,6 +81,7 @@ public class IssuesPublisher implements ReportPublisher { .setUpdateDate(issue.updateDate()) .setSelectedAt(issue.selectedAt()) .setDiffFields(toString(issue.currentChange())) + .setTags(issue.tags()) .setChanged(issue.isChanged()); } diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index c06f0d75330..d45867e74e0 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -33,7 +33,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 769; + public static final int LAST_VERSION = 770; /** * List of all the tables.n diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index f25336b3b50..5d5fbca06b6 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -285,7 +285,6 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('753'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('754'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('755'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('756'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('757'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('758'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('759'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('760'); @@ -298,6 +297,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('766'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('767'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('768'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('769'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('770'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;