aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/test
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-05-27 02:07:33 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-05-27 02:54:10 +0400
commit2dbed652688d87b303f7821ea619ed36ba654a19 (patch)
treecbf627ca9957741a70eb4dc55ca6210974986b32 /sonar-server/src/test
parent880d215a9fbafec25f7d6172b22e8dd0915a0c9a (diff)
downloadsonarqube-2dbed652688d87b303f7821ea619ed36ba654a19.tar.gz
sonarqube-2dbed652688d87b303f7821ea619ed36ba654a19.zip
SONAR-1922 Add a kind of version control for quality profiles
Apply patch, which was contributed by Julien Henry: * Following algorithm was implemented: Every profile starts with version=1 and used=false. As soon as there is an analysis of a project, the involved profile is set to used=true. Every modification to a quality profile (activation, deactivation or modification of rule) is logged in DB in dedicated tables. When a modification is done on a profile that is used=true, then version number is increased and profile is set to used=false. * Introduced new metric to store profile version, which was used during analysis. * If profile for project is different than the one used during previous analysis, then event would be created. * Introduced new tab 'changelog' for profiles. Following fixes were applied on original patch: * Index name limited to 30 characters in Oracle DB, so names were reduced. * Field ActiveRuleChange.profileVersion never read locally, because ruby read it directly from DB, so getter added. * Direction doesn't make sense for 'profile_version' metric, so was removed. * Fixed ProfileEventsSensor: it seems that TimeMachine not guarantee that the order of measures would be the same as in query, so we should perform two sequential queries. * Fixed handling of null values during migration.
Diffstat (limited to 'sonar-server/src/test')
-rw-r--r--sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java10
-rw-r--r--sonar-server/src/test/java/org/sonar/server/configuration/RuleChangeTest.java99
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren-result.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent-result.xml6
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent.xml6
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldCheckCycles.xml6
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren-result.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldNotDeleteInheritedProfile-result.xml6
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent-result.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRenameInheritedProfile-result.xml6
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent-result.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile-result.xml5
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile.xml22
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/initialData.xml21
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleActivated-result.xml5
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleDeactivated-result.xml7
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleParamChanged-result.xml7
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted-result.xml8
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted.xml19
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleSeverityChanged-result.xml5
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsed-result.xml7
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsedAndInChildren-result.xml7
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages-result.xml10
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages.xml10
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages-result.xml10
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages.xml10
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts-result.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRuleParameters.xml2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRules.xml2
35 files changed, 278 insertions, 62 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java
index 1b95129ad95..55eb7b378f9 100644
--- a/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java
@@ -71,35 +71,35 @@ public class InheritedProfilesTest extends AbstractDbUnitTestCase {
@Test
public void shouldSetParent() {
setupData("shouldSetParent");
- profilesManager.changeParentProfile(2, "parent");
+ profilesManager.changeParentProfile(2, "parent", "admin");
checkTables("shouldSetParent", "active_rules", "rules_profiles");
}
@Test
public void shouldChangeParent() {
setupData("shouldChangeParent");
- profilesManager.changeParentProfile(3, "new_parent");
+ profilesManager.changeParentProfile(3, "new_parent", "admin");
checkTables("shouldChangeParent", "active_rules", "rules_profiles");
}
@Test
public void shouldRemoveParent() {
setupData("shouldRemoveParent");
- profilesManager.changeParentProfile(2, null);
+ profilesManager.changeParentProfile(2, null, "admin");
checkTables("shouldRemoveParent", "active_rules", "rules_profiles");
}
@Test
public void shouldDeactivateInChildren() {
setupData("shouldDeactivateInChildren");
- profilesManager.deactivated(1, 1);
+ profilesManager.deactivated(1, 1, "admin");
checkTables("shouldDeactivateInChildren", "active_rules", "rules_profiles");
}
@Test
public void shouldActivateInChildren() {
setupData("shouldActivateInChildren");
- profilesManager.activatedOrChanged(1, 1);
+ profilesManager.activated(1, 1, "admin");
checkTables("shouldActivateInChildren", "active_rules", "rules_profiles", "active_rule_parameters");
}
diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/RuleChangeTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/RuleChangeTest.java
new file mode 100644
index 00000000000..d6f3bfd26e4
--- /dev/null
+++ b/sonar-server/src/test/java/org/sonar/server/configuration/RuleChangeTest.java
@@ -0,0 +1,99 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 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.server.configuration;
+
+import org.sonar.api.rules.RulePriority;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.profiles.RulesProfile;
+import org.sonar.api.utils.ValidationMessages;
+import org.sonar.jpa.test.AbstractDbUnitTestCase;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class RuleChangeTest extends AbstractDbUnitTestCase {
+ private ProfilesManager profilesManager;
+
+ @Before
+ public void setUp() {
+ profilesManager = new ProfilesManager(getSession(), null);
+ }
+
+ @Test
+ public void testVersionIncreaseIfUsed() {
+ setupData("initialData");
+ profilesManager.activated(2, 3, "admin");
+ checkTables("versionIncreaseIfUsed", "rules_profiles");
+ }
+
+ @Test
+ public void testVersionIncreaseIfUsedAndInChildren() {
+ setupData("initialData");
+ profilesManager.activated(1, 1, "admin");
+ checkTables("versionIncreaseIfUsedAndInChildren", "rules_profiles");
+ }
+
+ @Test
+ public void testRuleActivated() {
+ setupData("initialData");
+ profilesManager.activated(2, 3, "admin");
+ checkTables("ruleActivated", new String[] {"change_date"}, "active_rule_changes");
+ }
+
+ @Test
+ public void testRuleDeactivated() {
+ setupData("initialData");
+ profilesManager.deactivated(2, 3, "admin");
+ checkTables("ruleDeactivated", new String[] {"change_date"}, "active_rule_changes");
+ }
+
+ @Test
+ public void testRuleParamChanged() {
+ setupData("initialData");
+ profilesManager.ruleParamChanged(2, 3, "param1", "20", "30", "admin");
+ checkTables("ruleParamChanged", new String[] {"change_date"}, "active_rule_changes", "active_rule_param_changes");
+ }
+
+ @Test
+ public void testRuleSeverityChanged() {
+ setupData("initialData");
+ profilesManager.ruleSeverityChanged(2, 3, RulePriority.BLOCKER, RulePriority.CRITICAL, "admin");
+ checkTables("ruleSeverityChanged", new String[] {"change_date"}, "active_rule_changes");
+ }
+
+ @Test
+ public void testRuleReverted() {
+ setupData("ruleReverted");
+ profilesManager.revert(2, 3, "admin");
+ checkTables("ruleReverted", new String[] {"change_date"}, "active_rule_changes", "active_rule_param_changes");
+ }
+
+ @Test
+ public void testChangeParentProfile() {
+ setupData("changeParentProfile");
+ profilesManager.changeParentProfile(2, "parent", "admin");
+ checkTables("changeParentProfile", new String[] {"change_date"}, "active_rule_changes");
+ }
+
+
+}
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 fb33ff6a535..b5df287f5ce 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
@@ -36,8 +36,10 @@
<profiles>
<profile>
<name><![CDATA[test name]]></name>
+ <version><![CDATA[1]]></version>
<default-profile><![CDATA[true]]></default-profile>
<provided><![CDATA[true]]></provided>
+ <used><![CDATA[false]]></used>
<language><![CDATA[test language]]></language>
<enabled><![CDATA[true]]></enabled>
<active-rules>
@@ -64,10 +66,12 @@
</profile>
<profile>
<name><![CDATA[test2 name]]></name>
+ <version><![CDATA[1]]></version>
<default-profile><![CDATA[false]]></default-profile>
<provided><![CDATA[false]]></provided>
<language><![CDATA[test language]]></language>
<enabled><![CDATA[true]]></enabled>
+ <used><![CDATA[false]]></used>
<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 c6e3fb56922..f34a0b494fd 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]" enabled="true"/>
+ <rules_profiles id="1" version="2" used_profile="false" 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" enabled="true"/>
+ <rules_profiles id="2" version="2" used_profile="false" 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 130072bb538..62081abc403 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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 524f5db30ea..84ca4c97e9d 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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]" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="3" version="2" used_profile="false" 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 a5d444cf42e..b2daef7a8eb 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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]" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="3" version="1" used_profile="true" 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 38df95e0995..5200875be21 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="3" version="1" used_profile="true" 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 18e99729416..3371d019f58 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]" enabled="true"/>
+ <rules_profiles id="1" version="2" used_profile="false" 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" enabled="true"/>
+ <rules_profiles id="2" version="2" used_profile="false" 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 b8489c1fbd2..8d4e2c9072c 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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 38df95e0995..5200875be21 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="3" version="1" used_profile="true" 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 540b18c3ace..a27f357b556 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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]" enabled="true"/>
+ <rules_profiles id="2" version="2" used_profile="false" 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 b8489c1fbd2..8d4e2c9072c 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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 a7374525f59..c7a2355a55a 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="3" version="1" used_profile="true" 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 b8489c1fbd2..5d9be47123b 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" enabled="true"/>
+ <rules_profiles id="2" version="2" used_profile="false" 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 540b18c3ace..253e69aac65 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]" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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]" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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/RuleChangeTest/changeParentProfile-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile-result.xml
new file mode 100644
index 00000000000..62e8b337fec
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile-result.xml
@@ -0,0 +1,5 @@
+<dataset>
+
+ <active_rule_changes id="1" user_login="admin" profile_id="2" profile_version="2" rule_id="1" enabled="true" old_severity="[null]" new_severity="2"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile.xml
new file mode 100644
index 00000000000..7c4d381feea
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile.xml
@@ -0,0 +1,22 @@
+<dataset>
+
+ <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 id="2" name="bar" description="test2" plugin_config_key="checker/bar"
+ plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/>
+ <rules_parameters id="13" rule_id="2" name="param1" description="[null]" param_type="r"/>
+
+ <rules_profiles id="1" version="1" used_profile="true" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/>
+
+ <rules_profiles id="2" version="1" used_profile="true" 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]"/>
+
+ <active_rules id="3" profile_id="1" rule_id="2" failure_level="2" inheritance="[null]"/>
+ <active_rule_parameters id="1" active_rule_id="3" rules_parameter_id="13" value="30"/>
+
+ <active_rules id="4" profile_id="2" rule_id="2" failure_level="2" inheritance="[null]"/>
+ <active_rule_parameters id="2" active_rule_id="4" rules_parameter_id="13" value="60"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/initialData.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/initialData.xml
new file mode 100644
index 00000000000..aa0cb98276e
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/initialData.xml
@@ -0,0 +1,21 @@
+<dataset>
+
+ <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 id="2" name="bar" description="test2" plugin_config_key="checker/bar"
+ plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/>
+ <rules_parameters id="13" rule_id="2" name="param1" description="[null]" param_type="r"/>
+
+ <rules_profiles id="1" version="1" used_profile="true" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/>
+
+ <rules_profiles id="2" version="1" used_profile="true" 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_rules id="2" profile_id="2" rule_id="1" failure_level="2" inheritance="INHERITED"/>
+
+ <active_rules id="3" profile_id="2" rule_id="2" failure_level="2" inheritance="[null]"/>
+ <active_rule_parameters id="1" active_rule_id="3" rules_parameter_id="13" value="30"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleActivated-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleActivated-result.xml
new file mode 100644
index 00000000000..9af4ad48837
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleActivated-result.xml
@@ -0,0 +1,5 @@
+<dataset>
+
+ <active_rule_changes id="1" user_login="admin" profile_id="2" profile_version="2" rule_id="2" enabled="true" old_severity="[null]" new_severity="2"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleDeactivated-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleDeactivated-result.xml
new file mode 100644
index 00000000000..179a8ffd239
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleDeactivated-result.xml
@@ -0,0 +1,7 @@
+<dataset>
+
+ <active_rule_changes id="1" user_login="admin" profile_id="2" profile_version="2" rule_id="2" enabled="false" old_severity="2" new_severity="[null]"/>
+
+ <active_rule_param_changes id="1" active_rule_change_id="1" rules_parameter_id="13" old_value="30" new_value="[null]"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleParamChanged-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleParamChanged-result.xml
new file mode 100644
index 00000000000..6704d22dea1
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleParamChanged-result.xml
@@ -0,0 +1,7 @@
+<dataset>
+
+ <active_rule_changes id="1" user_login="admin" profile_id="2" profile_version="2" rule_id="2" enabled="[null]" old_severity="[null]" new_severity="[null]"/>
+
+ <active_rule_param_changes id="1" active_rule_change_id="1" rules_parameter_id="13" old_value="20" new_value="30"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted-result.xml
new file mode 100644
index 00000000000..14b1c9d3c8b
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted-result.xml
@@ -0,0 +1,8 @@
+<dataset>
+
+ <active_rule_changes id="1" user_login="admin" profile_id="2" profile_version="2" rule_id="2" enabled="[null]" old_severity="3" new_severity="2"/>
+
+ <active_rule_param_changes id="1" active_rule_change_id="1" rules_parameter_id="13" old_value="30" new_value="[null]"/>
+ <active_rule_param_changes id="2" active_rule_change_id="1" rules_parameter_id="14" old_value="100" new_value="50"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted.xml
new file mode 100644
index 00000000000..2ec87b2cd7b
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted.xml
@@ -0,0 +1,19 @@
+<dataset>
+
+ <rules id="2" name="bar" description="test2" plugin_config_key="checker/bar"
+ plugin_rule_key="checkstyle.rule2" plugin_name="plugin" enabled="true" cardinality="SINGLE" parent_id="[null]"/>
+ <rules_parameters id="13" rule_id="2" name="param1" description="[null]" param_type="r"/>
+ <rules_parameters id="14" rule_id="2" name="param2" description="[null]" param_type="r"/>
+
+ <rules_profiles id="1" version="1" used_profile="true" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/>
+
+ <rules_profiles id="2" version="1" used_profile="true" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/>
+
+ <active_rules id="2" profile_id="1" rule_id="2" failure_level="2" inheritance="[null]"/>
+ <active_rule_parameters id="3" active_rule_id="2" rules_parameter_id="14" value="50"/>
+
+ <active_rules id="3" profile_id="2" rule_id="2" failure_level="3" inheritance="OVERRIDES"/>
+ <active_rule_parameters id="1" active_rule_id="3" rules_parameter_id="13" value="30"/>
+ <active_rule_parameters id="2" active_rule_id="3" rules_parameter_id="14" value="100"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleSeverityChanged-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleSeverityChanged-result.xml
new file mode 100644
index 00000000000..cd395478a45
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleSeverityChanged-result.xml
@@ -0,0 +1,5 @@
+<dataset>
+
+ <active_rule_changes id="1" user_login="admin" profile_id="2" profile_version="2" rule_id="2" enabled="[null]" old_severity="4" new_severity="3"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsed-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsed-result.xml
new file mode 100644
index 00000000000..b5be9280b9a
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsed-result.xml
@@ -0,0 +1,7 @@
+<dataset>
+
+ <rules_profiles id="1" version="1" used_profile="true" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/>
+
+ <rules_profiles id="2" version="2" used_profile="false" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsedAndInChildren-result.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsedAndInChildren-result.xml
new file mode 100644
index 00000000000..8c3d85e7418
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsedAndInChildren-result.xml
@@ -0,0 +1,7 @@
+<dataset>
+
+ <rules_profiles id="1" version="2" used_profile="false" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]" enabled="true"/>
+
+ <rules_profiles id="2" version="2" used_profile="false" provided="false" name="child" default_profile="0" language="java" parent_name="parent" enabled="true"/>
+
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages-result.xml b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages-result.xml
index 62dce741d80..23de3e4d491 100644
--- a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages-result.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages-result.xml
@@ -1,9 +1,9 @@
<dataset>
- <rules_profiles id="1" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="2" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="3" provided="true" name="Php" default_profile="0" language="php" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="1" version="1" used_profile="true" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="2" version="1" used_profile="true" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="3" version="1" used_profile="true" provided="true" name="Php" default_profile="0" language="php" enabled="true" PARENT_NAME="[null]"/>
<!-- disabled -->
- <rules_profiles id="4" provided="true" name="Cobol 1" default_profile="1" language="cobol" enabled="false" PARENT_NAME="[null]"/>
- <rules_profiles id="5" provided="false" name="Cobol 2" default_profile="0" language="cobol" enabled="false" PARENT_NAME="[null]"/>
+ <rules_profiles id="4" version="1" used_profile="true" provided="true" name="Cobol 1" default_profile="1" language="cobol" enabled="false" PARENT_NAME="[null]"/>
+ <rules_profiles id="5" version="1" used_profile="true" provided="false" name="Cobol 2" default_profile="0" language="cobol" enabled="false" PARENT_NAME="[null]"/>
</dataset> \ No newline at end of file
diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages.xml b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages.xml
index f2c684b5735..082f8785417 100644
--- a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages.xml
@@ -1,7 +1,7 @@
<dataset>
- <rules_profiles id="1" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="2" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="3" provided="true" name="Php" default_profile="0" language="php" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="4" provided="true" name="Cobol 1" default_profile="1" language="cobol" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="5" provided="false" name="Cobol 2" default_profile="0" language="cobol" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="1" version="1" used_profile="true" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="2" version="1" used_profile="true" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="3" version="1" used_profile="true" provided="true" name="Php" default_profile="0" language="php" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="4" version="1" used_profile="true" provided="true" name="Cobol 1" default_profile="1" language="cobol" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="5" version="1" used_profile="true" provided="false" name="Cobol 2" default_profile="0" language="cobol" enabled="true" PARENT_NAME="[null]"/>
</dataset> \ No newline at end of file
diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages-result.xml b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages-result.xml
index d89acc7ae0b..505d4bc123f 100644
--- a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages-result.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages-result.xml
@@ -1,11 +1,11 @@
<dataset>
- <rules_profiles id="1" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="2" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="1" version="1" used_profile="true" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="2" version="1" used_profile="true" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
<!-- enabled -->
- <rules_profiles id="3" provided="true" name="Disabled Php 1" default_profile="0" language="php" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="4" provided="false" name="Disabled Php 2" default_profile="1" language="php" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="3" version="1" used_profile="true" provided="true" name="Disabled Php 1" default_profile="0" language="php" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="4" version="1" used_profile="true" provided="false" name="Disabled Php 2" default_profile="1" language="php" enabled="true" PARENT_NAME="[null]"/>
<!-- keep disabled -->
- <rules_profiles id="5" provided="true" name="Disabled Cobol" default_profile="1" language="cobol" enabled="false" PARENT_NAME="[null]"/>
+ <rules_profiles id="5" version="1" used_profile="true" provided="true" name="Disabled Cobol" default_profile="1" language="cobol" enabled="false" PARENT_NAME="[null]"/>
</dataset> \ No newline at end of file
diff --git a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages.xml b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages.xml
index c32281a33db..7d26e5127f0 100644
--- a/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages.xml
@@ -1,7 +1,7 @@
<dataset>
- <rules_profiles id="1" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="2" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
- <rules_profiles id="3" provided="true" name="Disabled Php 1" default_profile="0" language="php" enabled="false" PARENT_NAME="[null]"/>
- <rules_profiles id="4" provided="false" name="Disabled Php 2" default_profile="1" language="php" enabled="false" PARENT_NAME="[null]"/>
- <rules_profiles id="5" provided="true" name="Disabled Cobol" default_profile="1" language="cobol" enabled="false" PARENT_NAME="[null]"/>
+ <rules_profiles id="1" version="1" used_profile="true" provided="true" name="Java 1" default_profile="0" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="2" version="1" used_profile="true" provided="false" name="Java 2" default_profile="1" language="java" enabled="true" PARENT_NAME="[null]"/>
+ <rules_profiles id="3" version="1" used_profile="true" provided="true" name="Disabled Php 1" default_profile="0" language="php" enabled="false" PARENT_NAME="[null]"/>
+ <rules_profiles id="4" version="1" used_profile="true" provided="false" name="Disabled Php 2" default_profile="1" language="php" enabled="false" PARENT_NAME="[null]"/>
+ <rules_profiles id="5" version="1" used_profile="true" provided="true" name="Disabled Cobol" default_profile="1" language="cobol" enabled="false" PARENT_NAME="[null]"/>
</dataset> \ No newline at end of file
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 1bf29a3a0d2..a17525b594e 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" enabled="true"/>
- <rules_profiles id="2" name="profile2" default_profile="false" provided="false" language="JAV" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" name="profile1" default_profile="true" provided="true" language="JAV" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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 67ea704c420..9dc524b15d3 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" enabled="true"/>
- <rules_profiles id="2" name="profile2" default_profile="false" provided="false" language="JAV" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" name="profile1" default_profile="true" provided="true" language="JAV" enabled="true"/>
+ <rules_profiles id="2" version="1" used_profile="true" 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 df722428cb4..e85839686b3 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" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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 ae76f8c4ba6..0b3b68a9880 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" enabled="true"/>
+ <rules_profiles id="1" version="1" used_profile="true" 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" />