use of org.springframework.mail.javamail.JavaMailSenderImpl in project spring-cloud-connectors by spring-cloud.
the class SmtpServiceConnectorCreatorTest method assertConnectorProperties.
private void assertConnectorProperties(SmtpServiceInfo serviceInfo, MailSender connector) {
assertNotNull(connector);
JavaMailSenderImpl javaMailSender = (JavaMailSenderImpl) connector;
assertEquals(serviceInfo.getHost(), javaMailSender.getHost());
assertEquals(serviceInfo.getPort(), javaMailSender.getPort());
assertEquals(serviceInfo.getUserName(), javaMailSender.getUsername());
assertEquals(serviceInfo.getPassword(), javaMailSender.getPassword());
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project spring-boot by spring-projects.
the class MailSenderAutoConfigurationTests method mailSenderBackOff.
@Test
public void mailSenderBackOff() {
load(ManualMailConfiguration.class, "spring.mail.host:smtp.acme.org", "spring.mail.user:user", "spring.mail.password:secret");
JavaMailSenderImpl bean = (JavaMailSenderImpl) this.context.getBean(JavaMailSender.class);
assertThat(bean.getUsername()).isNull();
assertThat(bean.getPassword()).isNull();
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project spring-boot by spring-projects.
the class MailSenderAutoConfigurationTests method connectionOnStartup.
@Test
public void connectionOnStartup() throws MessagingException {
load(MockMailConfiguration.class, "spring.mail.host:10.0.0.23", "spring.mail.test-connection:true");
JavaMailSenderImpl mailSender = this.context.getBean(JavaMailSenderImpl.class);
verify(mailSender, times(1)).testConnection();
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project spring-boot by spring-projects.
the class MailSenderAutoConfigurationTests method smtpHostSet.
@Test
public void smtpHostSet() {
String host = "192.168.1.234";
load(EmptyConfig.class, "spring.mail.host:" + host);
JavaMailSenderImpl bean = (JavaMailSenderImpl) this.context.getBean(JavaMailSender.class);
assertThat(bean.getHost()).isEqualTo(host);
assertThat(bean.getPort()).isEqualTo(JavaMailSenderImpl.DEFAULT_PORT);
assertThat(bean.getProtocol()).isEqualTo(JavaMailSenderImpl.DEFAULT_PROTOCOL);
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project spring-boot by spring-projects.
the class MailSenderAutoConfigurationTests method smtpHostWithSettings.
@Test
public void smtpHostWithSettings() {
String host = "192.168.1.234";
load(EmptyConfig.class, "spring.mail.host:" + host, "spring.mail.port:42", "spring.mail.username:john", "spring.mail.password:secret", "spring.mail.default-encoding:US-ASCII", "spring.mail.protocol:smtps");
JavaMailSenderImpl bean = (JavaMailSenderImpl) this.context.getBean(JavaMailSender.class);
assertThat(bean.getHost()).isEqualTo(host);
assertThat(bean.getPort()).isEqualTo(42);
assertThat(bean.getUsername()).isEqualTo("john");
assertThat(bean.getPassword()).isEqualTo("secret");
assertThat(bean.getDefaultEncoding()).isEqualTo("US-ASCII");
assertThat(bean.getProtocol()).isEqualTo("smtps");
}
Aggregations