Search in sources :

Example 11 with ServerSetup

use of com.icegreen.greenmail.util.ServerSetup in project xwiki-platform by xwiki.

the class AbstractMailIntegrationTest method getCustomServerSetup.

protected ServerSetup getCustomServerSetup(ServerSetup setup) {
    // Increase startup timeout (default is 1s, which can be too fast on slow CI agents).
    ServerSetup newSetup = setup.createCopy();
    newSetup.setServerStartupTimeout(5000L);
    return newSetup;
}
Also used : ServerSetup(com.icegreen.greenmail.util.ServerSetup)

Example 12 with ServerSetup

use of com.icegreen.greenmail.util.ServerSetup in project cloudbreak by hortonworks.

the class EmailSenderHostServiceTypeTest method before.

@Before
public void before() throws IOException, TemplateException {
    greenMail = new GreenMail(new ServerSetup(3465, null, ServerSetup.PROTOCOL_SMTP));
    greenMail.setUser("demouser", "demopwd");
    greenMail.start();
    IdentityUser identityUser = new IdentityUser("sdf", "testuser", "testaccount", new ArrayList<>(), "familyname", "givenName", new Date());
    ReflectionTestUtils.setField(emailSenderService, "freemarkerConfiguration", freemarkerConfiguration());
    ReflectionTestUtils.setField(emailSenderService, "successClusterMailTemplatePath", "templates/cluster-installer-mail-success.ftl");
    ReflectionTestUtils.setField(emailSenderService, "failedClusterMailTemplatePath", "templates/cluster-installer-mail-fail.ftl");
    JavaMailSender mailSender = new JavaMailSenderImpl();
    ((JavaMailSenderImpl) mailSender).setHost("localhost");
    ((JavaMailSenderImpl) mailSender).setPort(3465);
    ((JavaMailSenderImpl) mailSender).setUsername("demouser2");
    ((JavaMailSenderImpl) mailSender).setPassword("demopwd2");
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.auth", false);
    props.put("mail.smtp.starttls.enable", false);
    props.put("mail.debug", false);
    ((JavaMailSenderImpl) mailSender).setJavaMailProperties(props);
    ReflectionTestUtils.setField(emailSenderService, "mailSender", mailSender);
    EmailMimeMessagePreparator mmp = new EmailMimeMessagePreparator();
    ReflectionTestUtils.setField(mmp, "msgFrom", "no-reply@hortonworks.com");
    ReflectionTestUtils.setField(emailSenderService, "emailMimeMessagePreparator", mmp);
    when(userDetailsService.getDetails(anyString(), any(UserFilterField.class))).thenReturn(identityUser);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) JavaMailSenderImpl(org.springframework.mail.javamail.JavaMailSenderImpl) UserFilterField(com.sequenceiq.cloudbreak.common.service.user.UserFilterField) GreenMail(com.icegreen.greenmail.util.GreenMail) ServerSetup(com.icegreen.greenmail.util.ServerSetup) JavaMailSender(org.springframework.mail.javamail.JavaMailSender) Properties(java.util.Properties) Date(java.util.Date) Before(org.junit.Before)

Example 13 with ServerSetup

use of com.icegreen.greenmail.util.ServerSetup in project ninja by ninjaframework.

the class CommonsMailHelperImplGreenmailIntegrationTest method setUp.

@Before
public final void setUp() {
    SMTP_TEST_PORT = findAvailablePort(2000, 10000);
    greenMail = new GreenMail(new ServerSetup(SMTP_TEST_PORT, null, "smtp"));
    greenMail.start();
}
Also used : GreenMail(com.icegreen.greenmail.util.GreenMail) ServerSetup(com.icegreen.greenmail.util.ServerSetup) Before(org.junit.Before)

Example 14 with ServerSetup

use of com.icegreen.greenmail.util.ServerSetup in project c4sg-services by Code4SocialGood.

the class EmailServiceTest method setUp.

@Before
public void setUp() {
    mailer = new GreenMail(new ServerSetup(8825, null, "smtp"));
    mailer.start();
}
Also used : GreenMail(com.icegreen.greenmail.util.GreenMail) ServerSetup(com.icegreen.greenmail.util.ServerSetup) Before(org.junit.Before)

Aggregations

ServerSetup (com.icegreen.greenmail.util.ServerSetup)14 GreenMail (com.icegreen.greenmail.util.GreenMail)10 Before (org.junit.Before)5 Properties (java.util.Properties)2 BeforeClass (org.testng.annotations.BeforeClass)2 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)1 UserFilterField (com.sequenceiq.cloudbreak.common.service.user.UserFilterField)1 InputStream (java.io.InputStream)1 InetSocketAddress (java.net.InetSocketAddress)1 Date (java.util.Date)1 MimeMessage (javax.mail.internet.MimeMessage)1 Setup (org.apache.axis2.transport.testkit.tests.Setup)1 Tunnel (org.apache.axis2.transport.testkit.util.tcpmon.Tunnel)1 Services (org.apache.oozie.service.Services)1 SLAEmailEventListener (org.apache.oozie.sla.listener.SLAEmailEventListener)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 JavaMailSender (org.springframework.mail.javamail.JavaMailSender)1 JavaMailSenderImpl (org.springframework.mail.javamail.JavaMailSenderImpl)1