import static com.google.common.base.Preconditions.checkState;
import static java.lang.Integer.parseInt;
+import static java.lang.Long.parseLong;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static org.sonar.server.qualityprofile.BuiltInQualityProfilesNotificationSender.BUILT_IN_QUALITY_PROFILES;
private static final String NEW_RULES = ".newRules";
private static final String UPDATED_RULES = ".updatedRules";
private static final String REMOVED_RULES = ".removedRules";
+ private static final String START_DATE = ".startDate";
+ private static final String END_DATE = ".endDate";
private final List<Profile> profiles = new ArrayList<>();
notification.setFieldValue(index + NEW_RULES, String.valueOf(profile.getNewRules()));
notification.setFieldValue(index + UPDATED_RULES, String.valueOf(profile.getUpdatedRules()));
notification.setFieldValue(index + REMOVED_RULES, String.valueOf(profile.getRemovedRules()));
+ notification.setFieldValue(index + START_DATE, String.valueOf(profile.getStartDate()));
+ notification.setFieldValue(index + END_DATE, String.valueOf(profile.getEndDate()));
});
return notification;
}
.setNewRules(parseInt(getNonNullFieldValue(notification, index + NEW_RULES)))
.setUpdatedRules(parseInt(getNonNullFieldValue(notification, index + UPDATED_RULES)))
.setRemovedRules(parseInt(getNonNullFieldValue(notification, index + REMOVED_RULES)))
+ .setStartDate(parseLong(getNonNullFieldValue(notification, index + START_DATE)))
+ .setEndDate(parseLong(getNonNullFieldValue(notification, index + END_DATE)))
.build())
.forEach(notif::addProfile);
return notif;
private final int newRules;
private final int updatedRules;
private final int removedRules;
+ private final long startDate;
+ private final long endDate;
public Profile(Builder builder) {
this.profileName = builder.profileName;
this.newRules = builder.newRules;
this.updatedRules = builder.updatedRules;
this.removedRules = builder.removedRules;
+ this.startDate = builder.startDate;
+ this.endDate = builder.endDate;
}
public String getProfileName() {
return removedRules;
}
+ public long getStartDate() {
+ return startDate;
+ }
+
+ public long getEndDate() {
+ return endDate;
+ }
+
public static Builder newBuilder() {
return new Builder();
}
private int newRules;
private int updatedRules;
private int removedRules;
+ private long startDate;
+ private long endDate;
private Builder() {
}
return this;
}
+ public Builder setStartDate(long startDate) {
+ this.startDate = startDate;
+ return this;
+ }
+
+ public Builder setEndDate(long endDate) {
+ this.endDate = endDate;
+ return this;
+ }
+
public Profile build() {
return new Profile(this);
}
this.languages = languages;
}
- void send(Multimap<QProfileName, ActiveRuleChange> changedProfiles) {
+ void send(Multimap<QProfileName, ActiveRuleChange> changedProfiles, long startDate, long endDate) {
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification();
changedProfiles.keySet().stream()
.map(changedProfile -> {
.setNewRules(newRules)
.setUpdatedRules(updatedRules)
.setRemovedRules(removedRules)
+ .setStartDate(startDate)
+ .setEndDate(endDate)
.build();
})
.forEach(notification::addProfile);
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Comparator;
+import java.util.Date;
import org.sonar.api.notifications.Notification;
import org.sonar.api.platform.Server;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.plugins.emailnotifications.api.EmailTemplate;
+import static org.sonar.api.utils.DateUtils.formatDate;
import static org.sonar.server.qualityprofile.BuiltInQualityProfilesNotification.Profile;
import static org.sonar.server.qualityprofile.BuiltInQualityProfilesNotification.parse;
import static org.sonar.server.qualityprofile.BuiltInQualityProfilesNotificationSender.BUILT_IN_QUALITY_PROFILES;
.append(profile.getLanguageKey())
.append("&name=")
.append(encode(profile.getProfileName()))
+ .append("&since=")
+ .append(formatDate(new Date(profile.getStartDate())))
+ .append("&to=")
+ .append(formatDate(new Date(profile.getEndDate())))
.append("\n");
int newRules = profile.getNewRules();
if (newRules > 0) {
import java.util.List;
import java.util.Map;
import org.sonar.api.server.ServerSide;
+import org.sonar.api.utils.System2;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.api.utils.log.Profiler;
private final BuiltInQProfileInsert builtInQProfileInsert;
private final BuiltInQProfileUpdate builtInQProfileUpdate;
private final BuiltInQualityProfilesNotificationSender builtInQualityProfilesNotification;
+ private final System2 system2;
public RegisterQualityProfiles(BuiltInQProfileRepository builtInQProfileRepository,
- DbClient dbClient, BuiltInQProfileInsert builtInQProfileInsert, BuiltInQProfileUpdate builtInQProfileUpdate,
- BuiltInQualityProfilesNotificationSender builtInQualityProfilesNotification) {
+ DbClient dbClient, BuiltInQProfileInsert builtInQProfileInsert, BuiltInQProfileUpdate builtInQProfileUpdate,
+ BuiltInQualityProfilesNotificationSender builtInQualityProfilesNotification, System2 system2) {
this.builtInQProfileRepository = builtInQProfileRepository;
this.dbClient = dbClient;
this.builtInQProfileInsert = builtInQProfileInsert;
this.builtInQProfileUpdate = builtInQProfileUpdate;
this.builtInQualityProfilesNotification = builtInQualityProfilesNotification;
+ this.system2 = system2;
}
public void start() {
Profiler profiler = Profiler.create(Loggers.get(getClass())).startInfo("Register quality profiles");
try (DbSession dbSession = dbClient.openSession(false);
DbSession batchDbSession = dbClient.openSession(true)) {
+ long startDate = system2.now();
Map<QProfileName, RulesProfileDto> persistedRuleProfiles = loadPersistedProfiles(dbSession);
}
});
if (!changedProfiles.isEmpty()) {
- builtInQualityProfilesNotification.send(changedProfiles);
+ long endDate = system2.now();
+ builtInQualityProfilesNotification.send(changedProfiles, startDate, endDate);
}
}
profiler.stopDebug();
Tuple expectedTuple = addProfile(profiles, languages, ACTIVATED);
BuiltInQualityProfilesNotificationSender underTest = new BuiltInQualityProfilesNotificationSender(notificationManager, languages);
- underTest.send(profiles);
+ underTest.send(profiles, 0, 1);
ArgumentCaptor<Notification> notificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class);
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
Tuple expectedTuple = addProfile(profiles, languages, UPDATED);
BuiltInQualityProfilesNotificationSender underTest = new BuiltInQualityProfilesNotificationSender(notificationManager, languages);
- underTest.send(profiles);
+ underTest.send(profiles, 0, 1);
ArgumentCaptor<Notification> notificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class);
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
Tuple expectedTuple = addProfile(profiles, languages, DEACTIVATED);
BuiltInQualityProfilesNotificationSender underTest = new BuiltInQualityProfilesNotificationSender(notificationManager, languages);
- underTest.send(profiles);
+ underTest.send(profiles, 0, 1);
ArgumentCaptor<Notification> notificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class);
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
Tuple expectedTuple2 = addProfile(profiles, languages, ACTIVATED);
BuiltInQualityProfilesNotificationSender underTest = new BuiltInQualityProfilesNotificationSender(notificationManager, languages);
- underTest.send(profiles);
+ underTest.send(profiles, 0, 1);
ArgumentCaptor<Notification> notificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class);
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
.containsExactlyInAnyOrder(expectedTuple1, expectedTuple2);
}
+ @Test
+ public void add_start_and_end_dates_to_notification() throws Exception {
+ Multimap<QProfileName, ActiveRuleChange> profiles = ArrayListMultimap.create();
+ Languages languages = new Languages();
+ addProfile(profiles, languages, ACTIVATED);
+ long startDate = RANDOM.nextInt(5000);
+ long endDate = startDate + RANDOM.nextInt(5000);
+
+ BuiltInQualityProfilesNotificationSender underTest = new BuiltInQualityProfilesNotificationSender(notificationManager, languages);
+ underTest.send(profiles, startDate, endDate);
+
+ ArgumentCaptor<Notification> notificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class);
+ verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
+ verifyNoMoreInteractions(notificationManager);
+ assertThat(BuiltInQualityProfilesNotification.parse(notificationArgumentCaptor.getValue()).getProfiles())
+ .extracting(Profile::getStartDate, Profile::getEndDate)
+ .containsExactlyInAnyOrder(tuple(startDate, endDate));
+ }
+
private Tuple addProfile(Multimap<QProfileName, ActiveRuleChange> profiles, Languages languages, ActiveRuleChange.Type type) {
String profileName = randomLowerCaseText();
Language language = newLanguage(randomLowerCaseText(), randomLowerCaseText());
package org.sonar.server.qualityprofile;
+import java.util.Date;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.platform.Server;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import static org.sonar.api.utils.DateUtils.formatDate;
public class BuiltInQualityProfilesNotificationTemplateTest {
EmailMessage emailMessage = underTest.format(notification.serialize());
assertMessage(emailMessage,
- profileTitleText(profileName, languageKey, languageName) +
- " 2 new rules\n");
+ "\n 2 new rules\n");
}
@Test
EmailMessage emailMessage = underTest.format(notification.serialize());
assertMessage(emailMessage,
- profileTitleText(profileName, languageKey, languageName) +
+ "\n" +
" 2 rules have been updated\n");
}
EmailMessage emailMessage = underTest.format(notification.serialize());
assertMessage(emailMessage,
- profileTitleText(profileName, languageKey, languageName) +
+ "\n" +
" 2 rules removed\n");
}
EmailMessage emailMessage = underTest.format(notification.serialize());
assertMessage(emailMessage,
- profileTitleText(profileName, languageKey, languageName) +
+ "\n" +
" 2 new rules\n" +
" 3 rules have been updated\n" +
" 4 rules removed\n");
EmailMessage emailMessage = underTest.format(notification.serialize());
- assertMessage(emailMessage,
- profileTitleText(profileName1, languageKey1, languageName1) +
- " 2 new rules\n" +
- profileTitleText(profileName2, languageKey2, languageName2) +
- " 13 new rules\n");
+ assertThat(emailMessage.getMessage()).containsSequence("Built-in quality profiles have been updated:\n",
+ profileTitleText(profileName1, languageKey1, languageName1),
+ " 2 new rules\n",
+ profileTitleText(profileName2, languageKey2, languageName2),
+ " 13 new rules\n",
+ "This is a good time to review your quality profiles and update them to benefit from the latest evolutions. " + server.getPublicRootUrl() + "/profiles");
}
@Test
assertThat(emailMessage.getMessage()).contains(server.getPublicRootUrl() + "/profiles/changelog?language=java&name=Sonar+Way");
}
+ @Test
+ public void notification_contains_from_and_to_date() {
+ String profileName = newProfileName();
+ String languageKey = newLanguageKey();
+ String languageName = newLanguageName();
+ long startDate = 1_000_000_000_000L;
+ long endDate = startDate + 1_100_000_000_000L;
+ BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
+ .setStartDate(startDate)
+ .setEndDate(endDate)
+ .build());
+
+ EmailMessage emailMessage = underTest.format(notification.serialize());
+
+ assertMessage(emailMessage,
+ profileTitleText(profileName, languageKey, languageName, formatDate(new Date(startDate)), formatDate(new Date(endDate))));
+ }
+
private void assertMessage(EmailMessage emailMessage, String expectedProfileDetails) {
- String expected = "Built-in quality profiles have been updated:\n" +
- expectedProfileDetails +
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions. " + server.getPublicRootUrl() + "/profiles";
- assertThat(emailMessage.getMessage()).isEqualTo(expected);
+ assertThat(emailMessage.getMessage()).containsSequence("Built-in quality profiles have been updated:\n",
+ expectedProfileDetails,
+ "This is a good time to review your quality profiles and update them to benefit from the latest evolutions. " + server.getPublicRootUrl() + "/profiles");
}
private String profileTitleText(String profileName, String languageKey, String languageName) {
- return "\"" + profileName + "\" - " + languageName + " " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName + "\n";
+ return "\"" + profileName + "\" - " + languageName + " " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName;
+ }
+
+ private String profileTitleText(String profileName, String languageKey, String languageName, String startDate, String endDate) {
+ return "\"" + profileName + "\" - " + languageName + " " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName +
+ "&since=" + startDate + "&to=" + endDate + "\n";
}
private static String newProfileName() {
package org.sonar.server.qualityprofile;
+import java.util.Random;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class BuiltInQualityProfilesNotificationTest {
+ private static final Random RANDOM = new Random();
+
@Rule
public ExpectedException expectedException = ExpectedException.none();
String profileName = randomAlphanumeric(20);
String languageKey = randomAlphanumeric(20);
String languageName = randomAlphanumeric(20);
+ int newRules = RANDOM.nextInt(5000);
+ int updatedRules = RANDOM.nextInt(5000);
+ int removedRules = RANDOM.nextInt(5000);
+ long startDate = RANDOM.nextInt(5000);
+ long endDate = startDate + RANDOM.nextInt(5000);
Notification notification = new BuiltInQualityProfilesNotification()
.addProfile(Profile.newBuilder()
.setProfileName(profileName)
.setLanguageKey(languageKey)
.setLanguageName(languageName)
- .setNewRules(3)
- .setUpdatedRules(5)
- .setRemovedRules(7)
+ .setNewRules(newRules)
+ .setUpdatedRules(updatedRules)
+ .setRemovedRules(removedRules)
+ .setStartDate(startDate)
+ .setEndDate(endDate)
.build())
.serialize();
BuiltInQualityProfilesNotification result = BuiltInQualityProfilesNotification.parse(notification);
- assertThat(result.getProfiles()).extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName,
- Profile::getNewRules, Profile::getUpdatedRules, Profile::getRemovedRules)
- .containsExactlyInAnyOrder(tuple(profileName, languageKey, languageName, 3, 5, 7));
+ assertThat(result.getProfiles())
+ .extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName, Profile::getNewRules, Profile::getUpdatedRules, Profile::getRemovedRules,
+ Profile::getStartDate, Profile::getEndDate)
+ .containsExactlyInAnyOrder(tuple(profileName, languageKey, languageName, newRules, updatedRules, removedRules, startDate, endDate));
}
@Test
.containsExactlyInAnyOrder(tuple(profileName1, languageKey1, languageName1), tuple(profileName2, languageKey2, languageName2));
}
+ @Test
+ public void serialize_and_parse_max_values() {
+ String profileName = randomAlphanumeric(20);
+ String languageKey = randomAlphanumeric(20);
+ String languageName = randomAlphanumeric(20);
+ int newRules = Integer.MAX_VALUE;
+ int updatedRules = Integer.MAX_VALUE;
+ int removedRules = Integer.MAX_VALUE;
+ long startDate = Long.MAX_VALUE;
+ long endDate = Long.MAX_VALUE;
+
+ Notification notification = new BuiltInQualityProfilesNotification()
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
+ .setNewRules(newRules)
+ .setUpdatedRules(updatedRules)
+ .setRemovedRules(removedRules)
+ .setStartDate(startDate)
+ .setEndDate(endDate)
+ .build())
+ .serialize();
+ BuiltInQualityProfilesNotification result = BuiltInQualityProfilesNotification.parse(notification);
+
+ assertThat(result.getProfiles())
+ .extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName, Profile::getNewRules, Profile::getUpdatedRules, Profile::getRemovedRules,
+ Profile::getStartDate, Profile::getEndDate)
+ .containsExactlyInAnyOrder(tuple(profileName, languageKey, languageName, newRules, updatedRules, removedRules, startDate, endDate));
+ }
+
@Test
public void fail_with_ISE_when_parsing_empty_notification() {
expectedException.expect(IllegalStateException.class);
import com.google.common.collect.Multimap;
import java.util.Arrays;
+import java.util.Random;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.RulePriority;
import org.sonar.api.utils.System2;
-import org.sonar.api.utils.internal.AlwaysIncreasingSystem2;
import org.sonar.api.utils.log.LogTester;
import org.sonar.core.util.UuidFactoryFast;
import org.sonar.db.DbClient;
import static org.apache.commons.lang.math.RandomUtils.nextLong;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
import static org.sonar.api.rules.Rule.create;
import static org.sonar.api.rules.RulePriority.MAJOR;
import static org.sonar.db.qualityprofile.QualityProfileTesting.newRuleProfileDto;
public class RegisterQualityProfilesNotificationTest {
- private System2 system2 = new AlwaysIncreasingSystem2();
+ private static final Random RANDOM = new Random();
+
+ private System2 system2 = mock(System2.class);
@Rule
public DbTester db = DbTester.create(system2);
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Rule
public BuiltInQProfileRepositoryRule builtInQProfileRepositoryRule = new BuiltInQProfileRepositoryRule();
+
@Rule
public LogTester logTester = new LogTester();
-
private DbClient dbClient = db.getDbClient();
private TypeValidations typeValidations = mock(TypeValidations.class);
private ActiveRuleIndexer activeRuleIndexer = mock(ActiveRuleIndexer.class);
private BuiltInQProfileUpdate builtInQProfileUpdate = new BuiltInQProfileUpdateImpl(dbClient, ruleActivator, activeRuleIndexer);
private BuiltInQualityProfilesNotificationSender builtInQualityProfilesNotification = mock(BuiltInQualityProfilesNotificationSender.class);
private RegisterQualityProfiles underTest = new RegisterQualityProfiles(builtInQProfileRepositoryRule, dbClient,
- builtInQProfileInsert, builtInQProfileUpdate, builtInQualityProfilesNotification);
+ builtInQProfileInsert, builtInQProfileUpdate, builtInQualityProfilesNotification, system2);
@Test
public void does_not_send_notification_on_new_profile() {
underTest.start();
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
- verify(builtInQualityProfilesNotification).send(captor.capture());
+ verify(builtInQualityProfilesNotification).send(captor.capture(), anyLong(), anyLong());
Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
underTest.start();
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
- verify(builtInQualityProfilesNotification).send(captor.capture());
+ verify(builtInQualityProfilesNotification).send(captor.capture(), anyLong(), anyLong());
Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
underTest.start();
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
- verify(builtInQualityProfilesNotification).send(captor.capture());
+ verify(builtInQualityProfilesNotification).send(captor.capture(), anyLong(), anyLong());
Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
underTest.start();
ArgumentCaptor<Multimap> captor = ArgumentCaptor.forClass(Multimap.class);
- verify(builtInQualityProfilesNotification).send(captor.capture());
+ verify(builtInQualityProfilesNotification).send(captor.capture(), anyLong(), anyLong());
Multimap<QProfileName, ActiveRuleChange> updatedProfiles = captor.<Multimap<QProfileName, ActiveRuleChange>>getValue();
assertThat(updatedProfiles.keySet())
.extracting(QProfileName::getName, QProfileName::getLanguage)
.containsExactlyInAnyOrder(tuple(newRule.getId(), ACTIVATED));
}
+ @Test
+ public void send_start_and_end_date() {
+ String language = newLanguageKey();
+ RuleDefinitionDto existingRule = db.rules().insert(r -> r.setLanguage(language));
+ RulesProfileDto dbProfile = insertBuiltInProfile(language);
+ activateRuleInDb(dbProfile, existingRule, MAJOR);
+ RuleDefinitionDto newRule = db.rules().insert(r -> r.setLanguage(language));
+ addPluginProfile(dbProfile, existingRule, newRule);
+ builtInQProfileRepositoryRule.initialize();
+ long startDate = RANDOM.nextInt(5000);
+ long endDate = startDate + RANDOM.nextInt(5000);
+ when(system2.now()).thenReturn(startDate, endDate);
+
+ underTest.start();
+
+ verify(builtInQualityProfilesNotification).send(any(), eq(startDate), eq(endDate));
+ }
private void addPluginProfile(RulesProfileDto dbProfile, RuleDefinitionDto... dbRules) {
RulesProfile pluginProfile = RulesProfile.create(dbProfile.getName(), dbProfile.getLanguage());
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.resources.Language;
+import org.sonar.api.utils.System2;
import org.sonar.api.utils.internal.AlwaysIncreasingSystem2;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
private static final Language FOO_LANGUAGE = LanguageTesting.newLanguage("foo");
private static final Language BAR_LANGUAGE = LanguageTesting.newLanguage("bar");
+ private System2 system2 = new AlwaysIncreasingSystem2();
@Rule
- public DbTester db = DbTester.create(new AlwaysIncreasingSystem2());
+ public DbTester db = DbTester.create(system2);
@Rule
public UserSessionRule userSessionRule = UserSessionRule.standalone();
@Rule
private DbClient dbClient = db.getDbClient();
private DummyBuiltInQProfileInsert insert = new DummyBuiltInQProfileInsert();
private DummyBuiltInQProfileUpdate update = new DummyBuiltInQProfileUpdate();
- private RegisterQualityProfiles underTest = new RegisterQualityProfiles(builtInQProfileRepositoryRule, dbClient, insert, update, mock(BuiltInQualityProfilesNotificationSender.class));
+ private RegisterQualityProfiles underTest = new RegisterQualityProfiles(builtInQProfileRepositoryRule, dbClient, insert, update, mock(BuiltInQualityProfilesNotificationSender.class), system2);
@Test
public void start_fails_if_BuiltInQProfileRepository_has_not_been_initialized() {
assertThat(messages.get(0).getMimeMessage().getContent().toString())
.containsSequence(
"Built-in quality profiles have been updated:",
- "\"Basic\" - Foo " + url + "/profiles/changelog?language=foo&name=Basic",
+ "\"Basic\" - Foo " + url + "/profiles/changelog?language=foo&name=Basic&since=", "&to=",
" 1 new rules",
" 3 rules have been updated",
" 1 rules removed",