}
private void configureSecureConnection(Email email) {
- if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "ssl")) {
+ if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "SSLTLS")) {
email.setSSLOnConnect(true);
email.setSSLCheckServerIdentity(true);
email.setSslSmtpPort(String.valueOf(configuration.getSmtpPort()));
// this port is not used except in EmailException message, that's why it's set with the same value than SSL port.
// It prevents from getting bad message.
email.setSmtpPort(configuration.getSmtpPort());
- } else if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "starttls")) {
+ } else if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "STARTTLS")) {
email.setStartTLSEnabled(true);
email.setStartTLSRequired(true);
email.setSSLCheckServerIdentity(true);
email.setSmtpPort(configuration.getSmtpPort());
- } else if (StringUtils.isBlank(configuration.getSecureConnection())) {
+ } else if (StringUtils.equalsIgnoreCase(configuration.getSecureConnection(), "NONE")) {
email.setSmtpPort(configuration.getSmtpPort());
} else {
throw new SonarException("Unknown type of SMTP secure connection: " + configuration.getSecureConnection());
private void configure() {
when(configuration.getSmtpHost()).thenReturn("localhost");
when(configuration.getSmtpPort()).thenReturn(smtpServer.getServer().getPort());
+ when(configuration.getSecureConnection()).thenReturn("NONE");
when(configuration.getFrom()).thenReturn("server@nowhere");
when(configuration.getFromName()).thenReturn("SonarQube from NoWhere");
when(configuration.getPrefix()).thenReturn(SUBJECT_PREFIX);
private String oauthClientSecret;
private String oauthTenant;
- private EmailConfigurationBuilder() {
- }
-
public static EmailConfigurationBuilder builder() {
return new EmailConfigurationBuilder();
}
+ private EmailConfigurationBuilder() {
+ }
+
public EmailConfigurationBuilder id(String id) {
this.id = id;
return this;
import org.sonarqube.ws.client.developers.DevelopersService;
import org.sonarqube.ws.client.duplications.DuplicationsService;
import org.sonarqube.ws.client.editions.EditionsService;
+import org.sonarqube.ws.client.emails.EmailConfigurationService;
import org.sonarqube.ws.client.emails.EmailsService;
import org.sonarqube.ws.client.favorites.FavoritesService;
import org.sonarqube.ws.client.github.configuration.GithubConfigurationService;
private final DevelopersService developersService;
private final DuplicationsService duplicationsService;
private final EditionsService editionsService;
+ private final EmailConfigurationService emailConfigurationService;
private final EmailsService emailsService;
private final FavoritesService favoritesService;
private final GovernanceReportsService governanceReportsService;
this.developersService = new DevelopersService(wsConnector);
this.duplicationsService = new DuplicationsService(wsConnector);
this.editionsService = new EditionsService(wsConnector);
+ this.emailConfigurationService = new EmailConfigurationService(wsConnector);
this.emailsService = new EmailsService(wsConnector);
this.favoritesService = new FavoritesService(wsConnector);
this.governanceReportsService = new GovernanceReportsService(wsConnector);
return editionsService;
}
+ @Override
+ public EmailConfigurationService emailConfiguration() {
+ return emailConfigurationService;
+ }
+
@Override
public EmailsService emails() {
return emailsService;
import org.sonarqube.ws.client.developers.DevelopersService;
import org.sonarqube.ws.client.duplications.DuplicationsService;
import org.sonarqube.ws.client.editions.EditionsService;
+import org.sonarqube.ws.client.emails.EmailConfigurationService;
import org.sonarqube.ws.client.emails.EmailsService;
import org.sonarqube.ws.client.favorites.FavoritesService;
import org.sonarqube.ws.client.github.configuration.GithubConfigurationService;
EditionsService editions();
+ EmailConfigurationService emailConfiguration();
+
EmailsService emails();
FavoritesService favorites();