From e17cf1c2dc52256336c388c5dc4bde3087c13c1c Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 12 Jun 2015 14:20:54 +0200 Subject: [PATCH] SONAR-6637 Stop filling db column PROJECT_MEASURES.RULE_PRIORITY --- .../computation/step/PersistMeasuresStep.java | 1 - .../step/PersistMeasuresStepTest.java | 11 +- .../measure/persistence/MeasureDaoTest.java | 5 +- .../MeasureDaoTest/insert-result.xml | 2 +- .../controllers/api/resources_controller.rb | 29 +- .../WEB-INF/app/helpers/components_helper.rb | 2 +- .../WEB-INF/app/models/project_measure.rb | 10 +- .../db/migrate/231_refactor_rule_measures.rb | 62 --- .../batch/protocol/output/BatchReport.java | 362 +++++++----------- .../src/main/protobuf/batch_report.proto | 1 - .../sonar/batch/report/MeasuresPublisher.java | 16 +- .../org/sonar/core/measure/db/MeasureDto.java | 23 -- .../sonar/core/measure/db/MeasureMapper.xml | 4 +- .../sonar/core/measure/db/MeasureDtoTest.java | 15 - .../api/database/model/MeasureModel.java | 38 +- 15 files changed, 161 insertions(+), 420 deletions(-) delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/231_refactor_rule_measures.rb diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java index 5ad32bb0ab9..56130f97f1c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistMeasuresStep.java @@ -124,7 +124,6 @@ public class PersistMeasuresStep implements ComputationStep { out.setAlertStatus(in.hasAlertStatus() ? in.getAlertStatus() : null); out.setAlertText(in.hasAlertText() ? in.getAlertText() : null); out.setDescription(in.hasDescription() ? in.getDescription() : null); - out.setSeverity(in.hasSeverity() ? in.getSeverity().name() : null); out.setComponentId(componentId); out.setSnapshotId(snapshotId); out.setMetricId(metricCache.get(in.getMetricKey()).getId()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java index 47527df45d6..9252828d997 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java @@ -33,7 +33,6 @@ import org.sonar.api.rule.RuleKey; import org.sonar.api.rule.Severity; import org.sonar.api.utils.System2; import org.sonar.api.utils.internal.Uuids; -import org.sonar.batch.protocol.Constants; import org.sonar.batch.protocol.Constants.MeasureValueType; import org.sonar.batch.protocol.output.BatchReport; import org.sonar.core.component.ComponentDto; @@ -138,7 +137,6 @@ public class PersistMeasuresStepTest extends BaseStepTest { .setAlertStatus("WARN") .setAlertText("Open issues > 0") .setDescription("measure-description") - .setSeverity(Constants.Severity.INFO) .setMetricKey(METRIC_KEY) .setRuleKey(RULE_KEY.toString()) .setCharactericId(123456) @@ -156,7 +154,6 @@ public class PersistMeasuresStepTest extends BaseStepTest { .setAlertStatus("ERROR") .setAlertText("Blocker issues variation > 0") .setDescription("measure-description") - .setSeverity(Constants.Severity.BLOCKER) .setMetricKey(METRIC_KEY) .setRuleKey(RULE_KEY.toString()) .setCharactericId(123456) @@ -168,8 +165,8 @@ public class PersistMeasuresStepTest extends BaseStepTest { assertThat(dbTester.countRowsOfTable("project_measures")).isEqualTo(2); List> dtos = dbTester.select( - "select snapshot_id as \"snapshotId\", project_id as \"componentId\", metric_id as \"metricId\", rule_id as \"ruleId\", value as \"value\", text_value as \"textValue\", " + - "rule_priority as \"severity\" from project_measures"); + "select snapshot_id as \"snapshotId\", project_id as \"componentId\", metric_id as \"metricId\", rule_id as \"ruleId\", value as \"value\", text_value as \"textValue\" " + + " from project_measures"); Map dto = dtos.get(0); assertThat(dto.get("snapshotId")).isEqualTo(3L); @@ -177,7 +174,6 @@ public class PersistMeasuresStepTest extends BaseStepTest { assertThat(dto.get("metricId")).isEqualTo(metric.getId().longValue()); assertThat(dto.get("ruleId")).isEqualTo(rule.getId().longValue()); assertThat(dto.get("textValue")).isEqualTo("measure-data"); - assertThat(dto.get("severity")).isEqualTo(0L); dto = dtos.get(1); assertThat(dto.get("snapshotId")).isEqualTo(4L); @@ -185,7 +181,6 @@ public class PersistMeasuresStepTest extends BaseStepTest { assertThat(dto.get("metricId")).isEqualTo(metric.getId().longValue()); assertThat(dto.get("ruleId")).isEqualTo(rule.getId().longValue()); assertThat(dto.get("value")).isEqualTo(123.123d); - assertThat(dto.get("severity")).isEqualTo(4L); } @Test @@ -204,7 +199,6 @@ public class PersistMeasuresStepTest extends BaseStepTest { .setAlertStatus("WARN") .setAlertText("Open issues > 0") .setDescription("measure-description") - .setSeverity(Constants.Severity.CRITICAL) .setMetricKey(METRIC_KEY) .setRuleKey(RULE_KEY.toString()) .setCharactericId(123456) @@ -227,7 +221,6 @@ public class PersistMeasuresStepTest extends BaseStepTest { .setAlertStatus("WARN") .setAlertText("Open issues > 0") .setDescription("measure-description") - .setSeverity(Severity.CRITICAL) .setMetricId(metric.getId()) .setRuleId(rule.getId())); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java index 23a3cc413a5..1a25719b7ef 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/persistence/MeasureDaoTest.java @@ -20,19 +20,17 @@ package org.sonar.server.measure.persistence; +import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.sonar.api.rule.Severity; import org.sonar.core.measure.db.MeasureDto; import org.sonar.core.persistence.DbSession; import org.sonar.core.persistence.DbTester; import org.sonar.test.DbTests; -import java.util.List; - import static com.google.common.collect.Lists.newArrayList; import static org.assertj.core.api.Assertions.assertThat; @@ -155,7 +153,6 @@ public class MeasureDaoTest { .setComponentId(6L) .setValue(2.0d) .setData("measure-value") - .setSeverity(Severity.INFO) .setVariation(1, 1.0d) .setVariation(2, 2.0d) .setVariation(3, 3.0d) diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml index f8929782f32..26c55c5d3c4 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/measure/persistence/MeasureDaoTest/insert-result.xml @@ -10,7 +10,7 @@ value="2.0" text_value="measure-value" tendency="[null]" - rule_priority="0" + rule_priority="[null]" measure_date="[null]" measure_data="[null]" variation_value_1="1.0" diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb index 928fbb5dcef..35918a606ab 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb @@ -274,20 +274,10 @@ class Api::ResourcesController < Api::ApiController if params['filter_rules'] (params['filter_rules']=='true') ? params['rules']='false' : params['rules']='true' end - - if params['metrics'] - if params['metrics'].include? 'mandatory_violations' - params['metrics']=params['metrics'].gsub(/mandatory_violations/, 'violations') - params['rule_priorities']='MAJOR' - elsif params['metrics'].include? 'optional_violations' - params['metrics']=params['metrics'].gsub(/optional_violations/, 'violations') - params['rule_priorities']='INFO' - end - end end def select_columns_for_measures - select_columns='project_measures.id,project_measures.value,project_measures.metric_id,project_measures.snapshot_id,project_measures.rule_id,project_measures.rule_priority,project_measures.text_value,project_measures.characteristic_id,project_measures.measure_data' + select_columns='project_measures.id,project_measures.value,project_measures.metric_id,project_measures.snapshot_id,project_measures.rule_id,project_measures.text_value,project_measures.characteristic_id,project_measures.measure_data' if params[:includetrends]=='true' select_columns+=',project_measures.variation_value_1,project_measures.variation_value_2,project_measures.variation_value_3,project_measures.variation_value_4,project_measures.variation_value_5' end @@ -315,17 +305,6 @@ class Api::ResourcesController < Api::ApiController measures_values[:rule_ids]=rule_ids.compact end - param_priorities = params['rule_priorities'] || 'false' - if param_priorities=='true' - measures_conditions << "project_measures.rule_priority IS NOT NULL" - elsif param_priorities=='false' - measures_conditions << "project_measures.rule_priority IS NULL" if param_rules=='false' - else - measures_conditions << "project_measures.rule_priority IN (:priorities)" - measures_values[:priorities]=param_priorities.split(',').map do |p| - Sonar::RulePriority.id(p) - end.compact - end end def add_characteristic_filters(measures_conditions, measures_values) @@ -454,9 +433,6 @@ class Api::ResourcesController < Api::ApiController json_measure[:rule_key] = rule.key if rule json_measure[:rule_name] = rule.name if rule end - if measure.rule_priority - json_measure[:rule_priority] = Sonar::RulePriority.to_s(measure.rule_priority) - end if measure.characteristic_id characteristic=@characteristic_by_id[measure.characteristic_id] json_measure[:ctic_key]=(characteristic ? characteristic.kee : '') @@ -541,9 +517,6 @@ class Api::ResourcesController < Api::ApiController xml.rule_key(rule.key) if rule xml.rule_name(rule.name) if rule end - if measure.rule_priority - xml.rule_priority(Sonar::RulePriority.to_s(measure.rule_priority)) - end if measure.characteristic_id characteristic=@characteristic_by_id[measure.characteristic_id] xml.ctic_key(characteristic ? characteristic.kee : '') diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb index 83b50b73d7f..64f83d1f554 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/components_helper.rb @@ -68,7 +68,7 @@ module ComponentsHelper return nil if items.nil? items.each do |item| metric = Metric.by_name(metric_name) - return item if (item && metric && item.metric_id==metric.id && item.rule_priority.nil? && item.characteristic_id.nil? && item.person_id.nil?) + return item if (item && metric && item.metric_id==metric.id && item.characteristic_id.nil? && item.person_id.nil?) end nil end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb index c85fcbb789a..e3195f67456 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -44,7 +44,7 @@ class ProjectMeasure < ActiveRecord::Base end def rule_measure? - rule_id || rule_priority + rule_id != nil end def data @@ -233,14 +233,12 @@ class ProjectMeasure < ActiveRecord::Base # Deprecated in v.2.13. Replaced by severity() def rule_priority_text - severity + nil end + # not used for a while. Deprecated in 5.2. def severity - @severity ||= - begin - rule_priority ? Sonar::RulePriority.to_s(rule_priority) : nil - end + nil end def key diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/231_refactor_rule_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/231_refactor_rule_measures.rb deleted file mode 100644 index aaa2113df77..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/231_refactor_rule_measures.rb +++ /dev/null @@ -1,62 +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. -# - -# -# Sonar 2.13 -# http://jira.sonarsource.com/browse/SONAR-1974 -# -class RefactorRuleMeasures < ActiveRecord::Migration - - class ProjectMeasure < ActiveRecord::Base - end - - class Metric < ActiveRecord::Base - end - - def self.up - Metric.reset_column_information - ProjectMeasure.reset_column_information - - replace('violations', 0, 'info_violations') - replace('violations', 1, 'minor_violations') - replace('violations', 2, 'major_violations') - replace('violations', 3, 'critical_violations') - replace('violations', 4, 'blocker_violations') - - replace('new_violations', 0, 'new_info_violations') - replace('new_violations', 1, 'new_minor_violations') - replace('new_violations', 2, 'new_major_violations') - replace('new_violations', 3, 'new_critical_violations') - replace('new_violations', 4, 'new_blocker_violations') - end - - - private - def self.replace(from_metric_key, from_severity, to_metric_key) - from_metric = Metric.find_by_name(from_metric_key) - to_metric = Metric.find_by_name(to_metric_key) - - if from_metric && to_metric - say_with_time("Update metric #{to_metric_key}") do - ProjectMeasure.update_all("metric_id=#{to_metric.id}", "metric_id=#{from_metric.id} AND rule_id IS NOT NULL AND rule_priority=#{from_severity}") - end - end - end -end diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java index 1903e566549..a238e9ef2fd 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java @@ -3938,15 +3938,6 @@ public final class BatchReport { com.google.protobuf.ByteString getRuleKeyBytes(); - /** - * optional .Severity severity = 11; - */ - boolean hasSeverity(); - /** - * optional .Severity severity = 11; - */ - org.sonar.batch.protocol.Constants.Severity getSeverity(); - /** * optional string alert_status = 12; */ @@ -4145,61 +4136,50 @@ public final class BatchReport { ruleKey_ = bs; break; } - case 88: { - int rawValue = input.readEnum(); - org.sonar.batch.protocol.Constants.Severity value = org.sonar.batch.protocol.Constants.Severity.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(11, rawValue); - } else { - bitField0_ |= 0x00000200; - severity_ = value; - } - break; - } case 98: { com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000200; alertStatus_ = bs; break; } case 106: { com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000400; alertText_ = bs; break; } case 113: { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; variationValue1_ = input.readDouble(); break; } case 121: { - bitField0_ |= 0x00002000; + bitField0_ |= 0x00001000; variationValue2_ = input.readDouble(); break; } case 129: { - bitField0_ |= 0x00004000; + bitField0_ |= 0x00002000; variationValue3_ = input.readDouble(); break; } case 137: { - bitField0_ |= 0x00008000; + bitField0_ |= 0x00004000; variationValue4_ = input.readDouble(); break; } case 145: { - bitField0_ |= 0x00010000; + bitField0_ |= 0x00008000; variationValue5_ = input.readDouble(); break; } case 152: { - bitField0_ |= 0x00020000; + bitField0_ |= 0x00010000; charactericId_ = input.readInt32(); break; } case 160: { - bitField0_ |= 0x00040000; + bitField0_ |= 0x00020000; personId_ = input.readInt32(); break; } @@ -4506,28 +4486,13 @@ public final class BatchReport { } } - public static final int SEVERITY_FIELD_NUMBER = 11; - private org.sonar.batch.protocol.Constants.Severity severity_; - /** - * optional .Severity severity = 11; - */ - public boolean hasSeverity() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * optional .Severity severity = 11; - */ - public org.sonar.batch.protocol.Constants.Severity getSeverity() { - return severity_; - } - public static final int ALERT_STATUS_FIELD_NUMBER = 12; private java.lang.Object alertStatus_; /** * optional string alert_status = 12; */ public boolean hasAlertStatus() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string alert_status = 12; @@ -4569,7 +4534,7 @@ public final class BatchReport { * optional string alert_text = 13; */ public boolean hasAlertText() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional string alert_text = 13; @@ -4611,7 +4576,7 @@ public final class BatchReport { * optional double variation_value_1 = 14; */ public boolean hasVariationValue1() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional double variation_value_1 = 14; @@ -4626,7 +4591,7 @@ public final class BatchReport { * optional double variation_value_2 = 15; */ public boolean hasVariationValue2() { - return ((bitField0_ & 0x00002000) == 0x00002000); + return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional double variation_value_2 = 15; @@ -4641,7 +4606,7 @@ public final class BatchReport { * optional double variation_value_3 = 16; */ public boolean hasVariationValue3() { - return ((bitField0_ & 0x00004000) == 0x00004000); + return ((bitField0_ & 0x00002000) == 0x00002000); } /** * optional double variation_value_3 = 16; @@ -4656,7 +4621,7 @@ public final class BatchReport { * optional double variation_value_4 = 17; */ public boolean hasVariationValue4() { - return ((bitField0_ & 0x00008000) == 0x00008000); + return ((bitField0_ & 0x00004000) == 0x00004000); } /** * optional double variation_value_4 = 17; @@ -4671,7 +4636,7 @@ public final class BatchReport { * optional double variation_value_5 = 18; */ public boolean hasVariationValue5() { - return ((bitField0_ & 0x00010000) == 0x00010000); + return ((bitField0_ & 0x00008000) == 0x00008000); } /** * optional double variation_value_5 = 18; @@ -4686,7 +4651,7 @@ public final class BatchReport { * optional int32 characteric_id = 19; */ public boolean hasCharactericId() { - return ((bitField0_ & 0x00020000) == 0x00020000); + return ((bitField0_ & 0x00010000) == 0x00010000); } /** * optional int32 characteric_id = 19; @@ -4701,7 +4666,7 @@ public final class BatchReport { * optional int32 person_id = 20; */ public boolean hasPersonId() { - return ((bitField0_ & 0x00040000) == 0x00040000); + return ((bitField0_ & 0x00020000) == 0x00020000); } /** * optional int32 person_id = 20; @@ -4720,7 +4685,6 @@ public final class BatchReport { metricKey_ = ""; description_ = ""; ruleKey_ = ""; - severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; alertStatus_ = ""; alertText_ = ""; variationValue1_ = 0D; @@ -4772,33 +4736,30 @@ public final class BatchReport { output.writeBytes(10, getRuleKeyBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { - output.writeEnum(11, severity_.getNumber()); - } - if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeBytes(12, getAlertStatusBytes()); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeBytes(13, getAlertTextBytes()); } - if (((bitField0_ & 0x00001000) == 0x00001000)) { + if (((bitField0_ & 0x00000800) == 0x00000800)) { output.writeDouble(14, variationValue1_); } - if (((bitField0_ & 0x00002000) == 0x00002000)) { + if (((bitField0_ & 0x00001000) == 0x00001000)) { output.writeDouble(15, variationValue2_); } - if (((bitField0_ & 0x00004000) == 0x00004000)) { + if (((bitField0_ & 0x00002000) == 0x00002000)) { output.writeDouble(16, variationValue3_); } - if (((bitField0_ & 0x00008000) == 0x00008000)) { + if (((bitField0_ & 0x00004000) == 0x00004000)) { output.writeDouble(17, variationValue4_); } - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00008000) == 0x00008000)) { output.writeDouble(18, variationValue5_); } - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00010000) == 0x00010000)) { output.writeInt32(19, charactericId_); } - if (((bitField0_ & 0x00040000) == 0x00040000)) { + if (((bitField0_ & 0x00020000) == 0x00020000)) { output.writeInt32(20, personId_); } getUnknownFields().writeTo(output); @@ -4847,42 +4808,38 @@ public final class BatchReport { .computeBytesSize(10, getRuleKeyBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(11, severity_.getNumber()); - } - if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(12, getAlertStatusBytes()); } - if (((bitField0_ & 0x00000800) == 0x00000800)) { + if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(13, getAlertTextBytes()); } - if (((bitField0_ & 0x00001000) == 0x00001000)) { + if (((bitField0_ & 0x00000800) == 0x00000800)) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(14, variationValue1_); } - if (((bitField0_ & 0x00002000) == 0x00002000)) { + if (((bitField0_ & 0x00001000) == 0x00001000)) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(15, variationValue2_); } - if (((bitField0_ & 0x00004000) == 0x00004000)) { + if (((bitField0_ & 0x00002000) == 0x00002000)) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(16, variationValue3_); } - if (((bitField0_ & 0x00008000) == 0x00008000)) { + if (((bitField0_ & 0x00004000) == 0x00004000)) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(17, variationValue4_); } - if (((bitField0_ & 0x00010000) == 0x00010000)) { + if (((bitField0_ & 0x00008000) == 0x00008000)) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(18, variationValue5_); } - if (((bitField0_ & 0x00020000) == 0x00020000)) { + if (((bitField0_ & 0x00010000) == 0x00010000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(19, charactericId_); } - if (((bitField0_ & 0x00040000) == 0x00040000)) { + if (((bitField0_ & 0x00020000) == 0x00020000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(20, personId_); } @@ -5021,26 +4978,24 @@ public final class BatchReport { bitField0_ = (bitField0_ & ~0x00000080); ruleKey_ = ""; bitField0_ = (bitField0_ & ~0x00000100); - severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; - bitField0_ = (bitField0_ & ~0x00000200); alertStatus_ = ""; - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000200); alertText_ = ""; - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); variationValue1_ = 0D; - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00000800); variationValue2_ = 0D; - bitField0_ = (bitField0_ & ~0x00002000); + bitField0_ = (bitField0_ & ~0x00001000); variationValue3_ = 0D; - bitField0_ = (bitField0_ & ~0x00004000); + bitField0_ = (bitField0_ & ~0x00002000); variationValue4_ = 0D; - bitField0_ = (bitField0_ & ~0x00008000); + bitField0_ = (bitField0_ & ~0x00004000); variationValue5_ = 0D; - bitField0_ = (bitField0_ & ~0x00010000); + bitField0_ = (bitField0_ & ~0x00008000); charactericId_ = 0; - bitField0_ = (bitField0_ & ~0x00020000); + bitField0_ = (bitField0_ & ~0x00010000); personId_ = 0; - bitField0_ = (bitField0_ & ~0x00040000); + bitField0_ = (bitField0_ & ~0x00020000); return this; } @@ -5108,42 +5063,38 @@ public final class BatchReport { if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000200; } - result.severity_ = severity_; + result.alertStatus_ = alertStatus_; if (((from_bitField0_ & 0x00000400) == 0x00000400)) { to_bitField0_ |= 0x00000400; } - result.alertStatus_ = alertStatus_; + result.alertText_ = alertText_; if (((from_bitField0_ & 0x00000800) == 0x00000800)) { to_bitField0_ |= 0x00000800; } - result.alertText_ = alertText_; + result.variationValue1_ = variationValue1_; if (((from_bitField0_ & 0x00001000) == 0x00001000)) { to_bitField0_ |= 0x00001000; } - result.variationValue1_ = variationValue1_; + result.variationValue2_ = variationValue2_; if (((from_bitField0_ & 0x00002000) == 0x00002000)) { to_bitField0_ |= 0x00002000; } - result.variationValue2_ = variationValue2_; + result.variationValue3_ = variationValue3_; if (((from_bitField0_ & 0x00004000) == 0x00004000)) { to_bitField0_ |= 0x00004000; } - result.variationValue3_ = variationValue3_; + result.variationValue4_ = variationValue4_; if (((from_bitField0_ & 0x00008000) == 0x00008000)) { to_bitField0_ |= 0x00008000; } - result.variationValue4_ = variationValue4_; + result.variationValue5_ = variationValue5_; if (((from_bitField0_ & 0x00010000) == 0x00010000)) { to_bitField0_ |= 0x00010000; } - result.variationValue5_ = variationValue5_; + result.charactericId_ = charactericId_; if (((from_bitField0_ & 0x00020000) == 0x00020000)) { to_bitField0_ |= 0x00020000; } - result.charactericId_ = charactericId_; - if (((from_bitField0_ & 0x00040000) == 0x00040000)) { - to_bitField0_ |= 0x00040000; - } result.personId_ = personId_; result.bitField0_ = to_bitField0_; onBuilt(); @@ -5196,16 +5147,13 @@ public final class BatchReport { ruleKey_ = other.ruleKey_; onChanged(); } - if (other.hasSeverity()) { - setSeverity(other.getSeverity()); - } if (other.hasAlertStatus()) { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000200; alertStatus_ = other.alertStatus_; onChanged(); } if (other.hasAlertText()) { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000400; alertText_ = other.alertText_; onChanged(); } @@ -5764,47 +5712,12 @@ public final class BatchReport { return this; } - private org.sonar.batch.protocol.Constants.Severity severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; - /** - * optional .Severity severity = 11; - */ - public boolean hasSeverity() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * optional .Severity severity = 11; - */ - public org.sonar.batch.protocol.Constants.Severity getSeverity() { - return severity_; - } - /** - * optional .Severity severity = 11; - */ - public Builder setSeverity(org.sonar.batch.protocol.Constants.Severity value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000200; - severity_ = value; - onChanged(); - return this; - } - /** - * optional .Severity severity = 11; - */ - public Builder clearSeverity() { - bitField0_ = (bitField0_ & ~0x00000200); - severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; - onChanged(); - return this; - } - private java.lang.Object alertStatus_ = ""; /** * optional string alert_status = 12; */ public boolean hasAlertStatus() { - return ((bitField0_ & 0x00000400) == 0x00000400); + return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string alert_status = 12; @@ -5847,7 +5760,7 @@ public final class BatchReport { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000200; alertStatus_ = value; onChanged(); return this; @@ -5856,7 +5769,7 @@ public final class BatchReport { * optional string alert_status = 12; */ public Builder clearAlertStatus() { - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000200); alertStatus_ = getDefaultInstance().getAlertStatus(); onChanged(); return this; @@ -5869,7 +5782,7 @@ public final class BatchReport { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000200; alertStatus_ = value; onChanged(); return this; @@ -5880,7 +5793,7 @@ public final class BatchReport { * optional string alert_text = 13; */ public boolean hasAlertText() { - return ((bitField0_ & 0x00000800) == 0x00000800); + return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional string alert_text = 13; @@ -5923,7 +5836,7 @@ public final class BatchReport { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000400; alertText_ = value; onChanged(); return this; @@ -5932,7 +5845,7 @@ public final class BatchReport { * optional string alert_text = 13; */ public Builder clearAlertText() { - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00000400); alertText_ = getDefaultInstance().getAlertText(); onChanged(); return this; @@ -5945,7 +5858,7 @@ public final class BatchReport { if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000800; + bitField0_ |= 0x00000400; alertText_ = value; onChanged(); return this; @@ -5956,7 +5869,7 @@ public final class BatchReport { * optional double variation_value_1 = 14; */ public boolean hasVariationValue1() { - return ((bitField0_ & 0x00001000) == 0x00001000); + return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional double variation_value_1 = 14; @@ -5968,7 +5881,7 @@ public final class BatchReport { * optional double variation_value_1 = 14; */ public Builder setVariationValue1(double value) { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00000800; variationValue1_ = value; onChanged(); return this; @@ -5977,7 +5890,7 @@ public final class BatchReport { * optional double variation_value_1 = 14; */ public Builder clearVariationValue1() { - bitField0_ = (bitField0_ & ~0x00001000); + bitField0_ = (bitField0_ & ~0x00000800); variationValue1_ = 0D; onChanged(); return this; @@ -5988,7 +5901,7 @@ public final class BatchReport { * optional double variation_value_2 = 15; */ public boolean hasVariationValue2() { - return ((bitField0_ & 0x00002000) == 0x00002000); + return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional double variation_value_2 = 15; @@ -6000,7 +5913,7 @@ public final class BatchReport { * optional double variation_value_2 = 15; */ public Builder setVariationValue2(double value) { - bitField0_ |= 0x00002000; + bitField0_ |= 0x00001000; variationValue2_ = value; onChanged(); return this; @@ -6009,7 +5922,7 @@ public final class BatchReport { * optional double variation_value_2 = 15; */ public Builder clearVariationValue2() { - bitField0_ = (bitField0_ & ~0x00002000); + bitField0_ = (bitField0_ & ~0x00001000); variationValue2_ = 0D; onChanged(); return this; @@ -6020,7 +5933,7 @@ public final class BatchReport { * optional double variation_value_3 = 16; */ public boolean hasVariationValue3() { - return ((bitField0_ & 0x00004000) == 0x00004000); + return ((bitField0_ & 0x00002000) == 0x00002000); } /** * optional double variation_value_3 = 16; @@ -6032,7 +5945,7 @@ public final class BatchReport { * optional double variation_value_3 = 16; */ public Builder setVariationValue3(double value) { - bitField0_ |= 0x00004000; + bitField0_ |= 0x00002000; variationValue3_ = value; onChanged(); return this; @@ -6041,7 +5954,7 @@ public final class BatchReport { * optional double variation_value_3 = 16; */ public Builder clearVariationValue3() { - bitField0_ = (bitField0_ & ~0x00004000); + bitField0_ = (bitField0_ & ~0x00002000); variationValue3_ = 0D; onChanged(); return this; @@ -6052,7 +5965,7 @@ public final class BatchReport { * optional double variation_value_4 = 17; */ public boolean hasVariationValue4() { - return ((bitField0_ & 0x00008000) == 0x00008000); + return ((bitField0_ & 0x00004000) == 0x00004000); } /** * optional double variation_value_4 = 17; @@ -6064,7 +5977,7 @@ public final class BatchReport { * optional double variation_value_4 = 17; */ public Builder setVariationValue4(double value) { - bitField0_ |= 0x00008000; + bitField0_ |= 0x00004000; variationValue4_ = value; onChanged(); return this; @@ -6073,7 +5986,7 @@ public final class BatchReport { * optional double variation_value_4 = 17; */ public Builder clearVariationValue4() { - bitField0_ = (bitField0_ & ~0x00008000); + bitField0_ = (bitField0_ & ~0x00004000); variationValue4_ = 0D; onChanged(); return this; @@ -6084,7 +5997,7 @@ public final class BatchReport { * optional double variation_value_5 = 18; */ public boolean hasVariationValue5() { - return ((bitField0_ & 0x00010000) == 0x00010000); + return ((bitField0_ & 0x00008000) == 0x00008000); } /** * optional double variation_value_5 = 18; @@ -6096,7 +6009,7 @@ public final class BatchReport { * optional double variation_value_5 = 18; */ public Builder setVariationValue5(double value) { - bitField0_ |= 0x00010000; + bitField0_ |= 0x00008000; variationValue5_ = value; onChanged(); return this; @@ -6105,7 +6018,7 @@ public final class BatchReport { * optional double variation_value_5 = 18; */ public Builder clearVariationValue5() { - bitField0_ = (bitField0_ & ~0x00010000); + bitField0_ = (bitField0_ & ~0x00008000); variationValue5_ = 0D; onChanged(); return this; @@ -6116,7 +6029,7 @@ public final class BatchReport { * optional int32 characteric_id = 19; */ public boolean hasCharactericId() { - return ((bitField0_ & 0x00020000) == 0x00020000); + return ((bitField0_ & 0x00010000) == 0x00010000); } /** * optional int32 characteric_id = 19; @@ -6128,7 +6041,7 @@ public final class BatchReport { * optional int32 characteric_id = 19; */ public Builder setCharactericId(int value) { - bitField0_ |= 0x00020000; + bitField0_ |= 0x00010000; charactericId_ = value; onChanged(); return this; @@ -6137,7 +6050,7 @@ public final class BatchReport { * optional int32 characteric_id = 19; */ public Builder clearCharactericId() { - bitField0_ = (bitField0_ & ~0x00020000); + bitField0_ = (bitField0_ & ~0x00010000); charactericId_ = 0; onChanged(); return this; @@ -6148,7 +6061,7 @@ public final class BatchReport { * optional int32 person_id = 20; */ public boolean hasPersonId() { - return ((bitField0_ & 0x00040000) == 0x00040000); + return ((bitField0_ & 0x00020000) == 0x00020000); } /** * optional int32 person_id = 20; @@ -6160,7 +6073,7 @@ public final class BatchReport { * optional int32 person_id = 20; */ public Builder setPersonId(int value) { - bitField0_ |= 0x00040000; + bitField0_ |= 0x00020000; personId_ = value; onChanged(); return this; @@ -6169,7 +6082,7 @@ public final class BatchReport { * optional int32 person_id = 20; */ public Builder clearPersonId() { - bitField0_ = (bitField0_ & ~0x00040000); + bitField0_ = (bitField0_ & ~0x00020000); personId_ = 0; onChanged(); return this; @@ -22155,66 +22068,65 @@ public final class BatchReport { "pe\022\017\n\007is_test\030\005 \001(\010\022\020\n\010language\030\006 \001(\t\022\025\n" + "\tchild_ref\030\007 \003(\005B\002\020\001\022\034\n\004link\030\010 \003(\0132\016.Com", "ponentLink\022\017\n\007version\030\t \001(\t\022\013\n\003key\030\n \001(\t" + - "\022\r\n\005lines\030\013 \001(\005\022\023\n\013description\030\014 \001(\t\"\316\003\n" + + "\022\r\n\005lines\030\013 \001(\005\022\023\n\013description\030\014 \001(\t\"\261\003\n" + "\007Measure\022%\n\nvalue_type\030\001 \001(\0162\021.MeasureVa" + "lueType\022\025\n\rboolean_value\030\002 \001(\010\022\021\n\tint_va" + "lue\030\003 \001(\005\022\022\n\nlong_value\030\004 \001(\003\022\024\n\014double_" + "value\030\005 \001(\001\022\024\n\014string_value\030\006 \001(\t\022\022\n\nmet" + "ric_key\030\007 \001(\t\022\023\n\013description\030\t \001(\t\022\020\n\010ru" + - "le_key\030\n \001(\t\022\033\n\010severity\030\013 \001(\0162\t.Severit" + - "y\022\024\n\014alert_status\030\014 \001(\t\022\022\n\nalert_text\030\r " + - "\001(\t\022\031\n\021variation_value_1\030\016 \001(\001\022\031\n\021variat", - "ion_value_2\030\017 \001(\001\022\031\n\021variation_value_3\030\020" + - " \001(\001\022\031\n\021variation_value_4\030\021 \001(\001\022\031\n\021varia" + - "tion_value_5\030\022 \001(\001\022\026\n\016characteric_id\030\023 \001" + - "(\005\022\021\n\tperson_id\030\024 \001(\005\"<\n\010Measures\022\025\n\rcom" + - "ponent_ref\030\001 \001(\005\022\031\n\007measure\030\002 \003(\0132\010.Meas" + - "ure\"\231\004\n\005Issue\022\027\n\017rule_repository\030\001 \001(\t\022\020" + - "\n\010rule_key\030\002 \001(\t\022\014\n\004line\030\003 \001(\005\022\013\n\003msg\030\004 " + - "\001(\t\022\033\n\010severity\030\005 \001(\0162\t.Severity\022\013\n\003tag\030" + - "\006 \003(\t\022\025\n\reffort_to_fix\030\007 \001(\001\022\016\n\006is_new\030\010" + - " \001(\010\022\014\n\004uuid\030\t \001(\t\022\027\n\017debt_in_minutes\030\n ", - "\001(\003\022\022\n\nresolution\030\013 \001(\t\022\016\n\006status\030\014 \001(\t\022" + - "\020\n\010checksum\030\r \001(\t\022\027\n\017manual_severity\030\016 \001" + - "(\010\022\020\n\010reporter\030\017 \001(\t\022\020\n\010assignee\030\020 \001(\t\022\027" + - "\n\017action_plan_key\030\021 \001(\t\022\022\n\nattributes\030\022 " + - "\001(\t\022\024\n\014author_login\030\023 \001(\t\022\025\n\rcreation_da" + - "te\030\024 \001(\003\022\022\n\nclose_date\030\025 \001(\003\022\023\n\013update_d" + - "ate\030\026 \001(\003\022\023\n\013selected_at\030\027 \001(\003\022\023\n\013diff_f" + - "ields\030\030 \001(\t\022\022\n\nis_changed\030\031 \001(\010\022\036\n\026must_" + - "send_notification\030\032 \001(\010\"N\n\006Issues\022\025\n\rcom" + - "ponent_ref\030\001 \001(\005\022\025\n\005issue\030\002 \003(\0132\006.Issue\022", - "\026\n\016component_uuid\030\003 \001(\t\"\254\001\n\nChangesets\022\025" + - "\n\rcomponent_ref\030\001 \001(\005\022(\n\tchangeset\030\002 \003(\013" + - "2\025.Changesets.Changeset\022 \n\024changesetInde" + - "xByLine\030\003 \003(\005B\002\020\001\032;\n\tChangeset\022\020\n\010revisi" + - "on\030\001 \001(\t\022\016\n\006author\030\002 \001(\t\022\014\n\004date\030\003 \001(\003\"R" + - "\n\tDuplicate\022\026\n\016other_file_ref\030\001 \001(\005\022\025\n\005r" + - "ange\030\002 \001(\0132\006.Range\022\026\n\016other_file_key\030\003 \001" + - "(\t\"M\n\013Duplication\022\037\n\017origin_position\030\001 \001" + - "(\0132\006.Range\022\035\n\tduplicate\030\002 \003(\0132\n.Duplicat" + - "e\"H\n\014Duplications\022\025\n\rcomponent_ref\030\001 \001(\005", - "\022!\n\013duplication\030\002 \003(\0132\014.Duplication\"W\n\005R" + - "ange\022\022\n\nstart_line\030\001 \001(\005\022\020\n\010end_line\030\002 \001" + - "(\005\022\024\n\014start_offset\030\003 \001(\005\022\022\n\nend_offset\030\004" + - " \001(\005\"~\n\007Symbols\022\020\n\010file_ref\030\001 \001(\005\022\037\n\006sym" + - "bol\030\002 \003(\0132\017.Symbols.Symbol\032@\n\006Symbol\022\033\n\013" + - "declaration\030\001 \001(\0132\006.Range\022\031\n\treference\030\002" + - " \003(\0132\006.Range\"\260\001\n\010Coverage\022\014\n\004line\030\001 \001(\005\022" + - "\022\n\nconditions\030\002 \001(\005\022\017\n\007ut_hits\030\003 \001(\010\022\017\n\007" + - "it_hits\030\004 \001(\010\022\035\n\025ut_covered_conditions\030\005" + - " \001(\005\022\035\n\025it_covered_conditions\030\006 \001(\005\022\"\n\032o", - "verall_covered_conditions\030\007 \001(\005\"L\n\022Synta" + - "xHighlighting\022\025\n\005range\030\001 \001(\0132\006.Range\022\037\n\004" + - "type\030\002 \001(\0162\021.HighlightingType\"j\n\004Test\022\014\n" + - "\004name\030\001 \001(\t\022\033\n\006status\030\002 \001(\0162\013.TestStatus" + - "\022\026\n\016duration_in_ms\030\003 \001(\003\022\022\n\nstacktrace\030\004" + - " \001(\t\022\013\n\003msg\030\005 \001(\t\"\221\001\n\016CoverageDetail\022\021\n\t" + - "test_name\030\001 \001(\t\0221\n\014covered_file\030\002 \003(\0132\033." + - "CoverageDetail.CoveredFile\0329\n\013CoveredFil" + - "e\022\020\n\010file_ref\030\001 \001(\005\022\030\n\014covered_line\030\002 \003(" + - "\005B\002\020\001B#\n\037org.sonar.batch.protocol.output", - "H\001" + "le_key\030\n \001(\t\022\024\n\014alert_status\030\014 \001(\t\022\022\n\nal" + + "ert_text\030\r \001(\t\022\031\n\021variation_value_1\030\016 \001(" + + "\001\022\031\n\021variation_value_2\030\017 \001(\001\022\031\n\021variatio", + "n_value_3\030\020 \001(\001\022\031\n\021variation_value_4\030\021 \001" + + "(\001\022\031\n\021variation_value_5\030\022 \001(\001\022\026\n\016charact" + + "eric_id\030\023 \001(\005\022\021\n\tperson_id\030\024 \001(\005\"<\n\010Meas" + + "ures\022\025\n\rcomponent_ref\030\001 \001(\005\022\031\n\007measure\030\002" + + " \003(\0132\010.Measure\"\231\004\n\005Issue\022\027\n\017rule_reposit" + + "ory\030\001 \001(\t\022\020\n\010rule_key\030\002 \001(\t\022\014\n\004line\030\003 \001(" + + "\005\022\013\n\003msg\030\004 \001(\t\022\033\n\010severity\030\005 \001(\0162\t.Sever" + + "ity\022\013\n\003tag\030\006 \003(\t\022\025\n\reffort_to_fix\030\007 \001(\001\022" + + "\016\n\006is_new\030\010 \001(\010\022\014\n\004uuid\030\t \001(\t\022\027\n\017debt_in" + + "_minutes\030\n \001(\003\022\022\n\nresolution\030\013 \001(\t\022\016\n\006st", + "atus\030\014 \001(\t\022\020\n\010checksum\030\r \001(\t\022\027\n\017manual_s" + + "everity\030\016 \001(\010\022\020\n\010reporter\030\017 \001(\t\022\020\n\010assig" + + "nee\030\020 \001(\t\022\027\n\017action_plan_key\030\021 \001(\t\022\022\n\nat" + + "tributes\030\022 \001(\t\022\024\n\014author_login\030\023 \001(\t\022\025\n\r" + + "creation_date\030\024 \001(\003\022\022\n\nclose_date\030\025 \001(\003\022" + + "\023\n\013update_date\030\026 \001(\003\022\023\n\013selected_at\030\027 \001(" + + "\003\022\023\n\013diff_fields\030\030 \001(\t\022\022\n\nis_changed\030\031 \001" + + "(\010\022\036\n\026must_send_notification\030\032 \001(\010\"N\n\006Is" + + "sues\022\025\n\rcomponent_ref\030\001 \001(\005\022\025\n\005issue\030\002 \003" + + "(\0132\006.Issue\022\026\n\016component_uuid\030\003 \001(\t\"\254\001\n\nC", + "hangesets\022\025\n\rcomponent_ref\030\001 \001(\005\022(\n\tchan" + + "geset\030\002 \003(\0132\025.Changesets.Changeset\022 \n\024ch" + + "angesetIndexByLine\030\003 \003(\005B\002\020\001\032;\n\tChangese" + + "t\022\020\n\010revision\030\001 \001(\t\022\016\n\006author\030\002 \001(\t\022\014\n\004d" + + "ate\030\003 \001(\003\"R\n\tDuplicate\022\026\n\016other_file_ref" + + "\030\001 \001(\005\022\025\n\005range\030\002 \001(\0132\006.Range\022\026\n\016other_f" + + "ile_key\030\003 \001(\t\"M\n\013Duplication\022\037\n\017origin_p" + + "osition\030\001 \001(\0132\006.Range\022\035\n\tduplicate\030\002 \003(\013" + + "2\n.Duplicate\"H\n\014Duplications\022\025\n\rcomponen" + + "t_ref\030\001 \001(\005\022!\n\013duplication\030\002 \003(\0132\014.Dupli", + "cation\"W\n\005Range\022\022\n\nstart_line\030\001 \001(\005\022\020\n\010e" + + "nd_line\030\002 \001(\005\022\024\n\014start_offset\030\003 \001(\005\022\022\n\ne" + + "nd_offset\030\004 \001(\005\"~\n\007Symbols\022\020\n\010file_ref\030\001" + + " \001(\005\022\037\n\006symbol\030\002 \003(\0132\017.Symbols.Symbol\032@\n" + + "\006Symbol\022\033\n\013declaration\030\001 \001(\0132\006.Range\022\031\n\t" + + "reference\030\002 \003(\0132\006.Range\"\260\001\n\010Coverage\022\014\n\004" + + "line\030\001 \001(\005\022\022\n\nconditions\030\002 \001(\005\022\017\n\007ut_hit" + + "s\030\003 \001(\010\022\017\n\007it_hits\030\004 \001(\010\022\035\n\025ut_covered_c" + + "onditions\030\005 \001(\005\022\035\n\025it_covered_conditions" + + "\030\006 \001(\005\022\"\n\032overall_covered_conditions\030\007 \001", + "(\005\"L\n\022SyntaxHighlighting\022\025\n\005range\030\001 \001(\0132" + + "\006.Range\022\037\n\004type\030\002 \001(\0162\021.HighlightingType" + + "\"j\n\004Test\022\014\n\004name\030\001 \001(\t\022\033\n\006status\030\002 \001(\0162\013" + + ".TestStatus\022\026\n\016duration_in_ms\030\003 \001(\003\022\022\n\ns" + + "tacktrace\030\004 \001(\t\022\013\n\003msg\030\005 \001(\t\"\221\001\n\016Coverag" + + "eDetail\022\021\n\ttest_name\030\001 \001(\t\0221\n\014covered_fi" + + "le\030\002 \003(\0132\033.CoverageDetail.CoveredFile\0329\n" + + "\013CoveredFile\022\020\n\010file_ref\030\001 \001(\005\022\030\n\014covere" + + "d_line\030\002 \003(\005B\002\020\001B#\n\037org.sonar.batch.prot" + + "ocol.outputH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -22252,7 +22164,7 @@ public final class BatchReport { internal_static_Measure_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Measure_descriptor, - new java.lang.String[] { "ValueType", "BooleanValue", "IntValue", "LongValue", "DoubleValue", "StringValue", "MetricKey", "Description", "RuleKey", "Severity", "AlertStatus", "AlertText", "VariationValue1", "VariationValue2", "VariationValue3", "VariationValue4", "VariationValue5", "CharactericId", "PersonId", }); + new java.lang.String[] { "ValueType", "BooleanValue", "IntValue", "LongValue", "DoubleValue", "StringValue", "MetricKey", "Description", "RuleKey", "AlertStatus", "AlertText", "VariationValue1", "VariationValue2", "VariationValue3", "VariationValue4", "VariationValue5", "CharactericId", "PersonId", }); internal_static_Measures_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_Measures_fieldAccessorTable = new diff --git a/sonar-batch-protocol/src/main/protobuf/batch_report.proto b/sonar-batch-protocol/src/main/protobuf/batch_report.proto index 88d4c6abdc5..52d6cd732d5 100644 --- a/sonar-batch-protocol/src/main/protobuf/batch_report.proto +++ b/sonar-batch-protocol/src/main/protobuf/batch_report.proto @@ -88,7 +88,6 @@ message Measure { // temporary fields during development of computation stack optional string description = 9; optional string rule_key = 10; - optional Severity severity = 11; optional string alert_status = 12; optional string alert_text = 13; optional double variation_value_1 = 14; diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java index 07c53cad1f1..262f6780fb3 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/MeasuresPublisher.java @@ -23,26 +23,24 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; -import org.sonar.api.measures.*; +import java.io.Serializable; +import javax.annotation.Nullable; +import org.sonar.api.measures.Measure; import org.sonar.api.measures.Metric.Level; import org.sonar.api.measures.Metric.ValueType; +import org.sonar.api.measures.MetricFinder; +import org.sonar.api.measures.RuleMeasure; import org.sonar.api.resources.Resource; import org.sonar.api.resources.ResourceUtils; import org.sonar.api.rule.RuleKey; -import org.sonar.api.rules.RulePriority; import org.sonar.api.technicaldebt.batch.Characteristic; import org.sonar.batch.index.BatchComponent; import org.sonar.batch.index.BatchComponentCache; -import org.sonar.batch.protocol.Constants; import org.sonar.batch.protocol.Constants.MeasureValueType; import org.sonar.batch.protocol.output.BatchReport; import org.sonar.batch.protocol.output.BatchReportWriter; import org.sonar.batch.scan.measure.MeasureCache; -import javax.annotation.Nullable; - -import java.io.Serializable; - public class MeasuresPublisher implements ReportPublisherStep { private final BatchComponentCache resourceCache; @@ -120,10 +118,6 @@ public class MeasuresPublisher implements ReportPublisherStep { if (ruleKey != null) { builder.setRuleKey(ruleKey.toString()); } - RulePriority severity = ruleMeasure.getSeverity(); - if (severity != null) { - builder.setSeverity(Constants.Severity.valueOf(severity.toString())); - } } Level alertStatus = measure.getAlertStatus(); if (alertStatus != null) { diff --git a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureDto.java b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureDto.java index 6eaa2665bdc..8d0c2ca058a 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureDto.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/db/MeasureDto.java @@ -23,9 +23,6 @@ package org.sonar.core.measure.db; import java.nio.charset.StandardCharsets; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import org.sonar.api.rule.Severity; - -import static com.google.common.base.Preconditions.checkArgument; public class MeasureDto { private static final String INDEX_SHOULD_BE_IN_RANGE_FROM_1_TO_5 = "Index should be in range from 1 to 5"; @@ -39,7 +36,6 @@ public class MeasureDto { private String alertStatus; private String alertText; private String description; - private Integer severityIndex; private Long componentId; private Long snapshotId; @@ -239,23 +235,4 @@ public class MeasureDto { return this; } - @CheckForNull - public String getSeverity() { - if (severityIndex == null) { - return null; - } - - return Severity.ALL.get(severityIndex); - } - - public MeasureDto setSeverity(@Nullable String severity) { - if (severity == null) { - return this; - } - - checkArgument(Severity.ALL.contains(severity), "Severity must be included in the org.sonar.api.rule.Severity values"); - - this.severityIndex = Severity.ALL.indexOf(severity); - return this; - } } diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml index 9e6df38f7d4..4097f21dc31 100644 --- a/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureMapper.xml @@ -73,13 +73,13 @@ INSERT INTO project_measures ( value, metric_id, snapshot_id, rule_id, text_value, project_id, alert_status, alert_text, description, - rule_priority, characteristic_id, person_id, variation_value_1, variation_value_2, variation_value_3, variation_value_4, + characteristic_id, person_id, variation_value_1, variation_value_2, variation_value_3, variation_value_4, variation_value_5, measure_data) VALUES ( #{value, jdbcType=DOUBLE}, #{metricId, jdbcType=INTEGER}, #{snapshotId, jdbcType=INTEGER}, #{ruleId, jdbcType=INTEGER}, #{textValue, jdbcType=VARCHAR}, #{componentId, jdbcType=INTEGER}, #{alertStatus, jdbcType=VARCHAR}, #{alertText, jdbcType=VARCHAR}, - #{description, jdbcType=VARCHAR}, #{severityIndex, jdbcType=INTEGER}, #{characteristicId, jdbcType=INTEGER}, + #{description, jdbcType=VARCHAR}, #{characteristicId, jdbcType=INTEGER}, #{personId, jdbcType=INTEGER}, #{variation1, jdbcType=DOUBLE}, #{variation2, jdbcType=DOUBLE}, #{variation3, jdbcType=DOUBLE}, #{variation4, jdbcType=DOUBLE}, #{variation5, jdbcType=DOUBLE}, #{dataValue, jdbcType=BINARY} ) diff --git a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java index c3f3dd852f3..1363794cd7b 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/db/MeasureDtoTest.java @@ -73,19 +73,4 @@ public class MeasureDtoTest { public void fail_to_get_out_of_bounds_variation() { sut.getVariation(6); } - - @Test(expected = IllegalArgumentException.class) - public void fail_if_non_existent_severity() { - sut.setSeverity("MAYOR"); - } - - @Test - public void severity_values_are_retrieved() { - assertThat(sut.getSeverity()).isNull(); - - for (String severity : Severity.ALL) { - sut = new MeasureDto().setSeverity(severity); - assertThat(sut.getSeverity()).isEqualTo(severity); - } - } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java index c2924048691..4c1d8da1a22 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/MeasureModel.java @@ -20,23 +20,18 @@ package org.sonar.api.database.model; import com.google.common.base.Throwables; -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.sonar.api.database.DatabaseSession; -import org.sonar.api.measures.Metric; -import org.sonar.api.rules.RulePriority; - +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import javax.annotation.CheckForNull; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; - -import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; +import org.apache.commons.lang.builder.ReflectionToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; +import org.sonar.api.database.DatabaseSession; +import org.sonar.api.measures.Metric; /** * This class is the Hibernate model to store a measure in the DB @@ -73,10 +68,6 @@ public class MeasureModel implements Cloneable { @Column(name = "rule_id", updatable = true, nullable = true) private Integer ruleId; - @Column(name = "rule_priority", updatable = false, nullable = true) - @Enumerated(EnumType.ORDINAL) - private RulePriority rulePriority; - @Column(name = "alert_status", updatable = true, nullable = true, length = 5) private String alertStatus; @@ -235,7 +226,7 @@ public class MeasureModel implements Cloneable { * @return whether the measure is about rule */ public boolean isRuleMeasure() { - return ruleId != null || rulePriority != null; + return ruleId != null; } public Integer getMetricId() { @@ -277,20 +268,6 @@ public class MeasureModel implements Cloneable { return this; } - /** - * @return the rule priority - */ - public RulePriority getRulePriority() { - return rulePriority; - } - - /** - * Sets the rule priority - */ - public void setRulePriority(RulePriority rulePriority) { - this.rulePriority = rulePriority; - } - /** * @return the project id */ @@ -481,7 +458,6 @@ public class MeasureModel implements Cloneable { clone.setVariationValue4(getVariationValue4()); clone.setVariationValue5(getVariationValue5()); clone.setValue(getValue()); - clone.setRulePriority(getRulePriority()); clone.setRuleId(getRuleId()); clone.setSnapshotId(getSnapshotId()); clone.setUrl(getUrl()); -- 2.39.5