From: Simon Brandhof Date: Thu, 15 Mar 2012 10:00:57 +0000 (+0100) Subject: Do not use deprecated rule categories (column MEASURES.RULES_CATEGORY_ID, table RULES... X-Git-Tag: 3.0~193 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f16ec1f6717175089639d8c4348369bcb8c04b5e;p=sonarqube.git Do not use deprecated rule categories (column MEASURES.RULES_CATEGORY_ID, table RULES_CATEGORY_ID), but keep them in API for backward-compatibility --- diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml index af40b4e9924..47dd47e31a2 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml @@ -1,8 +1,5 @@ - - - diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml index c194c9d12f6..b5ce1f7afc7 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldCopyPermanentIdFromReferenceViolation-result.xml @@ -1,8 +1,5 @@ - - - diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml index 869a9459c80..5bd323e8866 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shouldSaveViolations-result.xml @@ -1,7 +1,4 @@ - - - diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml index 3fd471af8ce..4818b2d8b75 100644 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml +++ b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots-result.xml @@ -1,5 +1,4 @@ - diff --git a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml index fb0c0b5e52e..7c719cc0df3 100644 --- a/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml +++ b/plugins/sonar-dbcleaner-plugin/src/test/resources/org/sonar/plugins/dbcleaner/api/PurgeUtilsTest/purgeSnapshots.xml @@ -1,5 +1,4 @@ - diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml index 022dbcd0169..8b66612aeac 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastMeasuresLoaderTest/shared.xml @@ -6,9 +6,6 @@ enabled="true" worst_value="0" optimized_best_value="true" best_value="100" direction="1" hidden="false"/> - - - diff --git a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml index 4585e14ba0b..8cc0d86f00a 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/phases/UpdateStatusJobTest/sharedFixture.xml @@ -1,5 +1,4 @@ - diff --git a/sonar-core/src/main/resources/META-INF/persistence.xml b/sonar-core/src/main/resources/META-INF/persistence.xml index 7d2c6a63cdb..357801c27b9 100644 --- a/sonar-core/src/main/resources/META-INF/persistence.xml +++ b/sonar-core/src/main/resources/META-INF/persistence.xml @@ -25,7 +25,6 @@ org.sonar.api.security.GroupRole org.sonar.api.rules.Rule org.sonar.api.rules.RuleParam - org.sonar.api.rules.RulesCategory org.sonar.api.resources.ProjectLink org.sonar.api.profiles.RulesProfile org.sonar.api.rules.ActiveRule diff --git a/sonar-core/src/test/resources/org/sonar/core/rule/CacheRuleFinderTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/rule/CacheRuleFinderTest/shared.xml index fc4fcd733aa..4e02fa9c0b3 100644 --- a/sonar-core/src/test/resources/org/sonar/core/rule/CacheRuleFinderTest/shared.xml +++ b/sonar-core/src/test/resources/org/sonar/core/rule/CacheRuleFinderTest/shared.xml @@ -1,6 +1,4 @@ - - - - - - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter-result.xml index c7505dab4df..f5004757f82 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter-result.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter-result.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter.xml index c8822914314..ad93402fa5b 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRuleParametersFromARuleParameter.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules-result.xml index b8eeab6cd24..394b84a7374 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules-result.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules-result.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules.xml index 21ba79e615a..107805b86f2 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldDeleteActiveRules.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetActiveRules.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetActiveRules.xml index b8eeab6cd24..394b84a7374 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetActiveRules.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetActiveRules.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleParams.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleParams.xml index c398ce6e150..8bb3979e8ad 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleParams.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleParams.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleWithRuleKeyAndPluginKey.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleWithRuleKeyAndPluginKey.xml index d993d31f910..4d4c0ba987f 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleWithRuleKeyAndPluginKey.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRuleWithRuleKeyAndPluginKey.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRules.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRules.xml index 9c435f0ff62..35d4172d221 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRules.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldGetRules.xml @@ -1,7 +1,5 @@ - - rules = new ArrayList(); - - public List getRules() { - return rules; - } - - public void setRules(List rules) { - this.rules = rules; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } -} diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Property.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Property.java deleted file mode 100644 index dc7345c1cb3..00000000000 --- a/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Property.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.xml; - -import com.thoughtworks.xstream.annotations.XStreamAlias; -import com.thoughtworks.xstream.annotations.XStreamAsAttribute; - -/** - * @deprecated since 2.3 - */ -@Deprecated -@XStreamAlias("property") -public class Property { - - @XStreamAsAttribute - private String name; - - @XStreamAsAttribute - private String value; - - public Property(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } -} \ No newline at end of file diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Rule.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Rule.java deleted file mode 100644 index 88d4c93e1a7..00000000000 --- a/sonar-deprecated/src/main/java/org/sonar/api/rules/xml/Rule.java +++ /dev/null @@ -1,85 +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.xml; - -import com.thoughtworks.xstream.annotations.XStreamAlias; -import com.thoughtworks.xstream.annotations.XStreamAsAttribute; -import com.thoughtworks.xstream.annotations.XStreamImplicit; - -import java.util.ArrayList; -import java.util.List; - -/** - * @deprecated since 2.3 - */ -@Deprecated -@XStreamAlias("rule") -public class Rule implements Comparable { - - @XStreamAsAttribute - private String key; - - @XStreamAsAttribute - private String priority; - - @XStreamImplicit - private List properties; - - public Rule(String ref) { - this(ref, null); - } - - public Rule(String ref, String priority) { - this.key = ref; - this.priority = priority; - } - - public String getKey() { - return key; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - public List getProperties() { - return properties; - } - - public int compareTo(String o) { - return o.compareTo(key); - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public void addProperty(Property property) { - if (properties == null) { - properties = new ArrayList(); - } - properties.add(property); - } - -} \ No newline at end of file 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 @@ -283,22 +283,6 @@ public class MeasureModel implements Cloneable { return this; } - /** - * @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 */ 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 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 @@ -188,22 +186,6 @@ public final class Rule { return this; } - /** - * @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 */ 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)); diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb index 09ea92f6d6c..f13ed7a1af0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/timemachine_controller.rb @@ -73,7 +73,7 @@ class Api::TimemachineController < Api::ApiController @measures_by_sid={} unless @metrics.empty? - sql_conditions = ['snapshots.project_id=:rid AND snapshots.status=:status AND project_measures.rules_category_id IS NULL AND project_measures.rule_id IS NULL AND project_measures.rule_priority IS NULL AND project_measures.person_id IS NULL'] + sql_conditions = ['snapshots.project_id=:rid AND snapshots.status=:status AND project_measures.rule_id IS NULL AND project_measures.rule_priority IS NULL AND project_measures.person_id IS NULL'] sql_values = {:rid => @resource.id, :status => Snapshot::STATUS_PROCESSED} if params[:fromDateTime] diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb index c199fecb76f..d57ae80c12b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb @@ -72,7 +72,7 @@ class InitialSchema < ActiveRecord::Migration t.column :rule_id, :integer t.column :rules_category_id, :integer t.column :text_value, :string, :limit => 96, :null => true - t.column 'tendency', :integer, :null => true + t.column :tendency, :integer, :null => true t.column :measure_date, :datetime, :null => true t.column :project_id, :integer, :null => true t.column :alert_status, :string, :limit => 5, :null => true diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java index d7c72f8ad31..8533b26b7b3 100644 --- a/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java +++ b/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java @@ -106,8 +106,8 @@ public class ProfilesBackupTest extends AbstractDbUnitTestCase { RulesProfile profileNotProvided = new RulesProfile("test not provided", "lang", false, false); getSession().save(profileProvided, profileNotProvided); - Rule rule1 = new Rule("testPlugin", "testKey", "testName", null, null); - Rule rule2 = new Rule("testPlugin", "testKey2", "testName2", null, null); + Rule rule1 = new Rule("testPlugin", "testKey"); + Rule rule2 = new Rule("testPlugin", "testKey2"); getSession().save(rule1, rule2); RuleParam ruleParam1 = new RuleParam(rule1, "paramKey", "test", "int"); getSession().save(ruleParam1); diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRuleParameters.xml b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRuleParameters.xml index a94cecdc87b..c2218110bbb 100644 --- a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRuleParameters.xml +++ b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRuleParameters.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updadeRuleFields.xml b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updadeRuleFields.xml index 93f5b83f9c9..a21b0eddd82 100644 --- a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updadeRuleFields.xml +++ b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updadeRuleFields.xml @@ -1,7 +1,5 @@ - - diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updateRuleParameters.xml b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updateRuleParameters.xml index aa408462846..5afc29ed294 100644 --- a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updateRuleParameters.xml +++ b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/updateRuleParameters.xml @@ -1,7 +1,5 @@ - -