diff options
33 files changed, 114 insertions, 96 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/ProfilesDao.java b/sonar-core/src/main/java/org/sonar/jpa/dao/ProfilesDao.java index 65944ab720b..ba1eb21cf80 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/dao/ProfilesDao.java +++ b/sonar-core/src/main/java/org/sonar/jpa/dao/ProfilesDao.java @@ -23,44 +23,22 @@ import org.sonar.api.database.DatabaseSession; import org.sonar.api.database.model.ResourceModel; import org.sonar.api.profiles.RulesProfile; -import java.util.List; - public class ProfilesDao extends BaseDao { public ProfilesDao(DatabaseSession session) { super(session); } - public List<RulesProfile> getActiveProfiles() { - return getSession().getResults(RulesProfile.class, "defaultProfile", true); - } - public RulesProfile getActiveProfile(String languageKey, String projectResourceKey) { ResourceModel projectResource = getSession().getSingleResult(ResourceModel.class, "key", projectResourceKey, "scope", ResourceModel.SCOPE_PROJECT); - if (projectResource != null && projectResource.getRulesProfile() != null) { + if (projectResource != null && projectResource.getRulesProfile() != null && projectResource.getRulesProfile().isEnabled()) { return projectResource.getRulesProfile(); } - return getSession().getSingleResult(RulesProfile.class, "defaultProfile", true, "language", languageKey); - } - - public List<RulesProfile> getProfiles(String languageKey) { - return getSession().getResults(RulesProfile.class, "language", languageKey); - } - - public List<RulesProfile> getProfiles() { - return getSession().getResults(RulesProfile.class); - } - - public List<RulesProfile> getProvidedProfiles() { - return getSession().getResults(RulesProfile.class, "provided", true); + return getSession().getSingleResult(RulesProfile.class, "defaultProfile", true, "language", languageKey, "enabled", true); } public RulesProfile getProfile(String languageKey, String profileName) { - return getSession().getSingleResult(RulesProfile.class, "language", languageKey, "name", profileName); - } - - public RulesProfile getProfileById(int profileId) { - return getSession().getEntityManager().getReference(RulesProfile.class, profileId); + return getSession().getSingleResult(RulesProfile.class, "language", languageKey, "name", profileName, "enabled", true); } } diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java index a80961ba4ce..921cbcab6d3 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java +++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java @@ -31,7 +31,7 @@ import javax.persistence.*; public class SchemaMigration { public final static int VERSION_UNKNOWN = -1; - public static final int LAST_VERSION = 170; + public static final int LAST_VERSION = 180; public final static String TABLE_NAME = "schema_migrations"; diff --git a/sonar-core/src/test/java/org/sonar/jpa/dao/ProfilesDaoTest.java b/sonar-core/src/test/java/org/sonar/jpa/dao/ProfilesDaoTest.java index 796435c5dab..0b821d51dc2 100644 --- a/sonar-core/src/test/java/org/sonar/jpa/dao/ProfilesDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/jpa/dao/ProfilesDaoTest.java @@ -25,10 +25,8 @@ import org.sonar.api.database.model.ResourceModel; import org.sonar.api.profiles.RulesProfile;
import org.sonar.jpa.test.AbstractDbUnitTestCase;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
public class ProfilesDaoTest extends AbstractDbUnitTestCase {
@@ -39,14 +37,6 @@ public class ProfilesDaoTest extends AbstractDbUnitTestCase { profilesDao = new ProfilesDao(getSession());
}
- @Test
- public void shouldGetProfiles() {
- setupData("shouldGetProfiles");
-
- List<RulesProfile> profiles = profilesDao.getProfiles("java");
-
- assertThat(profiles.size(), is(2));
- }
@Test
public void testGetActiveProfile() {
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/ProfilesDaoTest/shouldGetProfiles.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/ProfilesDaoTest/shouldGetProfiles.xml index f1e87d6dcb5..3325d8baf74 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/ProfilesDaoTest/shouldGetProfiles.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/ProfilesDaoTest/shouldGetProfiles.xml @@ -1,7 +1,7 @@ <dataset>
- <rules_profiles id="1" provided="true" name="profile one" default_profile="0" language="java"/>
- <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/>
- <rules_profiles id="3" provided="true" name="profile three" default_profile="0" language="plsql"/>
+ <rules_profiles id="1" provided="true" name="profile one" default_profile="0" language="java" enabled="true"/>
+ <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java" enabled="true"/>
+ <rules_profiles id="3" provided="true" name="profile three" default_profile="0" language="plsql" enabled="true"/>
</dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile-result.xml index cd31402ceb1..cecf13ba8e1 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile-result.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile-result.xml @@ -1,6 +1,6 @@ <dataset> - <rules_profiles id="1" parent_name="[null]" provided="true" name="profile" default_profile="1" language="java"/> + <rules_profiles id="1" parent_name="[null]" provided="true" name="profile" default_profile="1" language="java" enabled="true"/> <rules_categories id="1" name="category one" description="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile.xml index 19b124c737d..0851c7441a0 100644 --- a/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile.xml +++ b/sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile.xml @@ -1,6 +1,6 @@ <dataset> - <rules_profiles id="1" provided="true" name="profile" default_profile="1" language="java"/> + <rules_profiles id="1" provided="true" name="profile" default_profile="1" language="java" enabled="true"/> <rules_categories id="1" name="category one" description="[null]"/> 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 5f86b049240..be6be226a56 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 @@ -8,8 +8,8 @@ <rules_parameters id="1" rule_id="1" name="param1" description="[null]" param_type="r"/> <rules_parameters id="2" rule_id="1" name="param2" description="[null]" param_type="r"/> - <rules_profiles id="1" provided="true" name="profile1" default_profile="1" language="java"/> - <rules_profiles id="2" provided="true" name="profile2" default_profile="1" language="OTHER"/> + <rules_profiles id="1" provided="true" name="profile1" default_profile="1" language="java" enabled="true"/> + <rules_profiles id="2" provided="true" name="profile2" default_profile="1" language="OTHER" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2"/> <active_rules id="2" profile_id="2" rule_id="1" failure_level="2"/> 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 f2d17bc78be..f19937676d1 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 @@ -8,8 +8,8 @@ <rules_parameters id="1" rule_id="1" name="param1" description="foo" param_type="r"/> <rules_parameters id="2" rule_id="1" name="param2" description="foo" param_type="r"/> - <rules_profiles id="1" provided="true" name="profile1" default_profile="1" language="java"/> - <rules_profiles id="2" provided="true" name="profile2" default_profile="1" language="OTHER"/> + <rules_profiles id="1" provided="true" name="profile1" default_profile="1" language="java" enabled="true"/> + <rules_profiles id="2" provided="true" name="profile2" default_profile="1" language="OTHER" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2"/> <active_rules id="2" profile_id="2" rule_id="1" failure_level="2"/> 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 736de8e2412..94757dbf118 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 @@ -2,8 +2,8 @@ <rules_categories id="1" name="category one" description="[null]"/>
- <rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java"/>
- <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/>
+ <rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java" enabled="true"/>
+ <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java" enabled="true"/>
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo"
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/>
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 89f2fecf7cf..de59da7e6e7 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 @@ -2,8 +2,8 @@ <rules_categories id="1" name="category one" description="[null]"/>
- <rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java"/>
- <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/>
+ <rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java" enabled="true"/>
+ <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java" enabled="true"/>
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo"
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/>
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 736de8e2412..94757dbf118 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 @@ -2,8 +2,8 @@ <rules_categories id="1" name="category one" description="[null]"/>
- <rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java"/>
- <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java"/>
+ <rules_profiles id="1" provided="true" name="profile one" default_profile="1" language="java" enabled="true"/>
+ <rules_profiles id="2" provided="true" name="profile two" default_profile="0" language="java" enabled="true"/>
<rules id="1" name="foo" description="test" plugin_config_key="checker/foo"
plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/>
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java index 6a50730d308..fbf2d2bea04 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java @@ -29,11 +29,10 @@ import org.sonar.api.rules.ActiveRule; import org.sonar.api.rules.Rule; import org.sonar.api.rules.RulePriority; +import javax.persistence.*; import java.util.ArrayList; import java.util.List; -import javax.persistence.*; - /** * This class is badly named. It should be "QualityProfile". Indeed it does not relate only to rules but to metric thresholds too. */ @@ -70,6 +69,9 @@ public class RulesProfile implements Cloneable { @Column(name = "provided", updatable = true, nullable = false) private Boolean provided = Boolean.FALSE; + @Column(name = "enabled", updatable = true, nullable = false) + private boolean enabled = true; + @Column(name = "language", updatable = true, nullable = false) private String language; @@ -177,6 +179,15 @@ public class RulesProfile implements Cloneable { this.provided = b; } + public boolean isEnabled() { + return enabled; + } + + public RulesProfile setEnabled(boolean b) { + this.enabled = b; + return this; + } + /** * @return the profile language */ diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java index 854ef5c8594..71d57d8c148 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java @@ -32,7 +32,6 @@ import org.sonar.api.measures.Metric; import org.sonar.api.profiles.Alert; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.rules.*; -import org.sonar.jpa.dao.ProfilesDao; import org.sonar.jpa.dao.RulesDao; import java.util.*; @@ -63,7 +62,7 @@ public class ProfilesBackup implements Backupable { } public void exportXml(SonarConfig sonarConfig) { - this.profiles = this.profiles == null ? new ProfilesDao(session).getProfiles() : this.profiles; + this.profiles = (this.profiles == null ? session.getResults(RulesProfile.class) : this.profiles); // the profiles objects must be cloned to avoid issues CGLib List<RulesProfile> cloned = new ArrayList<RulesProfile>(); for (RulesProfile profile : this.profiles) { diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java index 98f1dc6ca76..96f55348b17 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java @@ -222,7 +222,8 @@ public class ProfilesManager extends BaseDao { return getSession().getResults(RulesProfile.class, "language", parent.getLanguage(), "parentName", parent.getName(), - "provided", false); + "provided", false, + "enabled", true); } private void removeActiveRule(RulesProfile profile, ActiveRule activeRule) { @@ -233,7 +234,8 @@ public class ProfilesManager extends BaseDao { RulesProfile getProfile(String language, String name) { return getSession().getSingleResult(RulesProfile.class, "language", language, - "name", name); + "name", name, + "enabled", true); } RulesProfile getParentProfile(RulesProfile profile) { diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/180_add_profiles_disabled.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/180_add_profiles_disabled.rb new file mode 100644 index 00000000000..da3087a1f6b --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/180_add_profiles_disabled.rb @@ -0,0 +1,36 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2009 SonarSource SA +# 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 +# + +# +# Sonar 2.6 +# +class AddProfilesDisabled < ActiveRecord::Migration + + def self.up + add_column 'rules_profiles', 'enabled', :boolean, :null => false, :default => true + Profile.reset_column_information + + Profile.find(:all).each do |profile| + profile.enabled=true + profile.save + end + end + +end diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml index fb024b6d419..fb33ff6a535 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml @@ -39,6 +39,7 @@ <default-profile><![CDATA[true]]></default-profile> <provided><![CDATA[true]]></provided> <language><![CDATA[test language]]></language> + <enabled><![CDATA[true]]></enabled> <active-rules> <active-rule> <key><![CDATA[test key]]></key> @@ -66,6 +67,7 @@ <default-profile><![CDATA[false]]></default-profile> <provided><![CDATA[false]]></provided> <language><![CDATA[test language]]></language> + <enabled><![CDATA[true]]></enabled> <parentName><![CDATA[test name]]></parentName> <active-rules> <active-rule> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren-result.xml index dff95033851..c6e3fb56922 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren-result.xml @@ -5,9 +5,9 @@ <rules_parameters id="1" rule_id="1" name="param1" description="[null]" param_type="r"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> <active_rule_parameters id="1" active_rule_id="1" rules_parameter_id="1" value="30"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren.xml index 4b555960447..130072bb538 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren.xml @@ -5,9 +5,9 @@ <rules_parameters id="1" rule_id="1" name="param1" description="[null]" param_type="r"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> <active_rule_parameters id="1" active_rule_id="1" rules_parameter_id="1" value="30"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent-result.xml index 1f7efb177a9..524f5db30ea 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent-result.xml @@ -6,11 +6,11 @@ <rules id="2" name="bar" description="test" plugin_config_key="checker/bar" plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="new_parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="2" provided="false" name="new_parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="3" provided="false" name="child" default_profile="0" language="java" parent_name="new_parent"/> + <rules_profiles id="3" provided="false" name="child" default_profile="0" language="java" parent_name="new_parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent.xml index ba8530b21f7..a5d444cf42e 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent.xml @@ -6,11 +6,11 @@ <rules id="2" name="bar" description="test" plugin_config_key="checker/bar" plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="new_parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="2" provided="false" name="new_parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="3" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="3" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldCheckCycles.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldCheckCycles.xml index fd3b5e3e589..38df95e0995 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldCheckCycles.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldCheckCycles.xml @@ -3,10 +3,10 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="level1" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="level1" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="level2" default_profile="0" language="java" parent_name="level1"/> + <rules_profiles id="2" provided="false" name="level2" default_profile="0" language="java" parent_name="level1" enabled="true"/> - <rules_profiles id="3" provided="false" name="level3" default_profile="0" language="java" parent_name="level2"/> + <rules_profiles id="3" provided="false" name="level3" default_profile="0" language="java" parent_name="level2" enabled="true"/> </dataset> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren-result.xml index 9a2c56efae8..18e99729416 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren-result.xml @@ -3,9 +3,9 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren.xml index 4760d12b7d9..b8489c1fbd2 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren.xml @@ -3,9 +3,9 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldNotDeleteInheritedProfile-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldNotDeleteInheritedProfile-result.xml index fd3b5e3e589..38df95e0995 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldNotDeleteInheritedProfile-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldNotDeleteInheritedProfile-result.xml @@ -3,10 +3,10 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="level1" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="level1" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="level2" default_profile="0" language="java" parent_name="level1"/> + <rules_profiles id="2" provided="false" name="level2" default_profile="0" language="java" parent_name="level1" enabled="true"/> - <rules_profiles id="3" provided="false" name="level3" default_profile="0" language="java" parent_name="level2"/> + <rules_profiles id="3" provided="false" name="level3" default_profile="0" language="java" parent_name="level2" enabled="true"/> </dataset> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent-result.xml index 1493a8e8897..540b18c3ace 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent-result.xml @@ -3,9 +3,9 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="[null]" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent.xml index 4760d12b7d9..b8489c1fbd2 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent.xml @@ -3,9 +3,9 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRenameInheritedProfile-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRenameInheritedProfile-result.xml index d42f80577cb..a7374525f59 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRenameInheritedProfile-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRenameInheritedProfile-result.xml @@ -3,10 +3,10 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="newName" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="newName" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="level2" default_profile="0" language="java" parent_name="newName"/> + <rules_profiles id="2" provided="false" name="level2" default_profile="0" language="java" parent_name="newName" enabled="true"/> - <rules_profiles id="3" provided="false" name="level3" default_profile="0" language="java" parent_name="level2"/> + <rules_profiles id="3" provided="false" name="level3" default_profile="0" language="java" parent_name="level2" enabled="true"/> </dataset> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent-result.xml index 4760d12b7d9..b8489c1fbd2 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent-result.xml @@ -3,9 +3,9 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml index 1493a8e8897..540b18c3ace 100644 --- a/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml +++ b/sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml @@ -3,9 +3,9 @@ <rules id="1" name="foo" description="test" plugin_config_key="checker/foo" plugin_rule_key="checkstyle.rule1" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/> - <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/> - <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="[null]"/> + <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="[null]" enabled="true"/> <active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inheritance="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts-result.xml b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts-result.xml index 11fa97ca970..1bf29a3a0d2 100644 --- a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts-result.xml +++ b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts-result.xml @@ -6,8 +6,8 @@ <metrics id="2" name="disabledkey2" val_type="INT" description="description" domain="domain" short_name="name2" qualitative="false" user_managed="false" enabled="false" origin="JAV" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="1" hidden="false"/> - <rules_profiles id="1" name="profile1" default_profile="true" provided="true" language="JAV"/> - <rules_profiles id="2" name="profile2" default_profile="false" provided="false" language="JAV"/> + <rules_profiles id="1" name="profile1" default_profile="true" provided="true" language="JAV" enabled="true"/> + <rules_profiles id="2" name="profile2" default_profile="false" provided="false" language="JAV" enabled="true"/> <!-- ok --> <alerts id="1" profile_id="1" metric_id="1" operator=">" value_error="30" value_warning="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts.xml b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts.xml index 0e16ee2667e..67ea704c420 100644 --- a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts.xml +++ b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts.xml @@ -7,8 +7,8 @@ short_name="name2" qualitative="false" user_managed="false" enabled="false" origin="JAV" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="1" hidden="false"/> - <rules_profiles id="1" name="profile1" default_profile="true" provided="true" language="JAV"/> - <rules_profiles id="2" name="profile2" default_profile="false" provided="false" language="JAV"/> + <rules_profiles id="1" name="profile1" default_profile="true" provided="true" language="JAV" enabled="true"/> + <rules_profiles id="2" name="profile2" default_profile="false" provided="false" language="JAV" enabled="true"/> <!-- ok --> <alerts id="1" profile_id="1" metric_id="1" operator=">" value_error="30" value_warning="[null]"/> 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 09b7c3dd728..df722428cb4 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 @@ -12,7 +12,7 @@ <rules_parameters id="3" rule_id="1" name="param3" description="[null]" param_type="[null]"/> - <rules_profiles id="1" name="profile name" language="java" default_profile="false" provided="false" /> + <rules_profiles id="1" name="profile name" language="java" default_profile="false" provided="false" enabled="true"/> <active_rules id="1" rule_id="1" profile_id="1" failure_level="4" /> <active_rule_parameters id="1" active_rule_id="1" rules_parameter_id="1" value="one" /> <active_rule_parameters id="2" active_rule_id="1" rules_parameter_id="2" value="two" /> diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRules.xml b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRules.xml index de7eea07189..ae76f8c4ba6 100644 --- a/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRules.xml +++ b/sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRules.xml @@ -8,7 +8,7 @@ <rules_parameters id="1" rule_id="1" name="deprecated-prop" description="[null]" param_type="[null]"/> - <rules_profiles id="1" name="sonar way" language="java" default_profile="false" provided="true" /> + <rules_profiles id="1" name="sonar way" language="java" default_profile="false" provided="true" enabled="true"/> <active_rules id="1" rule_id="1" profile_id="1" failure_level="4" /> <active_rules id="2" rule_id="2" profile_id="1" failure_level="0" /> |