aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-21 00:20:07 +0000
committerGodin <mandrikov@gmail.com>2010-12-21 00:20:07 +0000
commitc20e334b230bc4cd12d0d13746b8e7828550cb80 (patch)
tree8cf0605bd0bf3eb8b5c8f633f90454e787c605e4
parentc365b36cf4b231555de68b193a765502d9d28bbb (diff)
downloadsonarqube-c20e334b230bc4cd12d0d13746b8e7828550cb80.tar.gz
sonarqube-c20e334b230bc4cd12d0d13746b8e7828550cb80.zip
SONAR-1722: Change RulesProfile.parentId to RulesProfile.parentName in order to simplify backup
SONAR-2052: Add test for backup of inherited profiles
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/RulesDaoTest/shouldAddActiveRulesToProfile-result.xml2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java20
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java33
-rw-r--r--sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb12
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/rules_profile.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/169_add_columns_for_profiles_inheritance.rb2
-rw-r--r--sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java12
-rw-r--r--sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java4
-rw-r--r--sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-restore-valid.xml9
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml9
-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/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/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/shouldSetParent-result.xml4
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml4
24 files changed, 98 insertions, 62 deletions
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 32bf7af86df..55a8577642b 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_id="[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"/>
<rules_categories id="1" name="category one" description="[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 06fe96c829c..6a50730d308 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
@@ -73,6 +73,9 @@ public class RulesProfile implements Cloneable {
@Column(name = "language", updatable = true, nullable = false)
private String language;
+ @Column(name = "parent_name", updatable = true, nullable = true)
+ private String parentName;
+
@OneToMany(mappedBy = "rulesProfile", fetch = FetchType.LAZY, cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE })
private List<ActiveRule> activeRules = new ArrayList<ActiveRule>();
@@ -82,13 +85,6 @@ public class RulesProfile implements Cloneable {
@OneToMany(mappedBy = "rulesProfile", fetch = FetchType.LAZY)
private List<ResourceModel> projects = new ArrayList<ResourceModel>();
- // @ManyToOne(fetch = FetchType.LAZY)
- // @JoinColumn(name = "parent_id", updatable = true, nullable = true)
- // private RulesProfile parentProfile;
-
- @Column(name = "parent_id", updatable = true, nullable = true)
- private Integer parentId;
-
/**
* @deprecated use the factory method create()
*/
@@ -201,8 +197,8 @@ public class RulesProfile implements Cloneable {
*
* @since 2.5
*/
- public Integer getParentId() {
- return parentId;
+ public String getParentName() {
+ return parentName;
}
/**
@@ -210,8 +206,8 @@ public class RulesProfile implements Cloneable {
*
* @since 2.5
*/
- public void setParentId(Integer parentId) {
- this.parentId = parentId;
+ public void setParentName(String parentName) {
+ this.parentName = parentName;
}
/**
@@ -332,7 +328,7 @@ public class RulesProfile implements Cloneable {
RulesProfile clone = RulesProfile.create(getName(), getLanguage());
clone.setDefaultProfile(getDefaultProfile());
clone.setProvided(getProvided());
- clone.setParentId(getParentId());
+ clone.setParentName(getParentName());
if (CollectionUtils.isNotEmpty(getActiveRules())) {
clone.setActiveRules(new ArrayList<ActiveRule>(CollectionUtils.collect(getActiveRules(), new Transformer() {
public Object transform(Object input) {
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 c5c118dc1cb..549f71742f2 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
@@ -73,11 +73,12 @@ public class ProfilesManager extends BaseDao {
// Managing inheritance of profiles
// Only one level of inheritance supported
- public void changeParentProfile(Integer profileId, Integer parentId) {
+ public void changeParentProfile(Integer profileId, String parentName) {
RulesProfile profile = getSession().getEntity(RulesProfile.class, profileId);
- if (profile != null && !profile.getProvided() && profileId != parentId) {
- RulesProfile oldParent = getProfile(profile.getParentId());
- RulesProfile newParent = getProfile(parentId);
+ // TODO check cycles
+ if (profile != null && !profile.getProvided()) {
+ RulesProfile oldParent = getParentProfile(profile);
+ RulesProfile newParent = getProfile(profile.getLanguage(), parentName);
// Deactivate all inherited rules
if (oldParent != null) {
for (ActiveRule activeRule : oldParent.getActiveRules()) {
@@ -89,8 +90,9 @@ public class ProfilesManager extends BaseDao {
for (ActiveRule activeRule : newParent.getActiveRules()) {
activateOrChange(profile, activeRule);
}
+ } else {
}
- profile.setParentId(parentId);
+ profile.setParentName(newParent == null ? null : newParent.getName());
getSession().saveWithoutFlush(profile);
getSession().commit();
}
@@ -128,7 +130,7 @@ public class ProfilesManager extends BaseDao {
RulesProfile profile = getSession().getEntity(RulesProfile.class, profileId);
ActiveRule activeRule = getSession().getEntity(ActiveRule.class, activeRuleId);
if (activeRule != null && activeRule.isInherited() && activeRule.isOverrides()) {
- ActiveRule parentActiveRule = getProfile(profile.getParentId()).getActiveRule(activeRule.getRule());
+ ActiveRule parentActiveRule = getParentProfile(profile).getActiveRule(activeRule.getRule());
removeActiveRule(profile, activeRule);
activeRule = (ActiveRule) parentActiveRule.clone();
activeRule.setRulesProfile(profile);
@@ -170,7 +172,11 @@ public class ProfilesManager extends BaseDao {
}
private List<RulesProfile> getChildren(int parentId) {
- return getSession().getResults(RulesProfile.class, "parentId", parentId, "provided", false);
+ RulesProfile parent = getProfile(parentId);
+ return getSession().getResults(RulesProfile.class,
+ "language", parent.getLanguage(),
+ "parentName", parent.getName(),
+ "provided", false);
}
private void removeActiveRule(RulesProfile profile, ActiveRule activeRule) {
@@ -182,4 +188,17 @@ public class ProfilesManager extends BaseDao {
return id == null ? null : getSession().getEntity(RulesProfile.class, id);
}
+ private RulesProfile getProfile(String language, String name) {
+ return getSession().getSingleResult(RulesProfile.class,
+ "language", language,
+ "name", name);
+ }
+
+ private RulesProfile getParentProfile(RulesProfile profile) {
+ if (profile.getParentName() == null) {
+ return null;
+ }
+ return getProfile(profile.getLanguage(), profile.getParentName());
+ }
+
}
diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
index 1808547126f..d4e89669dbd 100644
--- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
+++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
@@ -197,8 +197,8 @@ public final class JRubyFacade implements ServerComponent {
getProfilesManager().deleteProfile((int) profileId);
}
- public void changeParentProfile(int profileId, Integer parentId) {
- getProfilesManager().changeParentProfile(profileId, parentId);
+ public void changeParentProfile(int profileId, String parentName) {
+ getProfilesManager().changeParentProfile(profileId, parentName);
}
public void ruleActivatedOrChanged(int parentProfileId, int activeRuleId) {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
index 5cd988308d3..ddeb9a1fa20 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
@@ -55,8 +55,8 @@ class RulesConfigurationController < ApplicationController
@select_priority = ANY_SELECTION + RULE_PRIORITIES
@select_status = [['Any',''], ["Active", STATUS_ACTIVE], ["Inactive", STATUS_INACTIVE]]
- @child_profiles = RulesProfile.find(:all, :conditions => {:parent_id => @profile.id})
- @select_parent = [['', nil]] + RulesProfile.find(:all, :conditions => {:language => @profile.language, :parent_id => nil}).collect { |profile| [profile.name, profile.id] }.sort
+ @child_profiles = RulesProfile.find(:all, :conditions => {:language => @profile.language, :parent_name => @profile.name})
+ @select_parent = [['', nil]] + RulesProfile.find(:all).collect { |profile| [profile.name, profile.name] }.sort
@rules = Rule.search(java_facade, {
:profile => @profile, :status => @status, :priorities => @priorities,
@@ -80,16 +80,16 @@ class RulesConfigurationController < ApplicationController
#
#
- # POST /rules_configuration/change_parent?id=<profile id>&parent_id=<parent profile id>
+ # POST /rules_configuration/change_parent?id=<profile id>&parent_name=<parent profile name>
#
#
def change_parent
id = params[:id].to_i
- parent_id = params[:parent_id]
- if parent_id.blank?
+ parent_name = params[:parent_name]
+ if parent_name.blank?
java_facade.changeParentProfile(id, nil)
else
- java_facade.changeParentProfile(id, parent_id.to_i)
+ java_facade.changeParentProfile(id, parent_name)
end
redirect_to :action => 'index', :id => params[:id]
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
index e975efc473f..13b9559f964 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
@@ -20,8 +20,6 @@
class Profile < ActiveRecord::Base
set_table_name 'rules_profiles'
- belongs_to :parent_profile, :class_name => 'Profile', :foreign_key => 'parent_id'
-
has_many :alerts, :dependent => :delete_all
has_many :active_rules, :class_name => 'ActiveRule', :foreign_key => 'profile_id', :dependent => :destroy, :include => ['rule']
has_many :projects, :order => 'name asc'
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_profile.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_profile.rb
index d9471196c3c..9dd57c058fc 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_profile.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_profile.rb
@@ -21,8 +21,6 @@
# DEPRECATED - use profile.rb instead
class RulesProfile < ActiveRecord::Base
- belongs_to :parent_profile, :class_name => 'Profile', :foreign_key => 'parent_id'
-
has_many :active_rules, :class_name => 'ActiveRule', :foreign_key => 'profile_id',
:dependent => :destroy, :include => ['rule']
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb
index 9b3726d4d60..8a502bb3341 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb
@@ -71,10 +71,9 @@
<div>
<% if @child_profiles.size == 0 %>
<% if !@profile.provided? %>
- <% parent_id = @profile.parent_profile.id if @profile.parent_profile %>
<% form_tag({:action => 'change_parent'}, {:method => 'post'}) do %>
<%= hidden_field_tag "id", @id %>
- Parent profile: <%= select_tag "parent_id", options_for_select(@select_parent, parent_id), :disabled => !enable_modification %>
+ Parent profile: <%= select_tag "parent_name", options_for_select(@select_parent, @profile.parent_name), :disabled => !enable_modification %>
<%= submit_tag "Change", :id => 'submit_parent', :disabled => !enable_modification %>
<% end %>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/169_add_columns_for_profiles_inheritance.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/169_add_columns_for_profiles_inheritance.rb
index 1424404baf8..2119cbe479b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/169_add_columns_for_profiles_inheritance.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/169_add_columns_for_profiles_inheritance.rb
@@ -29,7 +29,7 @@ class AddColumnsForProfilesInheritance < ActiveRecord::Migration
ActiveRule.reset_column_information
ActiveRule.update_all(ActiveRule.sanitize_sql_for_assignment({:inherited => false, :overrides => false}))
- add_column 'rules_profiles', 'parent_id', :integer, :null => true
+ add_column 'rules_profiles', 'parent_name', :string, :limit => 40, :null => true
Profile.reset_column_information
end
diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java
index a9eac6a43a8..c9afa4d3dae 100644
--- a/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java
@@ -114,9 +114,10 @@ public class BackupTest {
}
Collection<RulesProfile> profiles = sonarConfig.getProfiles();
- assertEquals(2, profiles.size());
+ assertEquals(3, profiles.size());
- RulesProfile testProfile = profiles.iterator().next();
+ Iterator<RulesProfile> profilesIter = profiles.iterator();
+ RulesProfile testProfile = profilesIter.next();
assertEquals("test name", testProfile.getName());
assertEquals(true, testProfile.getDefaultProfile());
assertEquals("test language", testProfile.getLanguage());
@@ -142,6 +143,9 @@ public class BackupTest {
assertNotNull(testAlert.getMetric());
assertEquals("test key", testAlert.getMetric().getKey());
+ testProfile = profilesIter.next();
+ assertEquals("test2 parent", testProfile.getParentName());
+
Collection<Rule> rules = sonarConfig.getRules();
assertThat(rules.size(), is(1));
Rule rule = rules.iterator().next();
@@ -246,7 +250,11 @@ public class BackupTest {
profile1.setProvided(true);
profiles.add(profile1);
+ RulesProfile parentProfile = RulesProfile.create("test2 parent", "test2 language");
+ profiles.add(parentProfile);
+
RulesProfile profile2 = RulesProfile.create("test2 name", "test2 language");
+ profile2.setParentName(parentProfile.getName());
profiles.add(profile2);
Rule rule = Rule.create("test plugin", "test key", null);
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 cd91617045b..6d146700f2d 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
@@ -15,14 +15,14 @@ public class InheritedProfilesTest extends AbstractDbUnitTestCase {
@Test
public void shouldSetParent() {
setupData("shouldSetParent");
- profilesManager.changeParentProfile(2, 1);
+ profilesManager.changeParentProfile(2, "parent");
checkTables("shouldSetParent", "active_rules", "rules_profiles");
}
@Test
public void shouldChangeParent() {
setupData("shouldChangeParent");
- profilesManager.changeParentProfile(3, 2);
+ profilesManager.changeParentProfile(3, "new_parent");
checkTables("shouldChangeParent", "active_rules", "rules_profiles");
}
diff --git a/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java b/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java
index 3fbef0fa3c9..d129f7e524c 100644
--- a/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/configuration/ProfilesBackupTest.java
@@ -21,11 +21,11 @@ package org.sonar.server.configuration;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.jpa.test.AbstractDbUnitTestCase;
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.test.AbstractDbUnitTestCase;
import java.util.Arrays;
diff --git a/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-restore-valid.xml b/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-restore-valid.xml
index 2f3f7dfa4e2..e549391d960 100644
--- a/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-restore-valid.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-restore-valid.xml
@@ -64,6 +64,15 @@
<default-profile><![CDATA[false]]></default-profile>
<provided><![CDATA[false]]></provided>
<language><![CDATA[test2 language]]></language>
+ <parentName><![CDATA[test2 parent]]></parentName>
+ <active-rules/>
+ <alerts/>
+ </profile>
+ <profile>
+ <name><![CDATA[test2 parent]]></name>
+ <default-profile><![CDATA[false]]></default-profile>
+ <provided><![CDATA[false]]></provided>
+ <language><![CDATA[test2 language]]></language>
<active-rules/>
<alerts/>
</profile>
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 37b9a64a06b..7d0db470c77 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
@@ -62,10 +62,19 @@
</alerts>
</profile>
<profile>
+ <name><![CDATA[test2 parent]]></name>
+ <default-profile><![CDATA[false]]></default-profile>
+ <provided><![CDATA[false]]></provided>
+ <language><![CDATA[test2 language]]></language>
+ <active-rules/>
+ <alerts/>
+ </profile>
+ <profile>
<name><![CDATA[test2 name]]></name>
<default-profile><![CDATA[false]]></default-profile>
<provided><![CDATA[false]]></provided>
<language><![CDATA[test2 language]]></language>
+ <parentName><![CDATA[test2 parent]]></parentName>
<active-rules/>
<alerts/>
</profile>
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 0ac85d5be68..04db426da65 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[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 0275a315e52..0cc85206463 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[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 6dbe9f97c5f..c93d81534ff 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="new_child" default_profile="0" language="java" parent_id="[null]"/>
+ <rules_profiles id="2" provided="false" name="new_parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="3" provided="false" name="old_child" default_profile="0" language="java" parent_id="2"/>
+ <rules_profiles id="3" provided="false" name="child" default_profile="0" language="java" parent_name="new_parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[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 09be1a33357..d93a6684d19 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="new_child" default_profile="0" language="java" parent_id="[null]"/>
+ <rules_profiles id="2" provided="false" name="new_parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="3" provided="false" name="old_child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="3" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[null]"/>
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 2b7e4f1d92f..6f68f9f6338 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[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 a66038a7760..73010f07a0b 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[null]"/>
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 0c458b31a8c..7c93dac1ad3 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="[null]"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="[null]"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[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 a66038a7760..73010f07a0b 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[null]"/>
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 a66038a7760..73010f07a0b 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="1"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="parent"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[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 0c458b31a8c..7c93dac1ad3 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_id="[null]"/>
+ <rules_profiles id="1" provided="false" name="parent" default_profile="0" language="java" parent_name="[null]"/>
- <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_id="[null]"/>
+ <rules_profiles id="2" provided="false" name="child" default_profile="0" language="java" parent_name="[null]"/>
<active_rules id="1" profile_id="1" rule_id="1" failure_level="2" inherited="false" overrides="[null]"/>