diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-15 11:00:57 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-03-15 11:00:57 +0100 |
commit | f16ec1f6717175089639d8c4348369bcb8c04b5e (patch) | |
tree | 8dc8add2560e8a9c04133a52ea87d9354f640849 /sonar-plugin-api | |
parent | 0da9800cf24987bb9118af3b553c3fd34d735d82 (diff) | |
download | sonarqube-f16ec1f6717175089639d8c4348369bcb8c04b5e.tar.gz sonarqube-f16ec1f6717175089639d8c4348369bcb8c04b5e.zip |
Do not use deprecated rule categories (column MEASURES.RULES_CATEGORY_ID, table RULES_CATEGORY_ID), but keep them in API for backward-compatibility
Diffstat (limited to 'sonar-plugin-api')
7 files changed, 9 insertions, 166 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java index 00d4af08a43..b3e7aebe139 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/DatabaseProperties.java @@ -41,19 +41,11 @@ public interface DatabaseProperties { String PROP_EMBEDDED_PORT = "sonar.embeddedDatabase.port"; String PROP_HIBERNATE_DEFAULT_SCHEMA = "sonar.hibernate.default_schema"; - String PROP_EMBEDDED_DATA_DIR = "sonar.embeddedDatabase.dataDir"; String DIALECT_DERBY = "derby"; - - /** - * @deprecated not supported anymore since v.2.13. - */ - @Deprecated - String DIALECT_HSQLDB = "hsqldb"; String DIALECT_MYSQL = "mysql"; String DIALECT_POSTGRESQL = "postgresql"; String DIALECT_ORACLE = "oracle"; String DIALECT_DB2 = "db2"; - String DIALECT_MSSQL = "mssql"; }
\ No newline at end of file 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 d30464595b2..0e82d047a1d 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 @@ -284,22 +284,6 @@ public class MeasureModel implements Cloneable { } /** - * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 - */ - @Deprecated - public Integer getRulesCategoryId() { - return null; - } - - /** - * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 - */ - @Deprecated - public MeasureModel setRulesCategoryId(Integer id) { - return this; - } - - /** * @return the rule priority */ public RulePriority getRulePriority() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java index 467abf96283..22619d0cbaa 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/RuleFailureModel.java @@ -82,22 +82,6 @@ public class RuleFailureModel extends BaseIdentifiable { return StringUtils.abbreviate(StringUtils.trim(message), MESSAGE_COLUMN_SIZE); } - /** - * @deprecated since 2.7. Replace by getPriority() - */ - @Deprecated - public RulePriority getLevel() { - return priority; - } - - /** - * @deprecated since 2.7. Replace by setPriority() - */ - @Deprecated - public void setLevel(RulePriority priority) { - this.priority = priority; - } - public Integer getRuleId() { return ruleId; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java deleted file mode 100644 index 46abe96bda4..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Iso9126RulesCategories.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar 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. - * - * Sonar 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 Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.api.rules; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * @deprecated since 2.5. See http://jira.codehaus.org/browse/SONAR-2007 - */ -@Deprecated -public final class Iso9126RulesCategories { - private Iso9126RulesCategories() { - } - - public static final RulesCategory RELIABILITY = new RulesCategory("Reliability", - "The extent to which the project can be expected to perform its intended function with rescission." + - " Some examples : are loop indexes range tested? Is input data checked for range errors ? Is divide-by-zero avoided ? Is exception handling provided ?"); - public static final RulesCategory EFFICIENCY = new RulesCategory("Efficiency", - "The extent to which the project fulfills its purpose without waste of resources." + - " This means resources in the sense of memory utilisation and processor speed."); - public static final RulesCategory PORTABILITY = new RulesCategory("Portability", - "The extent to which the project can be operated easily and well on multiple computer configurations." + - " Portability can mean both between different hardware setups and between different operating systems -- such as running on both Mac OS X and GNU/Linux."); - public static final RulesCategory USABILITY = new RulesCategory("Usability", - "The extent to which the project can be understood, learned, operated, attractive and compliant with usability regulations and guidelines." + - " It commonly relies on naming conventions and formatting rules."); - public static final RulesCategory MAINTAINABILITY = new RulesCategory("Maintainability", - "The extent to which the project facilitates updating to satisfy new requirements. Thus the the project which is maintainable should be not complex."); - - public static final List<RulesCategory> ALL = Collections.unmodifiableList(Arrays.asList(RELIABILITY, EFFICIENCY, PORTABILITY, USABILITY, MAINTAINABILITY)); -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java index 7c3b48bfc3b..efcc8dd3bfd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java @@ -36,8 +36,6 @@ import java.util.List; @Table(name = "rules") public final class Rule { - private static final RulesCategory NONE = new RulesCategory("none"); - @Id @Column(name = "id") @GeneratedValue @@ -189,22 +187,6 @@ public final class Rule { } /** - * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 - */ - @Deprecated - public RulesCategory getRulesCategory() { - return NONE; - } - - /** - * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 - */ - @Deprecated - public Rule setRulesCategory(RulesCategory rulesCategory) { - return this; - } - - /** * @deprecated since 2.5 use {@link #getRepositoryKey()} instead */ @Deprecated diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesCategory.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesCategory.java index 31e237ead7e..3e5c1acdd5f 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesCategory.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/RulesCategory.java @@ -26,7 +26,6 @@ import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Immutable; import org.sonar.api.database.BaseIdentifiable; -import org.sonar.check.IsoCategory; import javax.persistence.Column; import javax.persistence.Entity; @@ -36,16 +35,9 @@ import javax.persistence.Table; * @deprecated since 2.5 See http://jira.codehaus.org/browse/SONAR-2007 */ @Deprecated -@Immutable -@Cache(usage = CacheConcurrencyStrategy.READ_ONLY) -@Entity -@Table(name = "rules_categories") public class RulesCategory extends BaseIdentifiable { - @Column(name = "name", updatable = false, nullable = false) private String name; - - @Column(name = "description", updatable = false, nullable = true) private String description; /** @@ -116,60 +108,22 @@ public class RulesCategory extends BaseIdentifiable { } RulesCategory other = (RulesCategory) obj; return new EqualsBuilder() - .append(name, other.getName()).isEquals(); + .append(name, other.getName()).isEquals(); } @Override public int hashCode() { return new HashCodeBuilder(17, 37) - .append(name) - .toHashCode(); + .append(name) + .toHashCode(); } @Override public String toString() { return new ToStringBuilder(this) - .append("id", getId()) - .append("name", name) - .append("desc", description) - .toString(); - } - - public IsoCategory toIsoCategory() { - if (name.equals(Iso9126RulesCategories.EFFICIENCY.getName())) { - return IsoCategory.Efficiency; - } - if (name.equals(Iso9126RulesCategories.MAINTAINABILITY.getName())) { - return IsoCategory.Maintainability; - } - if (name.equals(Iso9126RulesCategories.PORTABILITY.getName())) { - return IsoCategory.Portability; - } - if (name.equals(Iso9126RulesCategories.RELIABILITY.getName())) { - return IsoCategory.Reliability; - } - if (name.equals(Iso9126RulesCategories.USABILITY.getName())) { - return IsoCategory.Usability; - } - return null; - } - - public static RulesCategory fromIsoCategory(IsoCategory iso) { - if (iso == IsoCategory.Efficiency) { - return Iso9126RulesCategories.EFFICIENCY; - } - if (iso == IsoCategory.Maintainability) { - return Iso9126RulesCategories.MAINTAINABILITY; - } - if (iso == IsoCategory.Portability) { - return Iso9126RulesCategories.PORTABILITY; - } - if (iso == IsoCategory.Reliability) { - return Iso9126RulesCategories.RELIABILITY; - } - if (iso == IsoCategory.Usability) { - return Iso9126RulesCategories.USABILITY; - } - return null; + .append("id", getId()) + .append("name", name) + .append("desc", description) + .toString(); } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java index aebea90a313..3cc984f6bb2 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/rules/RuleTest.java @@ -55,7 +55,7 @@ public class RuleTest { public void shouldRemoveNewLineCharactersInNameWithfirstConstructor() { Rule rule; for (String example : getExamplesContainingNewLineCharacter()) { - rule = new Rule(null, null, example, (RulesCategory) null, null); + rule = new Rule(null, null).setName(example); assertThat(rule.getName(), is("test")); } } @@ -64,7 +64,7 @@ public class RuleTest { public void shouldRemoveNewLineCharactersInNameWithSecondConstructor() { Rule rule; for (String example : getExamplesContainingNewLineCharacter()) { - rule = new Rule(null, null, example, null, null); + rule = new Rule(null, null).setName(example); assertThat(rule.getName(), is("test")); } } @@ -77,9 +77,6 @@ public class RuleTest { rule = new Rule("name", "key"); assertThat(rule.getSeverity(), Is.is(RulePriority.MAJOR)); - rule = new Rule("pkey", "key", "name", Iso9126RulesCategories.EFFICIENCY, null, null); - assertThat(rule.getSeverity(), Is.is(RulePriority.MAJOR)); - rule.setSeverity(RulePriority.BLOCKER); assertThat(rule.getSeverity(), Is.is(RulePriority.BLOCKER)); |