summaryrefslogtreecommitdiffstats
path: root/sonar-server/src/test
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-07 16:50:21 +0000
committerGodin <mandrikov@gmail.com>2010-12-07 16:50:21 +0000
commitf6edb3b39c3a337a4302e6d4a87d8160ecebc11d (patch)
tree173f325942de90867db18403ba279a2d4534c83a /sonar-server/src/test
parent0cd519b35d499f60fceec66f08dc7ca80301f127 (diff)
downloadsonarqube-f6edb3b39c3a337a4302e6d4a87d8160ecebc11d.tar.gz
sonarqube-f6edb3b39c3a337a4302e6d4a87d8160ecebc11d.zip
Don't use deprecated API in BackupTest
Diffstat (limited to 'sonar-server/src/test')
-rw-r--r--sonar-server/src/test/java/org/sonar/server/configuration/BackupTest.java24
1 files changed, 18 insertions, 6 deletions
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 0a9029e2334..133cfaa649f 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
@@ -30,7 +30,10 @@ import org.sonar.api.database.configuration.Property;
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.api.rules.ActiveRule;
+import org.sonar.api.rules.ActiveRuleParam;
+import org.sonar.api.rules.Rule;
+import org.sonar.api.rules.RulePriority;
import java.io.IOException;
import java.io.InputStream;
@@ -69,6 +72,7 @@ public class BackupTest {
sonarConfig.setProfiles(getProfiles());
String xml = backup.getXmlFromSonarConfig(sonarConfig);
+ System.out.println(xml);
assertXmlAreSimilar(xml, "backup-valid.xml");
}
@@ -219,13 +223,21 @@ public class BackupTest {
private List<RulesProfile> getProfiles() {
List<RulesProfile> profiles = new ArrayList<RulesProfile>();
- profiles.add(new RulesProfile("test name", "test language", true, true));
- profiles.add(new RulesProfile("test2 name", "test2 language", false, false));
- ActiveRule activeRule = new ActiveRule(null, new Rule("test plugin", "test key"), RulePriority.MAJOR);
- activeRule.getActiveRuleParams().add(new ActiveRuleParam(activeRule, new RuleParam(null, "test param key", null, null), "test value"));
+ RulesProfile profile1 = RulesProfile.create("test name", "test language");
+ profile1.setDefaultProfile(true);
+ profile1.setProvided(true);
+ profiles.add(profile1);
+
+ RulesProfile profile2 = RulesProfile.create("test2 name", "test2 language");
+ profiles.add(profile2);
+
+ Rule rule = Rule.create("test plugin", "test key", null);
+ rule.createParameter("test param key");
+
+ ActiveRule activeRule = profile1.activateRule(rule, RulePriority.MAJOR);
+ activeRule.setParameter("test param key", "test value");
- profiles.get(0).getActiveRules().add(activeRule);
profiles.get(0).getAlerts().add(new Alert(null, new Metric("test key"), Alert.OPERATOR_GREATER, "testError", "testWarn"));
return profiles;