aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2019-01-18 18:16:57 +0100
committersonartech <sonartech@sonarsource.com>2019-02-11 09:11:47 +0100
commit171e241f143dc29e2e815b308c08b06ae63977bc (patch)
tree56f0182a149aca0aaba9bfb804a2a5ccfa11bbef /server
parent9d3e3846a8fc09a4d33359417c169729549beda5 (diff)
downloadsonarqube-171e241f143dc29e2e815b308c08b06ae63977bc.tar.gz
sonarqube-171e241f143dc29e2e815b308c08b06ae63977bc.zip
SONAR-11631 rename constants to codePeriodVersion in notifications
Diffstat (limited to 'server')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java4
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java8
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java4
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/NewIssuesNotification.java6
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/notification/email/AlertsEmailTemplate.java2
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java4
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java4
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/notification/email/AlertsEmailTemplateTest.java4
11 files changed, 25 insertions, 25 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java
index b59acb52380..e6c3555a395 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStep.java
@@ -132,7 +132,7 @@ public class QualityGateEventsStep implements ComputationStep {
.setDefaultMessage(String.format("Alert on %s: %s", project.getName(), label))
.setFieldValue("projectName", project.getName())
.setFieldValue("projectKey", project.getKey())
- .setFieldValue("projectVersion", project.getProjectAttributes().getCodePeriodVersion())
+ .setFieldValue("codePeriodVersion", project.getProjectAttributes().getCodePeriodVersion())
.setFieldValue("alertName", label)
.setFieldValue("alertText", rawStatus.getText())
.setFieldValue("alertLevel", rawStatus.getStatus().toString())
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
index fa8b5d69c5d..1288006d6be 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStep.java
@@ -165,7 +165,7 @@ public class SendIssueNotificationsStep implements ComputationStep {
NewIssuesNotification notification = newIssuesNotificationFactory
.newNewIssuesNotification()
.setProject(project.getKey(), project.getName(), getBranchName(), getPullRequest())
- .setProjectVersion(project.getProjectAttributes().getCodePeriodVersion())
+ .setCodePeriodVersion(project.getProjectAttributes().getCodePeriodVersion())
.setAnalysisDate(new Date(analysisDate))
.setStatistics(project.getName(), globalStatistics)
.setDebt(Duration.create(globalStatistics.effort().getOnLeak()));
@@ -186,7 +186,7 @@ public class SendIssueNotificationsStep implements ComputationStep {
.setAssignee(userDtoByUuid.get(assigneeUuid));
myNewIssuesNotification
.setProject(project.getKey(), project.getName(), getBranchName(), getPullRequest())
- .setProjectVersion(project.getProjectAttributes().getCodePeriodVersion())
+ .setCodePeriodVersion(project.getProjectAttributes().getCodePeriodVersion())
.setAnalysisDate(new Date(analysisDate))
.setStatistics(project.getName(), assigneeStatistics)
.setDebt(Duration.create(assigneeStatistics.effort().getOnLeak()));
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java
index f0f25cb68e9..aa11a4b2d4c 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/QualityGateEventsStepTest.java
@@ -182,7 +182,7 @@ public class QualityGateEventsStepTest {
assertThat(notification.getType()).isEqualTo("alerts");
assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey());
assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName());
- assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
+ assertThat(notification.getFieldValue("codePeriodVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
assertThat(notification.getFieldValue("branch")).isNull();
assertThat(notification.getFieldValue("alertLevel")).isEqualTo(rawAlterStatus.name());
assertThat(notification.getFieldValue("alertName")).isEqualTo(expectedLabel);
@@ -233,7 +233,7 @@ public class QualityGateEventsStepTest {
assertThat(notification.getType()).isEqualTo("alerts");
assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey());
assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName());
- assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
+ assertThat(notification.getFieldValue("codePeriodVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
assertThat(notification.getFieldValue("branch")).isNull();
assertThat(notification.getFieldValue("alertLevel")).isEqualTo(newQualityGateStatus.getStatus().name());
assertThat(notification.getFieldValue("alertName")).isEqualTo(expectedLabel);
@@ -263,7 +263,7 @@ public class QualityGateEventsStepTest {
assertThat(notification.getType()).isEqualTo("alerts");
assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey());
assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName());
- assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
+ assertThat(notification.getFieldValue("codePeriodVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
assertThat(notification.getFieldValue("branch")).isEqualTo(branchName);
reset(measureRepository, eventRepository, notificationService);
@@ -285,7 +285,7 @@ public class QualityGateEventsStepTest {
assertThat(notification.getType()).isEqualTo("alerts");
assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey());
assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName());
- assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
+ assertThat(notification.getFieldValue("codePeriodVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getCodePeriodVersion());
assertThat(notification.getFieldValue("branch")).isEqualTo(null);
reset(measureRepository, eventRepository, notificationService);
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
index 8a1d661b90e..f50cb10f08d 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/SendIssueNotificationsStepTest.java
@@ -509,7 +509,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest {
private NewIssuesNotification createNewIssuesNotificationMock() {
NewIssuesNotification notification = mock(NewIssuesNotification.class);
when(notification.setProject(any(), any(), any(), any())).thenReturn(notification);
- when(notification.setProjectVersion(any())).thenReturn(notification);
+ when(notification.setCodePeriodVersion(any())).thenReturn(notification);
when(notification.setAnalysisDate(any())).thenReturn(notification);
when(notification.setStatistics(any(), any())).thenReturn(notification);
when(notification.setDebt(any())).thenReturn(notification);
@@ -520,7 +520,7 @@ public class SendIssueNotificationsStepTest extends BaseStepTest {
MyNewIssuesNotification notification = mock(MyNewIssuesNotification.class);
when(notification.setAssignee(any(UserDto.class))).thenReturn(notification);
when(notification.setProject(any(), any(), any(), any())).thenReturn(notification);
- when(notification.setProjectVersion(any())).thenReturn(notification);
+ when(notification.setCodePeriodVersion(any())).thenReturn(notification);
when(notification.setAnalysisDate(any())).thenReturn(notification);
when(notification.setStatistics(any(), any())).thenReturn(notification);
when(notification.setDebt(any())).thenReturn(notification);
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
index 65580d20ca0..cd557d47d64 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/AbstractNewIssuesEmailTemplate.java
@@ -51,7 +51,7 @@ public abstract class AbstractNewIssuesEmailTemplate extends EmailTemplate {
static final String FIELD_PROJECT_NAME = "projectName";
static final String FIELD_PROJECT_KEY = "projectKey";
static final String FIELD_PROJECT_DATE = "projectDate";
- static final String FIELD_PROJECT_VERSION = "projectVersion";
+ static final String FIELD_CODE_PERIOD_VERSION = "codePeriodVersion";
static final String FIELD_ASSIGNEE = "assignee";
static final String FIELD_BRANCH = "branch";
static final String FIELD_PULL_REQUEST = "pullRequest";
@@ -89,7 +89,7 @@ public abstract class AbstractNewIssuesEmailTemplate extends EmailTemplate {
if (pullRequest!= null) {
message.append("Pull request: ").append(pullRequest).append(NEW_LINE);
}
- String version = notification.getFieldValue(FIELD_PROJECT_VERSION);
+ String version = notification.getFieldValue(FIELD_CODE_PERIOD_VERSION);
if (version != null) {
message.append("Version: ").append(version).append(NEW_LINE);
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/NewIssuesNotification.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/NewIssuesNotification.java
index b50ca9ca2a1..5cac9b57003 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/NewIssuesNotification.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/NewIssuesNotification.java
@@ -47,7 +47,7 @@ import org.sonar.server.issue.notification.NewIssuesStatistics.Metric;
import static java.util.stream.Collectors.toMap;
import static java.util.stream.Collectors.toSet;
import static org.sonar.server.issue.notification.AbstractNewIssuesEmailTemplate.FIELD_BRANCH;
-import static org.sonar.server.issue.notification.AbstractNewIssuesEmailTemplate.FIELD_PROJECT_VERSION;
+import static org.sonar.server.issue.notification.AbstractNewIssuesEmailTemplate.FIELD_CODE_PERIOD_VERSION;
import static org.sonar.server.issue.notification.AbstractNewIssuesEmailTemplate.FIELD_PULL_REQUEST;
import static org.sonar.server.issue.notification.NewIssuesEmailTemplate.FIELD_PROJECT_DATE;
import static org.sonar.server.issue.notification.NewIssuesEmailTemplate.FIELD_PROJECT_KEY;
@@ -92,9 +92,9 @@ public class NewIssuesNotification extends Notification {
return this;
}
- public NewIssuesNotification setProjectVersion(@Nullable String version) {
+ public NewIssuesNotification setCodePeriodVersion(@Nullable String version) {
if (version != null) {
- setFieldValue(FIELD_PROJECT_VERSION, version);
+ setFieldValue(FIELD_CODE_PERIOD_VERSION, version);
}
return this;
}
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/AlertsEmailTemplate.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/AlertsEmailTemplate.java
index 519ac52d502..9c4afbd0e53 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/AlertsEmailTemplate.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/AlertsEmailTemplate.java
@@ -50,7 +50,7 @@ public class AlertsEmailTemplate extends EmailTemplate {
String projectId = notification.getFieldValue("projectId");
String projectKey = notification.getFieldValue("projectKey");
String projectName = notification.getFieldValue("projectName");
- String projectVersion = notification.getFieldValue("projectVersion");
+ String projectVersion = notification.getFieldValue("codePeriodVersion");
String branchName = notification.getFieldValue("branch");
String alertName = notification.getFieldValue("alertName");
String alertText = notification.getFieldValue("alertText");
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
index 633799f7c2a..3482a1c6497 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/MyNewIssuesEmailTemplateTest.java
@@ -120,7 +120,7 @@ public class MyNewIssuesEmailTemplateTest {
@Test
public void format_email_with_no_assignees_tags_nor_components() {
Notification notification = newNotification(32)
- .setFieldValue("projectVersion", "52.0");
+ .setFieldValue("codePeriodVersion", "52.0");
EmailMessage message = underTest.format(notification);
@@ -140,7 +140,7 @@ public class MyNewIssuesEmailTemplateTest {
@Test
public void format_email_with_issue_on_branch() {
Notification notification = newNotification(32)
- .setFieldValue("projectVersion", "52.0")
+ .setFieldValue("codePeriodVersion", "52.0")
.setFieldValue("branch", "feature1");
EmailMessage message = underTest.format(notification);
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
index 6a78053a360..e5f8cf06253 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesEmailTemplateTest.java
@@ -88,7 +88,7 @@ public class NewIssuesEmailTemplateTest {
@Test
public void format_email_with_all_fields_filled() {
Notification notification = newNotification(32)
- .setFieldValue("projectVersion", "42.1.1");
+ .setFieldValue("codePeriodVersion", "42.1.1");
addAssignees(notification);
addRules(notification);
addTags(notification);
@@ -179,7 +179,7 @@ public class NewIssuesEmailTemplateTest {
public void format_email_with_issue_on_branch_with_version() {
Notification notification = newNotification(32)
.setFieldValue("branch", "feature1")
- .setFieldValue("projectVersion", "42.1.1");
+ .setFieldValue("codePeriodVersion", "42.1.1");
EmailMessage message = template.format(notification);
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java
index c7f54833a88..660de8f91e7 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/notification/NewIssuesNotificationTest.java
@@ -85,16 +85,16 @@ public class NewIssuesNotificationTest {
public void set_project_version() {
String version = randomAlphanumeric(5);
- underTest.setProjectVersion(version);
+ underTest.setCodePeriodVersion(version);
- assertThat(underTest.getFieldValue(NewIssuesEmailTemplate.FIELD_PROJECT_VERSION)).isEqualTo(version);
+ assertThat(underTest.getFieldValue(NewIssuesEmailTemplate.FIELD_CODE_PERIOD_VERSION)).isEqualTo(version);
}
@Test
public void set_project_version_supports_null() {
- underTest.setProjectVersion(null);
+ underTest.setCodePeriodVersion(null);
- assertThat(underTest.getFieldValue(NewIssuesEmailTemplate.FIELD_PROJECT_VERSION)).isNull();
+ assertThat(underTest.getFieldValue(NewIssuesEmailTemplate.FIELD_CODE_PERIOD_VERSION)).isNull();
}
@Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/notification/email/AlertsEmailTemplateTest.java b/server/sonar-server/src/test/java/org/sonar/server/notification/email/AlertsEmailTemplateTest.java
index 164abbbaf72..560df67dfe9 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/notification/email/AlertsEmailTemplateTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/notification/email/AlertsEmailTemplateTest.java
@@ -128,7 +128,7 @@ public class AlertsEmailTemplateTest {
@Test
public void shouldFormatNewAlertWithoutVersion() {
Notification notification = createNotification("Red (was Green)", "violations > 4", "ERROR", "true")
- .setFieldValue("projectVersion", null);
+ .setFieldValue("codePeriodVersion", null);
EmailMessage message = template.format(notification);
assertThat(message.getMessageId(), is("alerts/45"));
@@ -200,7 +200,7 @@ public class AlertsEmailTemplateTest {
.setFieldValue("projectName", "Foo")
.setFieldValue("projectKey", "org.sonar.foo:foo")
.setFieldValue("projectId", "45")
- .setFieldValue("projectVersion", "V1-SNAP")
+ .setFieldValue("codePeriodVersion", "V1-SNAP")
.setFieldValue("alertName", alertName)
.setFieldValue("alertText", alertText)
.setFieldValue("alertLevel", alertLevel)