aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-04-29 14:25:24 +0400
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-04-29 20:03:10 +0400
commit6ef3cc3c65f9bbbb50aecc4e144a4a6efb5829b2 (patch)
tree1fc42d3a8abbef6df04acaa48ea29789820224f6
parentc3a1ff31b2f9e02eccd78338ed101154b7c5ac78 (diff)
downloadsonarqube-6ef3cc3c65f9bbbb50aecc4e144a4a6efb5829b2.tar.gz
sonarqube-6ef3cc3c65f9bbbb50aecc4e144a4a6efb5829b2.zip
SONAR-2176 Default value for rule parameter should be updated in database if was updated in repository
-rw-r--r--sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java1
-rw-r--r--sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java8
2 files changed, 7 insertions, 2 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java
index 3ad4ae210c9..e45afad60dc 100644
--- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java
+++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java
@@ -134,6 +134,7 @@ public final class RegisterRules {
}
persistedParam.setDescription(param.getDescription());
persistedParam.setType(param.getType());
+ persistedParam.setDefaultValue(param.getDefaultValue());
}
}
}
diff --git a/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java b/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java
index f1bf19aa25d..7d09ffb6690 100644
--- a/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/startup/RegisterRulesTest.java
@@ -132,9 +132,13 @@ public class RegisterRulesTest extends AbstractDbUnitTestCase {
// new parameter
assertNotNull(rule.getParam("param2"));
+ assertThat(rule.getParam("param2").getDescription(), is("parameter two"));
+ assertThat(rule.getParam("param2").getDefaultValue(), is("default value two"));
// updated parameter
+ assertNotNull(rule.getParam("param1"));
assertThat(rule.getParam("param1").getDescription(), is("parameter one"));
+ assertThat(rule.getParam("param1").getDefaultValue(), is("default value one"));
// deleted parameter
assertNull(rule.getParam("deprecated_param"));
@@ -182,8 +186,8 @@ class FakeRepository extends RuleRepository {
rule1.setDescription("Description of One");
rule1.setSeverity(RulePriority.BLOCKER);
rule1.setConfigKey("config1");
- rule1.createParameter("param1").setDescription("parameter one");
- rule1.createParameter("param2").setDescription("parameter two");
+ rule1.createParameter("param1").setDescription("parameter one").setDefaultValue("default value one");
+ rule1.createParameter("param2").setDescription("parameter two").setDefaultValue("default value two");
Rule rule2 = Rule.create("fake", "rule2", "Two");
rule2.setSeverity(RulePriority.INFO);