aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-05-04 13:40:10 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-05-04 13:40:10 +0200
commit4f15edb013085ec08fe3721f0a5307d99685868a (patch)
treeece8f01c0b21c6b53cac437c05ba73bfb6fc3790
parent551d4d6f30df01393f9db316c18f06d2a1a809f6 (diff)
downloadsonarqube-4f15edb013085ec08fe3721f0a5307d99685868a.tar.gz
sonarqube-4f15edb013085ec08fe3721f0a5307d99685868a.zip
SONAR-6906 Filter rules on profile language when bulk active rules
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java2
2 files changed, 6 insertions, 2 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java
index e71c9145fed..82fc1c3ce76 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java
@@ -30,6 +30,7 @@ import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.api.server.ws.WebService.Param;
import org.sonar.api.utils.text.JsonWriter;
+import org.sonar.db.DbClient;
import org.sonar.server.qualityprofile.BulkChangeResult;
import org.sonar.server.qualityprofile.QProfileService;
import org.sonar.server.rule.RuleService;
@@ -61,12 +62,14 @@ public class BulkRuleActivationActions {
public static final String BULK_ACTIVATE_ACTION = "activate_rules";
public static final String BULK_DEACTIVATE_ACTION = "deactivate_rules";
+ private final DbClient dbClient;
private final QProfileService profileService;
private final RuleService ruleService;
private final I18n i18n;
private final UserSession userSession;
- public BulkRuleActivationActions(QProfileService profileService, RuleService ruleService, I18n i18n, UserSession userSession) {
+ public BulkRuleActivationActions(DbClient dbClient, QProfileService profileService, RuleService ruleService, I18n i18n, UserSession userSession) {
+ this.dbClient = dbClient;
this.profileService = profileService;
this.ruleService = ruleService;
this.i18n = i18n;
@@ -132,6 +135,7 @@ public class BulkRuleActivationActions {
}
private void bulkDeactivate(Request request, Response response) {
+ // TODO filter on rule language
BulkChangeResult result = profileService.bulkDeactivate(
createRuleQuery(ruleService.newRuleQuery(), request),
request.mandatoryParam(PROFILE_KEY));
diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java
index 2ae27085596..2e7597413a0 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsTest.java
@@ -61,7 +61,7 @@ public class QProfilesWsTest {
controller = new WsTester(new QProfilesWs(
new RuleActivationActions(profileService),
- new BulkRuleActivationActions(profileService, ruleService, i18n, userSessionRule),
+ new BulkRuleActivationActions(null, profileService, ruleService, i18n, userSessionRule),
new ProjectAssociationActions(null, null, null, languages, userSessionRule),
new CreateAction(null, null, null, languages, importers, userSessionRule),
new ImportersAction(importers),