aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorDamien Urruty <damien.urruty@sonarsource.com>2022-02-24 14:51:07 +0100
committersonartech <sonartech@sonarsource.com>2022-02-25 20:02:53 +0000
commit0253f591bd017cb9a9c8e365fa074a7bc4b0a2a0 (patch)
treee9b2794b0904a2aa999273c1d1075e6aba86e08b /sonar-core
parent9828d4922ec6064d0c7814b285a639ef1f838de4 (diff)
downloadsonarqube-0253f591bd017cb9a9c8e365fa074a7bc4b0a2a0.tar.gz
sonarqube-0253f591bd017cb9a9c8e365fa074a7bc4b0a2a0.zip
SONAR-15919 Rename RuleSetChangedEvent and fix payload format
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/RuleActivationListener.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/util/RuleSetChangedEvent.java (renamed from sonar-core/src/main/java/org/sonar/core/util/RuleSetChangeEvent.java)28
-rw-r--r--sonar-core/src/test/java/org/sonar/core/util/RuleSetChangedEventTest.java (renamed from sonar-core/src/test/java/org/sonar/core/util/RuleSetChangeEventTest.java)8
3 files changed, 14 insertions, 26 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/util/RuleActivationListener.java b/sonar-core/src/main/java/org/sonar/core/util/RuleActivationListener.java
index d234d200d71..3a50054ca98 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/RuleActivationListener.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/RuleActivationListener.java
@@ -21,5 +21,5 @@ package org.sonar.core.util;
public interface RuleActivationListener {
- void listen(RuleSetChangeEvent event);
-} \ No newline at end of file
+ void listen(RuleSetChangedEvent event);
+}
diff --git a/sonar-core/src/main/java/org/sonar/core/util/RuleSetChangeEvent.java b/sonar-core/src/main/java/org/sonar/core/util/RuleSetChangedEvent.java
index 5c9825a0522..5f3c3f95982 100644
--- a/sonar-core/src/main/java/org/sonar/core/util/RuleSetChangeEvent.java
+++ b/sonar-core/src/main/java/org/sonar/core/util/RuleSetChangedEvent.java
@@ -21,37 +21,25 @@ package org.sonar.core.util;
import java.io.Serializable;
-public class RuleSetChangeEvent implements Serializable {
+public class RuleSetChangedEvent implements Serializable {
- private static final String EVENT = "RuleSetChange";
+ private static final String EVENT = "RuleSetChanged";
- private String[] projects;
- private String language;
- private RuleChange[] activatedRules;
- private RuleChange[] deactivatedRules;
+ private final String[] projects;
+ private final String language;
+ private final RuleChange[] activatedRules;
+ private final RuleChange[] deactivatedRules;
- public RuleSetChangeEvent(String[] projects, RuleChange[] activatedRules, RuleChange[] deactivatedRules) {
+ public RuleSetChangedEvent(String[] projects, RuleChange[] activatedRules, RuleChange[] deactivatedRules) {
this.projects = projects;
this.activatedRules = activatedRules;
this.deactivatedRules = deactivatedRules;
if (activatedRules.length == 0 && deactivatedRules.length == 0) {
- throw new IllegalArgumentException("Can't create RuleSetChangeEvent without any rules that have changed");
+ throw new IllegalArgumentException("Can't create RuleSetChangedEvent without any rules that have changed");
}
this.language = activatedRules.length > 0 ? activatedRules[0].getLanguage() : deactivatedRules[0].getLanguage();
}
- public void setProjects(String[] projects) {
- this.projects = projects;
- }
-
- public void setActivatedRules(RuleChange[] activatedRules) {
- this.activatedRules = activatedRules;
- }
-
- public void setDeactivatedRules(RuleChange[] deactivatedRules) {
- this.deactivatedRules = deactivatedRules;
- }
-
public String getEvent() {
return EVENT;
}
diff --git a/sonar-core/src/test/java/org/sonar/core/util/RuleSetChangeEventTest.java b/sonar-core/src/test/java/org/sonar/core/util/RuleSetChangedEventTest.java
index 71166586600..637d324ef5b 100644
--- a/sonar-core/src/test/java/org/sonar/core/util/RuleSetChangeEventTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/util/RuleSetChangedEventTest.java
@@ -24,14 +24,14 @@ import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-public class RuleSetChangeEventTest {
+public class RuleSetChangedEventTest {
@Test
public void getLanguage_givenNoDeactivatedRules_languageIsCorrectlyIdentified() {
String[] projects = {"sonarqube"};
RuleChange[] activatedRules = {createRuleChange("java")};
RuleChange[] deactivatedRules = {};
- RuleSetChangeEvent event = new RuleSetChangeEvent(projects, activatedRules, deactivatedRules);
+ RuleSetChangedEvent event = new RuleSetChangedEvent(projects, activatedRules, deactivatedRules);
String language = event.getLanguage();
@@ -43,7 +43,7 @@ public class RuleSetChangeEventTest {
String[] projects = {"sonarqube"};
RuleChange[] activatedRules = {};
RuleChange[] deactivatedRules = {createRuleChange("java")};
- RuleSetChangeEvent event = new RuleSetChangeEvent(projects, activatedRules, deactivatedRules);
+ RuleSetChangedEvent event = new RuleSetChangedEvent(projects, activatedRules, deactivatedRules);
String language = event.getLanguage();
@@ -56,7 +56,7 @@ public class RuleSetChangeEventTest {
RuleChange[] activatedRules = {};
RuleChange[] deactivatedRules = {};
- assertThatThrownBy(() -> new RuleSetChangeEvent(projects, activatedRules, deactivatedRules))
+ assertThatThrownBy(() -> new RuleSetChangedEvent(projects, activatedRules, deactivatedRules))
.isInstanceOf(IllegalArgumentException.class);
}