aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server-common
diff options
context:
space:
mode:
authorPierre <pierre.guillot@sonarsource.com>2022-02-22 16:00:47 +0100
committersonartech <sonartech@sonarsource.com>2022-02-24 20:02:52 +0000
commit1457934dc1e472cfd7d22fe098ee8bc2a1141511 (patch)
tree3ba8bba84152ce95d1d46bddd78354c35a50ea99 /server/sonar-server-common
parent952c70ec25d416f7f660677ca260e41864a4ccbd (diff)
downloadsonarqube-1457934dc1e472cfd7d22fe098ee8bc2a1141511.tar.gz
sonarqube-1457934dc1e472cfd7d22fe098ee8bc2a1141511.zip
SONAR-7496 drop unused columns on Issues table
Diffstat (limited to 'server/sonar-server-common')
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java12
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java31
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/index/IssueIteratorFactoryTest.java6
3 files changed, 1 insertions, 48 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java
index 1f0ddb37dd7..2d85d30ab16 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/IssueFieldsSetter.java
@@ -302,18 +302,6 @@ public class IssueFieldsSetter {
return setEffort(issue, currentEffort, context);
}
- public boolean setAttribute(DefaultIssue issue, String key, @Nullable String value, IssueChangeContext context) {
- String oldValue = issue.attribute(key);
- if (!Objects.equals(oldValue, value)) {
- issue.setFieldChange(context, key, oldValue, value);
- issue.setAttribute(key, value);
- issue.setUpdateDate(context.date());
- issue.setChanged(true);
- return true;
- }
- return false;
- }
-
public boolean setTags(DefaultIssue issue, Collection<String> tags, IssueChangeContext context) {
Set<String> newTags = RuleTagFormat.validate(tags);
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java
index 28bb4ff34df..2ab5b815ed0 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/IssueFieldsSetterTest.java
@@ -343,37 +343,6 @@ public class IssueFieldsSetterTest {
}
@Test
- public void set_new_attribute_value() {
- boolean updated = underTest.setAttribute(issue, "JIRA", "FOO-123", context);
- assertThat(updated).isTrue();
- assertThat(issue.attribute("JIRA")).isEqualTo("FOO-123");
- assertThat(issue.currentChange().diffs()).hasSize(1);
- assertThat(issue.currentChange().get("JIRA").oldValue()).isNull();
- assertThat(issue.currentChange().get("JIRA").newValue()).isEqualTo("FOO-123");
- assertThat(issue.mustSendNotifications()).isFalse();
- }
-
- @Test
- public void unset_attribute() {
- issue.setAttribute("JIRA", "FOO-123");
- boolean updated = underTest.setAttribute(issue, "JIRA", null, context);
- assertThat(updated).isTrue();
- assertThat(issue.attribute("JIRA")).isNull();
- assertThat(issue.currentChange().diffs()).hasSize(1);
- assertThat(issue.currentChange().get("JIRA").oldValue()).isEqualTo("FOO-123");
- assertThat(issue.currentChange().get("JIRA").newValue()).isNull();
- assertThat(issue.mustSendNotifications()).isFalse();
- }
-
- @Test
- public void not_update_attribute() {
- issue.setAttribute("JIRA", "FOO-123");
- boolean updated = underTest.setAttribute(issue, "JIRA", "FOO-123", context);
- assertThat(updated).isFalse();
- assertThat(issue.mustSendNotifications()).isFalse();
- }
-
- @Test
public void set_gap_to_fix() {
boolean updated = underTest.setGap(issue, 3.14, context);
assertThat(updated).isTrue();
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/index/IssueIteratorFactoryTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/index/IssueIteratorFactoryTest.java
index f67e112e74e..b43eb7bc89c 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/index/IssueIteratorFactoryTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/index/IssueIteratorFactoryTest.java
@@ -63,7 +63,6 @@ public class IssueIteratorFactoryTest {
.setMessage(null)
.setLine(444)
.setRuleUuid(rule.getUuid())
- .setIssueAttributes("JIRA=http://jira.com")
.setTags(List.of("tag1", "tag2", "tag3"))
.setCreatedAt(1400000000000L)
.setUpdatedAt(1400000000000L)
@@ -108,15 +107,12 @@ public class IssueIteratorFactoryTest {
t -> t
.setAssigneeUuid("uuid-of-guy1")
.setAuthorLogin("guy2")
- .setRuleUuid(rule.getUuid())
- .setIssueAttributes("JIRA=http://jira.com")
.setEffort(10L)
.setType(1));
IssueDto moduleIssue = dbTester.issues().insert(rule, project, module, t -> t
.setAssigneeUuid("uuid-of-guy2")
.setAuthorLogin("guy2")
- .setRuleUuid(rule.getUuid())
- .setIssueAttributes("JIRA=http://jira.com"));
+ .setRuleUuid(rule.getUuid()));
IssueDto dirIssue = dbTester.issues().insert(rule, project, directory);
IssueDto projectIssue = dbTester.issues().insert(rule, project, project);