private static final String NUMBER_OF_PROFILES = "numberOfProfiles";
private static final String PROFILE_NAME = ".profileName";
- private static final String LANGUAGE = ".language";
+ private static final String LANGUAGE_KEY = ".languageKey";
+ private static final String LANGUAGE_NAME = ".languageName";
private static final String NEW_RULES = ".newRules";
private static final String UPDATED_RULES = ".updatedRules";
private static final String REMOVED_RULES = ".removedRules";
profiles.forEach(profile -> {
int index = count.getAndIncrement();
notification.setFieldValue(index + PROFILE_NAME, profile.getProfileName());
- notification.setFieldValue(index + LANGUAGE, profile.getLanguage());
+ notification.setFieldValue(index + LANGUAGE_KEY, profile.getLanguageKey());
+ notification.setFieldValue(index + LANGUAGE_NAME, profile.getLanguageName());
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()));
checkState(numberOfProfilesText != null, "Could not read the built-in quality profile notification");
Integer numberOfProfiles = Integer.valueOf(numberOfProfilesText);
IntStream.rangeClosed(0, numberOfProfiles - 1)
- .mapToObj(index -> Profile.newBuilder(
- getNonNullFieldValue(notification, index + PROFILE_NAME),
- getNonNullFieldValue(notification, index + LANGUAGE))
+ .mapToObj(index -> Profile.newBuilder()
+ .setProfileName(getNonNullFieldValue(notification, index + PROFILE_NAME))
+ .setLanguageKey(getNonNullFieldValue(notification, index + LANGUAGE_KEY))
+ .setLanguageName(getNonNullFieldValue(notification, index + LANGUAGE_NAME))
.setNewRules(parseInt(getNonNullFieldValue(notification, index + NEW_RULES)))
.setUpdatedRules(parseInt(getNonNullFieldValue(notification, index + UPDATED_RULES)))
.setRemovedRules(parseInt(getNonNullFieldValue(notification, index + REMOVED_RULES)))
public static class Profile {
private final String profileName;
- private final String language;
+ private final String languageKey;
+ private final String languageName;
private final int newRules;
private final int updatedRules;
private final int removedRules;
public Profile(Builder builder) {
this.profileName = builder.profileName;
- this.language = builder.language;
+ this.languageKey = builder.languageKey;
+ this.languageName = builder.languageName;
this.newRules = builder.newRules;
this.updatedRules = builder.updatedRules;
this.removedRules = builder.removedRules;
return profileName;
}
- public String getLanguage() {
- return language;
+ public String getLanguageKey() {
+ return languageKey;
+ }
+
+ public String getLanguageName() {
+ return languageName;
}
public int getNewRules() {
return removedRules;
}
- public static Builder newBuilder(String profileName, String language) {
- return new Builder(profileName, language);
+ public static Builder newBuilder() {
+ return new Builder();
}
public static class Builder {
- private final String profileName;
- private final String language;
+ private String profileName;
+ private String languageKey;
+ private String languageName;
private int newRules;
private int updatedRules;
private int removedRules;
- private Builder(String profileName, String language) {
+ private Builder() {
+ }
+
+ public Builder setLanguageKey(String languageKey) {
+ this.languageKey = requireNonNull(languageKey, "languageKEy should not be null");
+ return this;
+ }
+
+ public Builder setLanguageName(String languageName) {
+ this.languageName = requireNonNull(languageName, "languageName should not be null");
+ return this;
+ }
+
+ public Builder setProfileName(String profileName) {
this.profileName = requireNonNull(profileName, "profileName should not be null");
- this.language = requireNonNull(language, "language should not be null");
+ return this;
}
public Builder setNewRules(int newRules) {
import com.google.common.collect.Multimap;
import java.util.Collection;
+import org.sonar.api.resources.Language;
import org.sonar.api.resources.Languages;
import org.sonar.server.notification.NotificationManager;
import org.sonar.server.qualityprofile.BuiltInQualityProfilesNotification.Profile;
changedProfiles.keySet().stream()
.map(changedProfile -> {
String profileName = changedProfile.getName();
- String languageName = languages.get(changedProfile.getLanguage()).getName();
+ Language language = languages.get(changedProfile.getLanguage());
Collection<ActiveRuleChange> activeRuleChanges = changedProfiles.get(changedProfile);
int newRules = (int) activeRuleChanges.stream().map(ActiveRuleChange::getType).filter(ACTIVATED::equals).count();
int updatedRules = (int) activeRuleChanges.stream().map(ActiveRuleChange::getType).filter(UPDATED::equals).count();
int removedRules = (int) activeRuleChanges.stream().map(ActiveRuleChange::getType).filter(DEACTIVATED::equals).count();
- return Profile.newBuilder(profileName, languageName)
+ return Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(language.getKey())
+ .setLanguageName(language.getName())
.setNewRules(newRules)
.setUpdatedRules(updatedRules)
.setRemovedRules(removedRules)
*/
package org.sonar.server.qualityprofile;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.Comparator;
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 org.sonar.server.qualityprofile.BuiltInQualityProfilesNotification.Profile;
+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;
public class BuiltInQualityProfilesNotificationTemplate extends EmailTemplate {
+ private final Server server;
+
+ public BuiltInQualityProfilesNotificationTemplate(Server server) {
+ this.server = server;
+ }
+
@Override
public EmailMessage format(Notification notification) {
if (!BUILT_IN_QUALITY_PROFILES.equals(notification.getType())) {
return null;
}
- BuiltInQualityProfilesNotification profilesNotification = BuiltInQualityProfilesNotification.parse(notification);
+ BuiltInQualityProfilesNotification profilesNotification = parse(notification);
StringBuilder message = new StringBuilder("Built-in quality profiles have been updated:\n");
profilesNotification.getProfiles().stream()
- .sorted(Comparator.comparing(Profile::getLanguage).thenComparing(Profile::getProfileName))
+ .sorted(Comparator.comparing(Profile::getLanguageName).thenComparing(Profile::getProfileName))
.forEach(profile -> {
message.append("\"")
- .append(profile.getProfileName()).append("\" - ")
- .append(profile.getLanguage()).append("\n");
+ .append(profile.getProfileName())
+ .append("\" - ")
+ .append(profile.getLanguageName())
+ .append(" ")
+ .append(server.getPublicRootUrl()).append("/profiles/changelog?language=")
+ .append(profile.getLanguageKey())
+ .append("&name=")
+ .append(encode(profile.getProfileName()))
+ .append("\n");
int newRules = profile.getNewRules();
if (newRules > 0) {
message.append(" ").append(newRules).append(" new rules\n");
}
});
- message.append(
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.");
+ message.append("This is a good time to review your quality profiles and update them to benefit from the latest evolutions. ");
+ message.append(server.getPublicRootUrl()).append("/profiles");
// And finally return the email that will be sent
return new EmailMessage()
.setMessage(message.toString());
}
+ public String encode(String text) {
+ try {
+ return URLEncoder.encode(text, StandardCharsets.UTF_8.name());
+ } catch (UnsupportedEncodingException e) {
+ throw new IllegalStateException(String.format("Cannot encode %s", text), e);
+ }
+ }
}
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
verifyNoMoreInteractions(notificationManager);
assertThat(BuiltInQualityProfilesNotification.parse(notificationArgumentCaptor.getValue()).getProfiles())
- .extracting(Profile::getProfileName, Profile::getLanguage, Profile::getNewRules)
+ .extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName, Profile::getNewRules)
.containsExactlyInAnyOrder(expectedTuple);
}
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
verifyNoMoreInteractions(notificationManager);
assertThat(BuiltInQualityProfilesNotification.parse(notificationArgumentCaptor.getValue()).getProfiles())
- .extracting(Profile::getProfileName, Profile::getLanguage, Profile::getUpdatedRules)
+ .extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName, Profile::getUpdatedRules)
.containsExactlyInAnyOrder(expectedTuple);
}
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
verifyNoMoreInteractions(notificationManager);
assertThat(BuiltInQualityProfilesNotification.parse(notificationArgumentCaptor.getValue()).getProfiles())
- .extracting(Profile::getProfileName, Profile::getLanguage, Profile::getRemovedRules)
+ .extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName, Profile::getRemovedRules)
.containsExactlyInAnyOrder(expectedTuple);
}
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
verifyNoMoreInteractions(notificationManager);
assertThat(BuiltInQualityProfilesNotification.parse(notificationArgumentCaptor.getValue()).getProfiles())
- .extracting(Profile::getProfileName, Profile::getLanguage, Profile::getNewRules)
+ .extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName, Profile::getNewRules)
.containsExactlyInAnyOrder(expectedTuple1, expectedTuple2);
}
profiles.putAll(
new QProfileName(language.getKey(), profileName),
IntStream.range(0, numberOfChanges).mapToObj(i -> new ActiveRuleChange(type, ActiveRuleKey.parse("qp:repo:rule" + i))).collect(Collectors.toSet()));
- return tuple(profileName, language.getName(), numberOfChanges);
+ return tuple(profileName, language.getKey(), language.getName(), numberOfChanges);
}
private static String randomLowerCaseText() {
package org.sonar.server.qualityprofile;
+import org.junit.Before;
import org.junit.Test;
+import org.sonar.api.platform.Server;
import org.sonar.plugins.emailnotifications.api.EmailMessage;
import org.sonar.server.qualityprofile.BuiltInQualityProfilesNotification.Profile;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class BuiltInQualityProfilesNotificationTemplateTest {
- private BuiltInQualityProfilesNotificationTemplate underTest = new BuiltInQualityProfilesNotificationTemplate();
+ private Server server = mock(Server.class);
+
+ private BuiltInQualityProfilesNotificationTemplate underTest = new BuiltInQualityProfilesNotificationTemplate(server);
+
+ @Before
+ public void setUp() throws Exception {
+ when(server.getPublicRootUrl()).thenReturn("http://" + randomAlphanumeric(10));
+ }
@Test
public void notification_contains_list_of_new_rules() {
- String profileName = randomAlphanumeric(20);
- String language = randomAlphanumeric(20);
+ String profileName = newProfileName();
+ String languageKey = newLanguageKey();
+ String languageName = newLanguageName();
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName, language)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
.setNewRules(2)
.build());
EmailMessage emailMessage = underTest.format(notification.serialize());
- assertThat(emailMessage.getMessage()).isEqualTo("Built-in quality profiles have been updated:\n" +
- "\"" + profileName + "\" - " + language + "\n" +
- " 2 new rules\n" +
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.");
+ assertMessage(emailMessage,
+ profileTitleText(profileName, languageKey, languageName) +
+ " 2 new rules\n");
}
@Test
public void notification_contains_list_of_updated_rules() {
- String profileName = randomAlphanumeric(20);
- String language = randomAlphanumeric(20);
+ String profileName = newProfileName();
+ String languageKey = newLanguageKey();
+ String languageName = newLanguageName();
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName, language)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
.setUpdatedRules(2)
.build());
EmailMessage emailMessage = underTest.format(notification.serialize());
- assertThat(emailMessage.getMessage()).isEqualTo("Built-in quality profiles have been updated:\n" +
- "\"" + profileName + "\" - " + language + "\n" +
- " 2 rules have been updated\n" +
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.");
+ assertMessage(emailMessage,
+ profileTitleText(profileName, languageKey, languageName) +
+ " 2 rules have been updated\n");
}
@Test
public void notification_contains_list_of_removed_rules() {
- String profileName = randomAlphanumeric(20);
- String language = randomAlphanumeric(20);
+ String profileName = newProfileName();
+ String languageKey = newLanguageKey();
+ String languageName = newLanguageName();
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName, language)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
.setRemovedRules(2)
.build());
EmailMessage emailMessage = underTest.format(notification.serialize());
- assertThat(emailMessage.getMessage()).isEqualTo("Built-in quality profiles have been updated:\n" +
- "\"" + profileName + "\" - " + language + "\n" +
- " 2 rules removed\n" +
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.");
+ assertMessage(emailMessage,
+ profileTitleText(profileName, languageKey, languageName) +
+ " 2 rules removed\n");
}
@Test
public void notification_contains_list_of_new_updated_and_removed_rules() {
- String profileName = randomAlphanumeric(20);
- String language = randomAlphanumeric(20);
+ String profileName = newProfileName();
+ String languageKey = newLanguageKey();
+ String languageName = newLanguageName();
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName, language)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
.setNewRules(2)
.setUpdatedRules(3)
.setRemovedRules(4)
EmailMessage emailMessage = underTest.format(notification.serialize());
- assertThat(emailMessage.getMessage()).isEqualTo("Built-in quality profiles have been updated:\n" +
- "\"" + profileName + "\" - " + language + "\n" +
- " 2 new rules\n" +
- " 3 rules have been updated\n" +
- " 4 rules removed\n" +
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.");
+ assertMessage(emailMessage,
+ profileTitleText(profileName, languageKey, languageName) +
+ " 2 new rules\n" +
+ " 3 rules have been updated\n" +
+ " 4 rules removed\n");
}
@Test
public void notification_contains_many_profiles() {
String profileName1 = "profile1_" + randomAlphanumeric(20);
- String language1 = "lang1_" + randomAlphanumeric(20);
- String profileName2 = "profile1_" + randomAlphanumeric(20);
- String language2 = "lang2_" + randomAlphanumeric(20);
+ String languageKey1 = "langkey1_" + randomAlphanumeric(20);
+ String languageName1 = "langName1_" + randomAlphanumeric(20);
+ String profileName2 = "profile2_" + randomAlphanumeric(20);
+ String languageKey2 = "langkey2_" + randomAlphanumeric(20);
+ String languageName2 = "langName2_" + randomAlphanumeric(20);
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName1, language1)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName1)
+ .setLanguageKey(languageKey1)
+ .setLanguageName(languageName1)
.setNewRules(2)
.build())
- .addProfile(Profile.newBuilder(profileName2, language2)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName2)
+ .setLanguageKey(languageKey2)
+ .setLanguageName(languageName2)
.setNewRules(13)
.build());
EmailMessage emailMessage = underTest.format(notification.serialize());
- assertThat(emailMessage.getMessage()).isEqualTo("Built-in quality profiles have been updated:\n" +
- "\"" + profileName1 + "\" - " + language1 + "\n" +
- " 2 new rules\n" +
- "\"" + profileName2 + "\" - " + language2 + "\n" +
- " 13 new rules\n" +
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.");
+ assertMessage(emailMessage,
+ profileTitleText(profileName1, languageKey1, languageName1) +
+ " 2 new rules\n" +
+ profileTitleText(profileName2, languageKey2, languageName2) +
+ " 13 new rules\n");
}
@Test
public void notification_contains_profiles_sorted_by_language_then_by_profile_name() {
- String language1 = "lang1_" + randomAlphanumeric(20);
- String language2 = "lang2_" + randomAlphanumeric(20);
+ String languageKey1 = "langkey1_" + randomAlphanumeric(20);
+ String languageName1 = "langName1_" + randomAlphanumeric(20);
+ String languageKey2 = "langKey2_" + randomAlphanumeric(20);
+ String languageName2 = "langName2_" + randomAlphanumeric(20);
String profileName1 = "profile1_" + randomAlphanumeric(20);
String profileName2 = "profile2_" + randomAlphanumeric(20);
String profileName3 = "profile3_" + randomAlphanumeric(20);
BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName3, language2).build())
- .addProfile(Profile.newBuilder(profileName2, language1).build())
- .addProfile(Profile.newBuilder(profileName1, language2).build());
+ .addProfile(Profile.newBuilder().setProfileName(profileName3).setLanguageKey(languageKey2).setLanguageName(languageName2).build())
+ .addProfile(Profile.newBuilder().setProfileName(profileName2).setLanguageKey(languageKey1).setLanguageName(languageName1).build())
+ .addProfile(Profile.newBuilder().setProfileName(profileName1).setLanguageKey(languageKey2).setLanguageName(languageName2).build());
EmailMessage emailMessage = underTest.format(notification.serialize());
assertThat(emailMessage.getMessage()).containsSequence(
- "\"" + profileName2 + "\" - " + language1,
- "\"" + profileName1 + "\" - " + language2,
- "\"" + profileName3 + "\" - " + language2);
+ "\"" + profileName2 + "\" - " + languageName1,
+ "\"" + profileName1 + "\" - " + languageName2,
+ "\"" + profileName3 + "\" - " + languageName2);
+ }
+
+ @Test
+ public void notification_contains_encoded_profile_name() {
+ BuiltInQualityProfilesNotification notification = new BuiltInQualityProfilesNotification()
+ .addProfile(Profile.newBuilder()
+ .setProfileName("Sonar Way")
+ .setLanguageKey("java")
+ .setLanguageName(newLanguageName())
+ .build());
+
+ EmailMessage emailMessage = underTest.format(notification.serialize());
+
+ assertThat(emailMessage.getMessage()).contains(server.getPublicRootUrl() + "/profiles/changelog?language=java&name=Sonar+Way");
+ }
+
+ 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);
+ }
+
+ private String profileTitleText(String profileName, String languageKey, String languageName) {
+ return "\"" + profileName + "\" - " + languageName + " " + server.getPublicRootUrl() + "/profiles/changelog?language=" + languageKey + "&name=" + profileName + "\n";
+ }
+
+ private static String newProfileName() {
+ return "profileName_" + randomAlphanumeric(20);
+ }
+
+ private static String newLanguageName() {
+ return "languageName_" + randomAlphanumeric(20);
+ }
+
+ private static String newLanguageKey() {
+ return "languageKey_" + randomAlphanumeric(20);
}
}
@Test
public void serialize_and_parse_single_profile() {
String profileName = randomAlphanumeric(20);
- String language = randomAlphanumeric(20);
+ String languageKey = randomAlphanumeric(20);
+ String languageName = randomAlphanumeric(20);
Notification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName, language)
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName)
+ .setLanguageKey(languageKey)
+ .setLanguageName(languageName)
.setNewRules(3)
.setUpdatedRules(5)
.setRemovedRules(7)
.serialize();
BuiltInQualityProfilesNotification result = BuiltInQualityProfilesNotification.parse(notification);
- assertThat(result.getProfiles()).extracting(Profile::getProfileName, Profile::getLanguage, Profile::getNewRules, Profile::getUpdatedRules, Profile::getRemovedRules)
- .containsExactlyInAnyOrder(tuple(profileName, language, 3, 5, 7));
+ assertThat(result.getProfiles()).extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName,
+ Profile::getNewRules, Profile::getUpdatedRules, Profile::getRemovedRules)
+ .containsExactlyInAnyOrder(tuple(profileName, languageKey, languageName, 3, 5, 7));
}
@Test
public void serialize_and_parse_multiple_profiles() {
String profileName1 = randomAlphanumeric(20);
- String language1 = randomAlphanumeric(20);
+ String languageKey1 = randomAlphanumeric(20);
+ String languageName1 = randomAlphanumeric(20);
String profileName2 = randomAlphanumeric(20);
- String language2 = randomAlphanumeric(20);
+ String languageKey2 = randomAlphanumeric(20);
+ String languageName2 = randomAlphanumeric(20);
Notification notification = new BuiltInQualityProfilesNotification()
- .addProfile(Profile.newBuilder(profileName1, language1).build())
- .addProfile(Profile.newBuilder(profileName2, language2).build())
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName1)
+ .setLanguageKey(languageKey1)
+ .setLanguageName(languageName1)
+ .build())
+ .addProfile(Profile.newBuilder()
+ .setProfileName(profileName2)
+ .setLanguageKey(languageKey2)
+ .setLanguageName(languageName2)
+ .build())
.serialize();
BuiltInQualityProfilesNotification result = BuiltInQualityProfilesNotification.parse(notification);
- assertThat(result.getProfiles()).extracting(Profile::getProfileName, Profile::getLanguage)
- .containsExactlyInAnyOrder(tuple(profileName1, language1), tuple(profileName2, language2));
+ assertThat(result.getProfiles()).extracting(Profile::getProfileName, Profile::getLanguageKey, Profile::getLanguageName)
+ .containsExactlyInAnyOrder(tuple(profileName1, languageKey1, languageName1), tuple(profileName2, languageKey2, languageName2));
}
@Test
.addPlugin(pluginArtifact("foo-plugin-v1"))
.setServerProperty("email.smtp_host.secured", "localhost")
.setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()))
- //.setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")// FIXME remove web debugging
+ // .setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")// FIXME
+ // remove web debugging
.build();
orchestrator.start();
.addPlugin(pluginArtifact("foo-plugin-v1"))
.setServerProperty("email.smtp_host.secured", "localhost")
.setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()))
- //.setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005")// FIXME remove web debugging
+ // .setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8001")// FIXME
+ // remove web debugging
.build();
orchestrator.start();
.extracting(this::getMimeMessage)
.extracting(this::getAllRecipients)
.containsOnly("<" + profileAdmin1.getEmail() + ">", "<" + profileAdmin2.getEmail() + ">");
+ String url = orchestrator.getServer().getUrl();
assertThat(messages.get(0).getMimeMessage().getContent().toString())
.containsSequence(
"Built-in quality profiles have been updated:",
- "\"Basic\" - Foo",
+ "\"Basic\" - Foo " + url + "/profiles/changelog?language=foo&name=Basic",
" 1 new rules",
" 3 rules have been updated",
" 1 rules removed",
- "This is a good time to review your quality profiles and update them to benefit from the latest evolutions.")
+ "This is a good time to review your quality profiles and update them to benefit from the latest evolutions. " + url + "/profiles")
.isEqualTo(messages.get(1).getMimeMessage().getContent().toString());
}