import javax.annotation.Nullable;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.Durations;
import org.sonar.ce.task.projectanalysis.analysis.AnalysisMetadataHolder;
import org.sonar.ce.task.projectanalysis.analysis.Branch;
import org.sonar.ce.task.projectanalysis.component.Component;
private final TreeRootHolder treeRootHolder;
private final AnalysisMetadataHolder analysisMetadataHolder;
private final RuleRepository ruleRepository;
- private final Durations durations;
private final IssuesChangesNotificationSerializer issuesChangesSerializer;
private Map<String, Component> componentsByUuid;
public NotificationFactory(TreeRootHolder treeRootHolder, AnalysisMetadataHolder analysisMetadataHolder,
- RuleRepository ruleRepository, Durations durations, IssuesChangesNotificationSerializer issuesChangesSerializer) {
+ RuleRepository ruleRepository, IssuesChangesNotificationSerializer issuesChangesSerializer) {
this.treeRootHolder = treeRootHolder;
this.analysisMetadataHolder = analysisMetadataHolder;
this.ruleRepository = ruleRepository;
- this.durations = durations;
this.issuesChangesSerializer = issuesChangesSerializer;
}
public MyNewIssuesNotification newMyNewIssuesNotification(Map<String, UserDto> assigneesByUuid) {
verifyAssigneesByUuid(assigneesByUuid);
- return new MyNewIssuesNotification(durations, new DetailsSupplierImpl(assigneesByUuid));
+ return new MyNewIssuesNotification(new DetailsSupplierImpl(assigneesByUuid));
}
public NewIssuesNotification newNewIssuesNotification(Map<String, UserDto> assigneesByUuid) {
verifyAssigneesByUuid(assigneesByUuid);
- return new NewIssuesNotification(durations, new DetailsSupplierImpl(assigneesByUuid));
+ return new NewIssuesNotification(new DetailsSupplierImpl(assigneesByUuid));
}
public IssuesChangesNotification newIssuesChangesNotification(Set<DefaultIssue> issues, Map<String, UserDto> assigneesByUuid) {
@Rule
public AnalysisMetadataHolderRule analysisMetadata = new AnalysisMetadataHolderRule();
- private Durations durations = new Durations();
private IssuesChangesNotificationSerializer issuesChangesSerializer = mock(IssuesChangesNotificationSerializer.class);
- private NotificationFactory underTest = new NotificationFactory(treeRootHolder, analysisMetadata, ruleRepository, durations, issuesChangesSerializer);
+ private NotificationFactory underTest = new NotificationFactory(treeRootHolder, analysisMetadata, ruleRepository, issuesChangesSerializer);
@Test
public void newMyNewIssuesNotification_throws_NPE_if_assigneesByUuid_is_null() {
.hasMessage("assigneesByUuid can't be null");
}
- @Test
- public void newMyNewIssuesNotification_returns_MyNewIssuesNotification_object_with_the_constructor_Durations() {
- MyNewIssuesNotification notification = underTest.newMyNewIssuesNotification(emptyMap());
-
- assertThat(readDurationsField(notification)).isSameAs(durations);
- }
-
- @Test
- public void newNewIssuesNotification_returns_NewIssuesNotification_object_with_the_constructor_Durations() {
- NewIssuesNotification notification = underTest.newNewIssuesNotification(emptyMap());
-
- assertThat(readDurationsField(notification)).isSameAs(durations);
- }
-
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_fails_with_NPE_if_uuid_is_null() {
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(emptyMap());
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.Durations;
import org.sonar.db.DbTester;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.issue.IssueDto;
public DbTester db = DbTester.create();
private DetailsSupplier detailsSupplier = mock(DetailsSupplier.class);
- private NewIssuesNotification underTest = new NewIssuesNotification(new Durations(), detailsSupplier);
+ private NewIssuesNotification underTest = new NewIssuesNotification(detailsSupplier);
@Test
public void set_project_without_branch() {
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;
-import java.util.Locale;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.sonar.api.config.EmailSettings;
.append(NEW_LINE);
}
}
-
- private static Locale getLocale() {
- return Locale.ENGLISH;
- }
-
}
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import org.sonar.api.utils.Durations;
import org.sonar.db.user.UserDto;
import static org.sonar.server.issue.notification.AbstractNewIssuesEmailTemplate.FIELD_ASSIGNEE;
public static final String MY_NEW_ISSUES_NOTIF_TYPE = "my-new-issues";
- public MyNewIssuesNotification(Durations durations, DetailsSupplier detailsSupplier) {
- super(MY_NEW_ISSUES_NOTIF_TYPE, durations, detailsSupplier);
+ public MyNewIssuesNotification(DetailsSupplier detailsSupplier) {
+ super(MY_NEW_ISSUES_NOTIF_TYPE, detailsSupplier);
}
public MyNewIssuesNotification setAssignee(@Nullable UserDto assignee) {
import org.sonar.api.notifications.Notification;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.Durations;
import org.sonar.server.issue.notification.NewIssuesStatistics.Metric;
import static java.util.Objects.requireNonNull;
private static final String DOT = ".";
private final transient DetailsSupplier detailsSupplier;
- private final transient Durations durations;
- public NewIssuesNotification(Durations durations, DetailsSupplier detailsSupplier) {
- this(TYPE, durations, detailsSupplier);
+ public NewIssuesNotification(DetailsSupplier detailsSupplier) {
+ this(TYPE, detailsSupplier);
}
- protected NewIssuesNotification(String type, Durations durations, DetailsSupplier detailsSupplier) {
+ protected NewIssuesNotification(String type, DetailsSupplier detailsSupplier) {
super(type);
- this.durations = durations;
this.detailsSupplier = detailsSupplier;
}
package org.sonar.server.issue.notification;
import org.junit.Test;
-import org.sonar.api.utils.Durations;
import org.sonar.db.user.UserDto;
import org.sonar.db.user.UserTesting;
import org.sonar.server.issue.notification.NewIssuesNotification.DetailsSupplier;
public class MyNewIssuesNotificationTest {
- private MyNewIssuesNotification underTest = new MyNewIssuesNotification(mock(Durations.class), mock(DetailsSupplier.class));
+ private MyNewIssuesNotification underTest = new MyNewIssuesNotification(mock(DetailsSupplier.class));
@Test
public void set_assignee() {