]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10313 remove dead interface ActiveRule
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 31 Jan 2018 15:56:28 +0000 (16:56 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 8 Feb 2018 12:41:00 +0000 (13:41 +0100)
it was only used to "host" enum Inheritance which is now at upper level and renamed to ActiveRuleInheritance

13 files changed:
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRule.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleChange.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleInheritance.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleDoc.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleIndexer.java
server/sonar-server/src/main/java/org/sonar/server/rule/ws/ActiveRuleCompleter.java
server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileRuleImplTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileTreeImplTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ChangelogActionTest.java
server/sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexTest.java

diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRule.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRule.java
deleted file mode 100644 (file)
index c3f26fc..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.qualityprofile;
-
-import org.sonar.db.qualityprofile.ActiveRuleKey;
-
-public interface ActiveRule {
-
-  enum Inheritance {
-    NONE, OVERRIDES, INHERITED
-  }
-
-  long createdAt();
-
-  long updatedAt();
-
-  ActiveRuleKey key();
-
-  String severity();
-
-  Inheritance inheritance();
-
-}
index 608c6a3da6806da067d9da150f1aa0998bdda8cb..b1b55fff3c31a2845ae2c809c26ef5a41476a6fa 100644 (file)
@@ -42,7 +42,7 @@ public class ActiveRuleChange {
   private final ActiveRuleKey key;
   private final int ruleId;
   private String severity = null;
-  private ActiveRule.Inheritance inheritance = null;
+  private ActiveRuleInheritance inheritance = null;
   private final Map<String, String> parameters = new HashMap<>();
 
   public ActiveRuleChange(Type type, ActiveRuleDto activeRule, RuleDefinitionDto ruleDefinition) {
@@ -80,13 +80,13 @@ public class ActiveRuleChange {
     return this;
   }
 
-  public ActiveRuleChange setInheritance(@Nullable ActiveRule.Inheritance i) {
+  public ActiveRuleChange setInheritance(@Nullable ActiveRuleInheritance i) {
     this.inheritance = i;
     return this;
   }
 
   @CheckForNull
-  public ActiveRule.Inheritance getInheritance() {
+  public ActiveRuleInheritance getInheritance() {
     return inheritance;
   }
 
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleInheritance.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleInheritance.java
new file mode 100644 (file)
index 0000000..2aaebbe
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.server.qualityprofile;
+
+public enum ActiveRuleInheritance {
+  NONE, OVERRIDES, INHERITED
+}
index 714890f71fc24d94558097e10750d0565da8757f..7828753d7d4c8fcabb1400662ee4d780acab3423 100644 (file)
@@ -35,7 +35,7 @@ import org.sonar.db.DbSession;
 import org.sonar.db.qualityprofile.RulesProfileDto;
 
 import static java.lang.String.format;
-import static org.sonar.server.qualityprofile.ActiveRule.Inheritance.NONE;
+import static org.sonar.server.qualityprofile.ActiveRuleInheritance.NONE;
 
 /**
  * Synchronize Quality profiles during server startup
index 0088bbe34743830673edce3fb04d5b72b20c18f2..1db7b05161c2aa73b6904631ecff6d5ada2be95b 100644 (file)
@@ -96,7 +96,7 @@ public class RuleActivator {
       change = new ActiveRuleChange(ActiveRuleChange.Type.ACTIVATED, activeRuleKey, rule);
       applySeverityAndParamToChange(activation, context, change);
       if (context.isCascading() || isSameAsParent(change, context)) {
-        change.setInheritance(ActiveRule.Inheritance.INHERITED);
+        change.setInheritance(ActiveRuleInheritance.INHERITED);
       }
     } else {
       // already activated
@@ -107,7 +107,7 @@ public class RuleActivator {
       change = new ActiveRuleChange(ActiveRuleChange.Type.UPDATED, activeRuleKey, rule);
       if (context.isCascading() && activeRule.get().getInheritance() == null) {
         // activate on child, then on parent -> mark child as overriding parent
-        change.setInheritance(ActiveRule.Inheritance.OVERRIDES);
+        change.setInheritance(ActiveRuleInheritance.OVERRIDES);
         change.setSeverity(activeRule.get().getSeverityString());
         for (ActiveRuleParamDto activeParam : activeRule.getParams()) {
           change.setParameter(activeParam.getKey(), activeParam.getValue());
@@ -117,7 +117,7 @@ public class RuleActivator {
         applySeverityAndParamToChange(activation, context, change);
         if (!context.isCascading() && context.getParentActiveRule() != null) {
           // override rule which is already declared on parents
-          change.setInheritance(isSameAsParent(change, context) ? ActiveRule.Inheritance.INHERITED : ActiveRule.Inheritance.OVERRIDES);
+          change.setInheritance(isSameAsParent(change, context) ? ActiveRuleInheritance.INHERITED : ActiveRuleInheritance.OVERRIDES);
         }
       }
       if (isSame(change, activeRule)) {
@@ -263,7 +263,7 @@ public class RuleActivator {
     if (severity != null) {
       activeRule.setSeverity(severity);
     }
-    ActiveRule.Inheritance inheritance = change.getInheritance();
+    ActiveRuleInheritance inheritance = change.getInheritance();
     if (inheritance != null) {
       activeRule.setInheritance(inheritance.name());
     }
@@ -290,7 +290,7 @@ public class RuleActivator {
     if (severity != null) {
       activeRule.get().setSeverity(severity);
     }
-    ActiveRule.Inheritance inheritance = change.getInheritance();
+    ActiveRuleInheritance inheritance = change.getInheritance();
     if (inheritance != null) {
       activeRule.get().setInheritance(inheritance.name());
     }
@@ -427,7 +427,7 @@ public class RuleActivator {
   }
 
   private static boolean isSame(ActiveRuleChange change, ActiveRuleWrapper activeRule) {
-    ActiveRule.Inheritance inheritance = change.getInheritance();
+    ActiveRuleInheritance inheritance = change.getInheritance();
     if (inheritance != null && !inheritance.name().equals(activeRule.get().getInheritance())) {
       return false;
     }
index 0d1d03f7f151d7d90e934a9d66e037cde2a241b9..f8c2fdbb7c1c632cb78587f4402ee7cd1c612c50 100644 (file)
@@ -23,7 +23,7 @@ import com.google.common.collect.Maps;
 import java.util.Map;
 import javax.annotation.Nullable;
 import org.sonar.server.es.BaseDoc;
-import org.sonar.server.qualityprofile.ActiveRule;
+import org.sonar.server.qualityprofile.ActiveRuleInheritance;
 
 import static org.apache.commons.lang.StringUtils.containsIgnoreCase;
 import static org.sonar.server.rule.index.RuleIndexDefinition.FIELD_ACTIVE_RULE_ID;
@@ -85,15 +85,15 @@ public class ActiveRuleDoc extends BaseDoc {
     return this;
   }
 
-  ActiveRule.Inheritance getInheritance() {
+  ActiveRuleInheritance getInheritance() {
     String inheritance = getNullableField(FIELD_ACTIVE_RULE_INHERITANCE);
     if (inheritance == null || inheritance.isEmpty() ||
       containsIgnoreCase(inheritance, "none")) {
-      return ActiveRule.Inheritance.NONE;
+      return ActiveRuleInheritance.NONE;
     } else if (containsIgnoreCase(inheritance, "herit")) {
-      return ActiveRule.Inheritance.INHERITED;
+      return ActiveRuleInheritance.INHERITED;
     } else if (containsIgnoreCase(inheritance, "over")) {
-      return ActiveRule.Inheritance.OVERRIDES;
+      return ActiveRuleInheritance.OVERRIDES;
     } else {
       throw new IllegalStateException("Value \"" + inheritance + "\" is not valid for rule's inheritance");
     }
index a24afa09b560c812eefbef7cd476449965fc8f02..3a6d468a6bdaa0388e810d20dc9a1da901bb6cc2 100644 (file)
@@ -46,8 +46,8 @@ import org.sonar.server.es.IndexingListener;
 import org.sonar.server.es.IndexingResult;
 import org.sonar.server.es.OneToOneResilientIndexingListener;
 import org.sonar.server.es.ResilientIndexer;
-import org.sonar.server.qualityprofile.ActiveRule;
 import org.sonar.server.qualityprofile.ActiveRuleChange;
+import org.sonar.server.qualityprofile.ActiveRuleInheritance;
 import org.sonar.server.rule.index.RuleIndexDefinition;
 
 import static org.elasticsearch.index.query.QueryBuilders.termQuery;
@@ -212,7 +212,7 @@ public class ActiveRuleIndexer implements ResilientIndexer {
       .setSeverity(SeverityUtil.getSeverityFromOrdinal(dto.getSeverity()));
     // all the fields must be present, even if value is null
     String inheritance = dto.getInheritance();
-    doc.setInheritance(inheritance == null ? ActiveRule.Inheritance.NONE.name() : inheritance);
+    doc.setInheritance(inheritance == null ? ActiveRuleInheritance.NONE.name() : inheritance);
     return new IndexRequest(INDEX_TYPE_ACTIVE_RULE.getIndex(), INDEX_TYPE_ACTIVE_RULE.getType())
       .id(doc.getId())
       .parent(doc.getParent())
index 94e920d152d300fd8e490af5d7aafdd558357e8e..84a0f04295d150e952866aec6170195bd625c2ba 100644 (file)
@@ -49,7 +49,7 @@ import org.sonar.db.qualityprofile.OrgActiveRuleDto;
 import org.sonar.db.qualityprofile.QProfileDto;
 import org.sonar.db.rule.RuleDefinitionDto;
 import org.sonar.db.rule.RuleDto;
-import org.sonar.server.qualityprofile.ActiveRule;
+import org.sonar.server.qualityprofile.ActiveRuleInheritance;
 import org.sonar.server.rule.index.RuleQuery;
 import org.sonarqube.ws.Rules;
 import org.sonarqube.ws.Rules.SearchResponse;
@@ -164,7 +164,7 @@ public class ActiveRuleCompleter {
     Rules.Active.Builder builder = Rules.Active.newBuilder();
     builder.setQProfile(activeRule.getProfileUuid());
     String inheritance = activeRule.getInheritance();
-    builder.setInherit(inheritance != null ? inheritance : ActiveRule.Inheritance.NONE.name());
+    builder.setInherit(inheritance != null ? inheritance : ActiveRuleInheritance.NONE.name());
     builder.setSeverity(activeRule.getSeverityString());
     builder.setCreatedAt(DateUtils.formatDateTime(activeRule.getCreatedAt()));
     Rules.Active.Param.Builder paramBuilder = Rules.Active.Param.newBuilder();
index f4ce932c2fdbf4de8cbd707f3aad4c3013aad50c..856ecf743626b736d1e6791c6acdc71ef02ca113 100644 (file)
@@ -52,7 +52,7 @@ import org.sonar.db.rule.RuleParamDto;
 import org.sonar.server.es.Facets;
 import org.sonar.server.es.SearchIdResult;
 import org.sonar.server.es.SearchOptions;
-import org.sonar.server.qualityprofile.ActiveRule;
+import org.sonar.server.qualityprofile.ActiveRuleInheritance;
 import org.sonar.server.rule.index.RuleIndex;
 import org.sonar.server.rule.index.RuleIndexDefinition;
 import org.sonar.server.rule.index.RuleQuery;
@@ -275,11 +275,11 @@ public class SearchAction implements RulesWsAction {
       .createParam(PARAM_INHERITANCE)
       .setDescription("Comma-separated list of values of inheritance for a rule within a quality profile. Used only if the parameter '" +
         PARAM_ACTIVATION + "' is set.")
-      .setPossibleValues(ActiveRule.Inheritance.NONE.name(),
-        ActiveRule.Inheritance.INHERITED.name(),
-        ActiveRule.Inheritance.OVERRIDES.name())
-      .setExampleValue(ActiveRule.Inheritance.INHERITED.name() + "," +
-        ActiveRule.Inheritance.OVERRIDES.name());
+      .setPossibleValues(ActiveRuleInheritance.NONE.name(),
+        ActiveRuleInheritance.INHERITED.name(),
+        ActiveRuleInheritance.OVERRIDES.name())
+      .setExampleValue(ActiveRuleInheritance.INHERITED.name() + "," +
+        ActiveRuleInheritance.OVERRIDES.name());
 
     action
       .createParam(PARAM_ACTIVE_SEVERITIES)
index 2e2e742fef83807f76b5d760312e12503a924bd7..d858d86a4e1dc7c27308c6b41f4d3b4ceb77253f 100644 (file)
@@ -68,7 +68,7 @@ import static org.sonar.api.rule.Severity.CRITICAL;
 import static org.sonar.api.rule.Severity.MAJOR;
 import static org.sonar.api.rule.Severity.MINOR;
 import static org.sonar.db.rule.RuleTesting.newCustomRule;
-import static org.sonar.server.qualityprofile.ActiveRule.Inheritance.INHERITED;
+import static org.sonar.server.qualityprofile.ActiveRuleInheritance.INHERITED;
 
 public class QProfileRuleImplTest {
 
@@ -490,7 +490,7 @@ public class QProfileRuleImplTest {
 
     assertThatProfileHasNoActiveRules(parentProfile);
     assertThatRuleIsUpdated(childProfile, rule, MAJOR, null, of(param.getName(), "foo"));
-    assertThatRuleIsUpdated(grandChildProfile, rule, CRITICAL, ActiveRule.Inheritance.OVERRIDES, of(param.getName(), "bar"));
+    assertThatRuleIsUpdated(grandChildProfile, rule, CRITICAL, ActiveRuleInheritance.OVERRIDES, of(param.getName(), "bar"));
     assertThat(changes).hasSize(1);
   }
 
@@ -514,7 +514,7 @@ public class QProfileRuleImplTest {
 
     assertThatProfileHasNoActiveRules(parentProfile);
     assertThatRuleIsUpdated(childProfile, rule, BLOCKER, null, of(param.getName(), "baz"));
-    assertThatRuleIsUpdated(grandChildProfile, rule, CRITICAL, ActiveRule.Inheritance.OVERRIDES, of(param.getName(), "bar"));
+    assertThatRuleIsUpdated(grandChildProfile, rule, CRITICAL, ActiveRuleInheritance.OVERRIDES, of(param.getName(), "bar"));
     assertThat(changes).hasSize(1);
   }
 
@@ -538,7 +538,7 @@ public class QProfileRuleImplTest {
 
     assertThatRuleIsUpdated(parentProfile, rule, rule.getSeverityString(), null, of(param.getName(), param.getDefaultValue()));
     assertThatRuleIsUpdated(childProfile, rule, rule.getSeverityString(), INHERITED, of(param.getName(), param.getDefaultValue()));
-    assertThatRuleIsUpdated(grandChildProfile, rule, CRITICAL, ActiveRule.Inheritance.OVERRIDES, of(param.getName(), "bar"));
+    assertThatRuleIsUpdated(grandChildProfile, rule, CRITICAL, ActiveRuleInheritance.OVERRIDES, of(param.getName(), "bar"));
     assertThat(changes).hasSize(2);
   }
 
@@ -556,7 +556,7 @@ public class QProfileRuleImplTest {
     List<ActiveRuleChange> changes = activate(parentProfile, parentActivation);
 
     assertThatRuleIsUpdated(parentProfile, rule, CRITICAL, null, of(param.getName(), "bar"));
-    assertThatRuleIsUpdated(childProfile, rule, MAJOR, ActiveRule.Inheritance.OVERRIDES, of(param.getName(), "foo"));
+    assertThatRuleIsUpdated(childProfile, rule, MAJOR, ActiveRuleInheritance.OVERRIDES, of(param.getName(), "foo"));
     assertThat(changes).hasSize(2);
   }
 
@@ -644,7 +644,7 @@ public class QProfileRuleImplTest {
 
     RuleActivation childActivation = RuleActivation.create(rule.getId(), BLOCKER, null);
     changes = activate(childProfile, childActivation);
-    assertThatRuleIsUpdated(childProfile, rule, BLOCKER, ActiveRule.Inheritance.OVERRIDES, emptyMap());
+    assertThatRuleIsUpdated(childProfile, rule, BLOCKER, ActiveRuleInheritance.OVERRIDES, emptyMap());
     assertThat(changes).hasSize(1);
 
     RuleActivation resetActivation = RuleActivation.createReset(rule.getId());
@@ -670,7 +670,7 @@ public class QProfileRuleImplTest {
 
     RuleActivation childActivation = RuleActivation.create(rule.getId(), BLOCKER, null);
     changes = activate(childProfile, childActivation);
-    assertThatRuleIsUpdated(childProfile, rule, BLOCKER, ActiveRule.Inheritance.OVERRIDES, emptyMap());
+    assertThatRuleIsUpdated(childProfile, rule, BLOCKER, ActiveRuleInheritance.OVERRIDES, emptyMap());
     assertThatRuleIsUpdated(grandChildProfile, rule, BLOCKER, INHERITED, emptyMap());
     assertThat(changes).hasSize(2);
 
@@ -678,7 +678,7 @@ public class QProfileRuleImplTest {
     RuleActivation resetActivation = RuleActivation.createReset(rule.getId());
     changes = activate(baseProfile, resetActivation);
     assertThatRuleIsUpdated(baseProfile, rule, rule.getSeverityString(), null, emptyMap());
-    assertThatRuleIsUpdated(childProfile, rule, BLOCKER, ActiveRule.Inheritance.OVERRIDES, emptyMap());
+    assertThatRuleIsUpdated(childProfile, rule, BLOCKER, ActiveRuleInheritance.OVERRIDES, emptyMap());
     assertThatRuleIsUpdated(grandChildProfile, rule, BLOCKER, INHERITED, emptyMap());
     assertThat(changes).hasSize(1);
 
@@ -894,7 +894,7 @@ public class QProfileRuleImplTest {
   }
 
   private void assertThatRuleIsActivated(QProfileDto profile, RuleDefinitionDto rule, @Nullable List<ActiveRuleChange> changes,
-    String expectedSeverity, @Nullable ActiveRule.Inheritance expectedInheritance, Map<String, String> expectedParams) {
+                                         String expectedSeverity, @Nullable ActiveRuleInheritance expectedInheritance, Map<String, String> expectedParams) {
     OrgActiveRuleDto activeRule = db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)
       .stream()
       .filter(ar -> ar.getRuleKey().equals(rule.getKey()))
@@ -929,7 +929,7 @@ public class QProfileRuleImplTest {
   }
 
   private void assertThatRuleIsUpdated(QProfileDto profile, RuleDefinitionDto rule,
-    String expectedSeverity, @Nullable ActiveRule.Inheritance expectedInheritance, Map<String, String> expectedParams) {
+                                       String expectedSeverity, @Nullable ActiveRuleInheritance expectedInheritance, Map<String, String> expectedParams) {
     OrgActiveRuleDto activeRule = db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)
       .stream()
       .filter(ar -> ar.getRuleKey().equals(rule.getKey()))
index 3f88ea799067cc16d0cf603e0db77e439adfb0ca..31b3857b905bc00adc55efba6bc2d5848138b752 100644 (file)
@@ -50,7 +50,7 @@ import static java.util.Collections.emptyMap;
 import static java.util.Collections.singleton;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.rule.Severity.BLOCKER;
-import static org.sonar.server.qualityprofile.ActiveRule.Inheritance.INHERITED;
+import static org.sonar.server.qualityprofile.ActiveRuleInheritance.INHERITED;
 
 public class QProfileTreeImplTest {
 
@@ -167,7 +167,7 @@ public class QProfileTreeImplTest {
     RuleActivation activation = RuleActivation.create(rule1.getId(), BLOCKER, null);
     changes = activate(profile2, activation);
     assertThat(changes).hasSize(1);
-    assertThatRuleIsUpdated(profile2, rule1, BLOCKER, ActiveRule.Inheritance.OVERRIDES, emptyMap());
+    assertThatRuleIsUpdated(profile2, rule1, BLOCKER, ActiveRuleInheritance.OVERRIDES, emptyMap());
     assertThatRuleIsActivated(profile2, rule2, null, rule2.getSeverityString(), null, emptyMap());
 
     changes = underTest.removeParentAndCommit(db.getSession(), profile2);
@@ -211,7 +211,7 @@ public class QProfileTreeImplTest {
   }
 
   private void assertThatRuleIsActivated(QProfileDto profile, RuleDefinitionDto rule, @Nullable List<ActiveRuleChange> changes,
-    String expectedSeverity, @Nullable ActiveRule.Inheritance expectedInheritance, Map<String, String> expectedParams) {
+                                         String expectedSeverity, @Nullable ActiveRuleInheritance expectedInheritance, Map<String, String> expectedParams) {
     OrgActiveRuleDto activeRule = db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)
       .stream()
       .filter(ar -> ar.getRuleKey().equals(rule.getKey()))
@@ -246,7 +246,7 @@ public class QProfileTreeImplTest {
   }
 
   private void assertThatRuleIsUpdated(QProfileDto profile, RuleDefinitionDto rule,
-    String expectedSeverity, @Nullable ActiveRule.Inheritance expectedInheritance, Map<String, String> expectedParams) {
+                                       String expectedSeverity, @Nullable ActiveRuleInheritance expectedInheritance, Map<String, String> expectedParams) {
     OrgActiveRuleDto activeRule = db.getDbClient().activeRuleDao().selectByProfile(db.getSession(), profile)
       .stream()
       .filter(ar -> ar.getRuleKey().equals(rule.getKey()))
index 57f3a7126eb7a7515b1987cd88fd647b50d2d7c9..380eba535bb98f6d64b67c6ce92cdd467fa61be3 100644 (file)
@@ -44,8 +44,8 @@ import org.sonar.db.user.UserDto;
 import org.sonar.server.exceptions.NotFoundException;
 import org.sonar.server.organization.DefaultOrganizationProvider;
 import org.sonar.server.organization.TestDefaultOrganizationProvider;
-import org.sonar.server.qualityprofile.ActiveRule;
 import org.sonar.server.qualityprofile.ActiveRuleChange;
+import org.sonar.server.qualityprofile.ActiveRuleInheritance;
 import org.sonar.server.tester.UserSessionRule;
 import org.sonar.server.ws.TestRequest;
 import org.sonar.server.ws.WsActionTester;
@@ -291,7 +291,7 @@ public class ChangelogActionTest {
     Map<String, Object> data = ImmutableMap.of(
       "ruleId", valueOf(rule1.getId()),
       "severity", "MINOR",
-      "inheritance", ActiveRule.Inheritance.INHERITED.name(),
+      "inheritance", ActiveRuleInheritance.INHERITED.name(),
       "param_foo", "foo_value",
       "param_bar", "bar_value");
     QProfileChangeDto change = insertChange(profile, ActiveRuleChange.Type.ACTIVATED, "theLogin", data);
index bf9637321c613afe042c879f37297a709f02b10f..602c3f54ca8bcd04f269309c224fea65792dac7f 100644 (file)
@@ -76,8 +76,8 @@ import static org.sonar.db.rule.RuleTesting.setTags;
 import static org.sonar.db.rule.RuleTesting.setTemplateId;
 import static org.sonar.db.rule.RuleTesting.setType;
 import static org.sonar.db.rule.RuleTesting.setUpdatedAt;
-import static org.sonar.server.qualityprofile.ActiveRule.Inheritance.INHERITED;
-import static org.sonar.server.qualityprofile.ActiveRule.Inheritance.OVERRIDES;
+import static org.sonar.server.qualityprofile.ActiveRuleInheritance.INHERITED;
+import static org.sonar.server.qualityprofile.ActiveRuleInheritance.OVERRIDES;
 import static org.sonar.server.rule.index.RuleIndex.FACET_LANGUAGES;
 import static org.sonar.server.rule.index.RuleIndex.FACET_REPOSITORIES;
 import static org.sonar.server.rule.index.RuleIndex.FACET_TAGS;