Search in sources :

Example 1 with SmtpServiceInfo

use of org.springframework.cloud.service.common.SmtpServiceInfo in project spring-cloud-connectors by spring-cloud.

the class CloudFoundryConnectorSmtpServiceTest method smtpServiceCreation.

@Test
public void smtpServiceCreation() {
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getSmtpServicePayload("smtp-1", hostname, username, password)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    SmtpServiceInfo smtpServiceInfo = (SmtpServiceInfo) getServiceInfo(serviceInfos, "smtp-1");
    assertNotNull(smtpServiceInfo);
    assertEquals(hostname, smtpServiceInfo.getHost());
    assertEquals(587, smtpServiceInfo.getPort());
    assertEquals(username, smtpServiceInfo.getUserName());
    assertEquals(password, smtpServiceInfo.getPassword());
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) SmtpServiceInfo(org.springframework.cloud.service.common.SmtpServiceInfo) SmtpServiceInfo(org.springframework.cloud.service.common.SmtpServiceInfo) Test(org.junit.Test)

Example 2 with SmtpServiceInfo

use of org.springframework.cloud.service.common.SmtpServiceInfo in project spring-cloud-connectors by spring-cloud.

the class SmtpServiceConnectorCreatorTest method cloudMailSenderCreation.

@Test
public void cloudMailSenderCreation() throws Exception {
    SmtpServiceInfo serviceInfo = createServiceInfo();
    MailSender dataSource = testCreator.create(serviceInfo, null);
    assertConnectorProperties(serviceInfo, dataSource);
}
Also used : SmtpServiceInfo(org.springframework.cloud.service.common.SmtpServiceInfo) MailSender(org.springframework.mail.MailSender) Test(org.junit.Test)

Example 3 with SmtpServiceInfo

use of org.springframework.cloud.service.common.SmtpServiceInfo in project spring-cloud-connectors by spring-cloud.

the class CloudFoundryConnectorSmtpServiceTest method smtpServiceCreationWithUri.

@Test
public void smtpServiceCreationWithUri() {
    when(mockEnvironment.getEnvValue("VCAP_SERVICES")).thenReturn(getServicesPayload(getSmtpServicePayloadWithUri("smtp-1", hostname, port, username, password)));
    List<ServiceInfo> serviceInfos = testCloudConnector.getServiceInfos();
    SmtpServiceInfo smtpServiceInfo = (SmtpServiceInfo) getServiceInfo(serviceInfos, "smtp-1");
    assertNotNull(smtpServiceInfo);
    assertEquals(hostname, smtpServiceInfo.getHost());
    assertEquals(port, smtpServiceInfo.getPort());
    assertEquals(username, smtpServiceInfo.getUserName());
    assertEquals(password, smtpServiceInfo.getPassword());
}
Also used : ServiceInfo(org.springframework.cloud.service.ServiceInfo) SmtpServiceInfo(org.springframework.cloud.service.common.SmtpServiceInfo) SmtpServiceInfo(org.springframework.cloud.service.common.SmtpServiceInfo) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 SmtpServiceInfo (org.springframework.cloud.service.common.SmtpServiceInfo)3 ServiceInfo (org.springframework.cloud.service.ServiceInfo)2 MailSender (org.springframework.mail.MailSender)1