Search in sources :

Example 26 with Wiser

use of org.subethamail.wiser.Wiser in project Activiti by Activiti.

the class EmailServiceTaskTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    wiser = new Wiser();
    wiser.setPort(5025);
    wiser.start();
}
Also used : Wiser(org.subethamail.wiser.Wiser)

Example 27 with Wiser

use of org.subethamail.wiser.Wiser in project Activiti by Activiti.

the class EmailSendTaskTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    boolean serverUpAndRunning = false;
    while (!serverUpAndRunning) {
        wiser = new Wiser();
        wiser.setPort(5025);
        try {
            wiser.start();
            serverUpAndRunning = true;
        } catch (RuntimeException e) {
            // Fix for slow port-closing Jenkins
            if (e.getMessage().toLowerCase().contains("BindException")) {
                Thread.sleep(250L);
            }
        }
    }
}
Also used : Wiser(org.subethamail.wiser.Wiser)

Example 28 with Wiser

use of org.subethamail.wiser.Wiser in project sonarqube by SonarSource.

the class IssueNotificationsTest method before.

@BeforeClass
public static void before() throws Exception {
    smtpServer = new Wiser(0);
    smtpServer.start();
    System.out.println("SMTP Server port: " + smtpServer.getServer().getPort());
    // Configure Sonar
    resetEmailSettings(ORCHESTRATOR);
    setServerProperty(ORCHESTRATOR, "email.smtp_host.secured", "localhost");
    setServerProperty(ORCHESTRATOR, "email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()));
    // Send test email to the test user
    newAdminWsClient(ORCHESTRATOR).wsConnector().call(new PostRequest("api/emails/send").setParam("to", USER_EMAIL).setParam("message", "This is a test message from SonarQube")).failIfNotSuccessful();
    // We need to wait until all notifications will be delivered
    waitUntilAllNotificationsAreDelivered(1);
    Iterator<WiserMessage> emails = smtpServer.getMessages().iterator();
    MimeMessage message = emails.next().getMimeMessage();
    assertThat(message.getHeader("To", null)).isEqualTo("<" + USER_EMAIL + ">");
    assertThat((String) message.getContent()).contains("This is a test message from SonarQube");
    assertThat(emails.hasNext()).isFalse();
}
Also used : PostRequest(org.sonarqube.ws.client.PostRequest) Wiser(org.subethamail.wiser.Wiser) MimeMessage(javax.mail.internet.MimeMessage) WiserMessage(org.subethamail.wiser.WiserMessage) BeforeClass(org.junit.BeforeClass)

Example 29 with Wiser

use of org.subethamail.wiser.Wiser in project sonarqube by SonarSource.

the class QualityGateNotificationTest method init.

@BeforeClass
public static void init() throws Exception {
    DEFAULT_QUALITY_GATE = qgClient().list().defaultGate().id();
    setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis");
    resetEmailSettings(orchestrator);
    smtpServer = new Wiser(0);
    smtpServer.start();
}
Also used : Wiser(org.subethamail.wiser.Wiser) BeforeClass(org.junit.BeforeClass)

Example 30 with Wiser

use of org.subethamail.wiser.Wiser in project sling by apache.

the class WiserSmtpService method activate.

@Activate
public void activate(final WiserSmtpServiceConfiguration configuration) throws Exception {
    wiser = new Wiser(configuration.smtpPort());
    wiser.start();
}
Also used : Wiser(org.subethamail.wiser.Wiser) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Wiser (org.subethamail.wiser.Wiser)43 MailMessageImpl (com.outjected.email.impl.MailMessageImpl)21 Test (org.junit.Test)21 SessionConfig (com.outjected.email.api.SessionConfig)20 MimeMessage (javax.mail.internet.MimeMessage)18 EmailMessage (com.outjected.email.api.EmailMessage)17 BodyPart (javax.mail.BodyPart)15 MimeMultipart (javax.mail.internet.MimeMultipart)15 Before (org.junit.Before)9 URLAttachment (com.outjected.email.impl.attachments.URLAttachment)8 FreeMarkerTemplate (com.outjected.email.impl.templating.freemarker.FreeMarkerTemplate)6 VelocityTemplate (com.outjected.email.impl.templating.velocity.VelocityTemplate)6 BeforeClass (org.junit.BeforeClass)4 ChainedProperties (org.kie.internal.utils.ChainedProperties)4 SMTPAuthenticator (com.outjected.email.util.SMTPAuthenticator)2 File (java.io.File)2 EasyAuthenticationHandlerFactory (org.subethamail.smtp.auth.EasyAuthenticationHandlerFactory)2 SimpleMailConfig (com.outjected.email.impl.SimpleMailConfig)1 PortalContainer (org.exoplatform.container.PortalContainer)1 DefaultUserInfo (org.jbpm.services.task.identity.DefaultUserInfo)1