aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-05-05 20:11:09 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-05-05 20:21:50 +0200
commit96a1df665992754a625953d47f1321f54bd2e57d (patch)
tree6cbef95a30c9255a360a209957e1193bc09cbd5c
parente668a7a2c56f280f15a7e6c94de75ddfe889ec77 (diff)
downloadsonarqube-96a1df665992754a625953d47f1321f54bd2e57d.tar.gz
sonarqube-96a1df665992754a625953d47f1321f54bd2e57d.zip
Fixed ActiveRuleDaoTests by giving valid rules and profiles for DAO to be able to bulid ActiveRuleKey
-rw-r--r--sonar-server/src/test/java/org/sonar/server/rule2/ActiveRuleDaoTest.java2
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/empty.xml6
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/insert_parameter.xml12
-rw-r--r--sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/shared.xml7
4 files changed, 25 insertions, 2 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/rule2/ActiveRuleDaoTest.java b/sonar-server/src/test/java/org/sonar/server/rule2/ActiveRuleDaoTest.java
index 58104db6225..0224658cf6e 100644
--- a/sonar-server/src/test/java/org/sonar/server/rule2/ActiveRuleDaoTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/rule2/ActiveRuleDaoTest.java
@@ -186,7 +186,7 @@ public class ActiveRuleDaoTest extends AbstractDaoTestCase {
@Test
public void insert_parameter() {
- setupData("empty");
+ setupData("insert_parameter");
ActiveRuleParamDto dto = new ActiveRuleParamDto()
.setActiveRuleId(1)
diff --git a/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/empty.xml b/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/empty.xml
index 871dedcb5e9..2e8f2f255af 100644
--- a/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/empty.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/empty.xml
@@ -1,3 +1,9 @@
<dataset>
+ <rules_parameters id="1" rule_id="10" name="max" param_type="INTEGER" default_value="30" description="My Parameter"/>
+ <rules id="10" plugin_rule_key="Parent1" plugin_name="checkstyle" name="Parent Rule 1" description="Parent Rule 1" status="READY"
+ plugin_config_key="Parent1" priority="2" cardinality="SINGLE" language="golo" created_at="1981-10-24 15:20:00" />
+
+ <rules_profiles id="1" name="Child" language="java" parent_name="Parent" version="1"
+ used_profile="[false]"/>
</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/insert_parameter.xml b/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/insert_parameter.xml
new file mode 100644
index 00000000000..d19f7846620
--- /dev/null
+++ b/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/insert_parameter.xml
@@ -0,0 +1,12 @@
+<dataset>
+ <rules_parameters id="1" rule_id="10" name="max" param_type="INTEGER" default_value="30" description="My Parameter"/>
+
+ <active_rules id="1" profile_id="1" rule_id="10" failure_level="2" inheritance="INHERITED"
+ note_created_at="2013-12-18" note_updated_at="2013-12-18" note_user_login="henry" note_data="some note"/>
+
+ <rules id="10" plugin_rule_key="Parent1" plugin_name="checkstyle" name="Parent Rule 1" description="Parent Rule 1" status="READY"
+ plugin_config_key="Parent1" priority="2" cardinality="SINGLE" language="golo" created_at="1981-10-24 15:20:00" />
+
+ <rules_profiles id="1" name="Child" language="java" parent_name="Parent" version="1"
+ used_profile="[false]"/>
+</dataset>
diff --git a/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/shared.xml b/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/shared.xml
index 768b91b2046..5c555d473e8 100644
--- a/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/shared.xml
+++ b/sonar-server/src/test/resources/org/sonar/server/rule2/ActiveRuleDaoTest/shared.xml
@@ -1,6 +1,11 @@
<dataset>
+ <rules id="10" plugin_rule_key="Parent1" plugin_name="checkstyle" name="Parent Rule 1" description="Parent Rule 1" status="READY"
+ plugin_config_key="Parent1" priority="2" cardinality="SINGLE" language="golo" created_at="1981-10-24 15:20:00" />
- <active_rules id="1" profile_id="1" rule_id="10" failure_level="2" inheritance="INHERITED"
+ <rules id="11" plugin_rule_key="Parent2" plugin_name="checkstyle" name="Parent Rule 2" description="Parent Rule 2" status="READY"
+ plugin_config_key="Parent1" priority="2" cardinality="SINGLE" language="golo" created_at="1981-10-24 15:20:00" />
+
+ <active_rules id="1" profile_id="1" rule_id="10" failure_level="2" inheritance="INHERITED"
note_created_at="2013-12-18" note_updated_at="2013-12-18" note_user_login="henry" note_data="some note"/>
<!-- Parent of Active rule 1 -->