当前位置: 首页>>代码示例>>Java>>正文


Java ServerSetup类代码示例

本文整理汇总了Java中com.icegreen.greenmail.util.ServerSetup的典型用法代码示例。如果您正苦于以下问题:Java ServerSetup类的具体用法?Java ServerSetup怎么用?Java ServerSetup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerSetup类属于com.icegreen.greenmail.util包,在下文中一共展示了ServerSetup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testHealthCommand

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Test
public void testHealthCommand() {
    int smtpPort = SocketUtils.findAvailableTcpPort();
    ServerSetup setup = new ServerSetup(smtpPort, null, ServerSetup.PROTOCOL_SMTP);
    setup.setServerStartupTimeout(5000);
    GreenMail mailServer = new GreenMail(setup);
    mailServer.start();
    ((JavaMailSenderImpl) mailSender).setPort(smtpPort);
    sshCallShell((is, os) -> {
        write(os, "health");
        verifyResponse(is, "{\r\n  \"status\" : \"UP\"");
        mailServer.stop();
    });
}
 
开发者ID:anand1st,项目名称:sshd-shell-spring-boot,代码行数:15,代码来源:SshdShellAutoConfigurationTest.java

示例2: setUp

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	String mailServerHost = "127.0.0.1";
	int mailServerPort = findAvailableTcpPort();

	log.warn("Port selected: {}", mailServerPort);
	greenMail = new GreenMail(
		new ServerSetup(mailServerPort, mailServerHost, PROTOCOL_SMTP)
	);

	JavaMailSenderImpl sender = new JavaMailSenderImpl();
	sender.setHost(mailServerHost);
	sender.setPort(mailServerPort);

	htmlEmailNotificationService = new HtmlEmailNotificationService("[email protected]", sender);
	greenMail.start();
}
 
开发者ID:AppDirect,项目名称:service-integration-sdk,代码行数:18,代码来源:HtmlEmailNotificationServiceIntegrationTest.java

示例3: setup

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setup() throws Exception
{
  node = new SmtpOutputOperator();
  greenMail = new GreenMail(ServerSetupTest.ALL);
  greenMail.start();
  node.setFrom(from);
  node.setContent(content);
  node.setSmtpHost("127.0.0.1");
  node.setSmtpPort(ServerSetupTest.getPortOffset() + ServerSetup.SMTP.getPort());
  node.setSmtpUserName(from);
  node.setSmtpPassword("<password>");
  //node.setUseSsl(true);
  node.setSubject(subject);
  data = new HashMap<String, String>();
  data.put("alertkey", "alertvalue");

}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:19,代码来源:SmtpOutputOperatorTest.java

示例4: setUp

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

  OnConsoleStatusListener.addNewInstanceToContext(loggerContext);
  MDC.clear();
  ServerSetup serverSetup = new ServerSetup(port, "localhost",
          ServerSetup.PROTOCOL_SMTP);
  greenMailServer = new GreenMail(serverSetup);
  greenMailServer.start();
  // give the server a head start
  if (EnvUtilForTests.isRunningOnSlowJenkins()) {
    Thread.sleep(2000);
  } else {
    Thread.sleep(50);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:17,代码来源:SMTPAppender_GreenTest.java

示例5: setUp

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    String username = settings.getString(Mailer.Setting.mail_username, null);
    String password = settings.getString(Mailer.Setting.mail_password, null);
    int port = settings.getInteger(Mailer.Setting.mail_port, 0);
    String systemAddress = settings.getString(Mailer.Setting.mail_systemAddress, null);

    // start the test smtp server
    server = new GreenMail(new ServerSetup(port, null, ServerSetup.PROTOCOL_SMTP));
    server.setUser(systemAddress, username, password);
    server.start();

    // start the mailer service
    mailer.start();
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:17,代码来源:MailerTest.java

示例6: startGreenMail

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@BeforeAll
public static void startGreenMail() {
    Properties props = new Properties();
    try (InputStream propStream = ExceptionMapperITCase.class.getResourceAsStream("/mail.properties")) {
        props.load(propStream);
    } catch (Exception e) {
        LOG.error("Could not load /mail.properties", e);
    }

    SMTP_HOST = props.getProperty("smtpHost");
    assertNotNull(SMTP_HOST);
    SMTP_PORT = Integer.parseInt(props.getProperty("smtpPort"));
    assertNotNull(SMTP_PORT);

    ServerSetup[] config = new ServerSetup[2];
    config[0] = new ServerSetup(SMTP_PORT, SMTP_HOST, ServerSetup.PROTOCOL_SMTP);
    config[1] = new ServerSetup(POP3_PORT, POP3_HOST, ServerSetup.PROTOCOL_POP3);
    greenMail = new GreenMail(config);
    greenMail.start();
}
 
开发者ID:apache,项目名称:syncope,代码行数:21,代码来源:AbstractNotificationTaskITCase.java

示例7: sendMail

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
private void sendMail(final String to,
                      final String from,
                      final String subject,
                      final String msg,
                      final ServerSetup serverSetup) throws MessagingException {
    final Session session = GreenMailUtil.getSession(serverSetup);
    final MimeMessage textEmail = GreenMailUtil.createTextEmail(to, from, subject, msg, serverSetup);
    final Transport transport = session.getTransport(serverSetup.getProtocol());
    transport.connect();
    transport.sendMessage(textEmail, new Address[] {new InternetAddress(to)});
    try {
        transport.close();
    } catch (final MessagingException e) {
        //ignore
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:17,代码来源:ConcurrentCloseIT.java

示例8: createServerSetup

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
/**
 * Creates the server setup, depending on the protocol flags.
 *
 * @return the configured server setups.
 */
private ServerSetup[] createServerSetup() {
    List<ServerSetup> setups = new ArrayList<>();
    if (smtpProtocol) {
        smtpServerSetup = createTestServerSetup(ServerSetup.SMTP);
        setups.add(smtpServerSetup);
    }
    if (smtpsProtocol) {
        smtpsServerSetup = createTestServerSetup(ServerSetup.SMTPS);
        setups.add(smtpsServerSetup);
    }
    if (pop3Protocol) {
        setups.add(createTestServerSetup(ServerSetup.POP3));
    }
    if (pop3sProtocol) {
        setups.add(createTestServerSetup(ServerSetup.POP3S));
    }
    if (imapProtocol) {
        setups.add(createTestServerSetup(ServerSetup.IMAP));
    }
    if (imapsProtocol) {
        setups.add(createTestServerSetup(ServerSetup.IMAPS));
    }
    return setups.toArray(new ServerSetup[setups.size()]);
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:30,代码来源:GreenMailBean.java

示例9: testAllServices

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Test
public void testAllServices() throws MessagingException {
    // Send messages via SMTP and secure SMTPS
    GreenMailUtil.sendTextEmail("[email protected]", "[email protected]",
            "test1", "Test GreenMail Docker service",
            ServerSetupTest.SMTP.createCopy(bindAddress));
    GreenMailUtil.sendTextEmail("[email protected]", "[email protected]",
            "test2", "Test GreenMail Docker service",
            ServerSetupTest.SMTPS.createCopy(bindAddress));

    // IMAP
    for (ServerSetup setup : Arrays.asList(
            ServerSetupTest.IMAP.createCopy(bindAddress),
            ServerSetupTest.IMAPS.createCopy(bindAddress),
            ServerSetupTest.POP3.createCopy(bindAddress),
            ServerSetupTest.POP3S.createCopy(bindAddress))) {
        final Store store = Session.getInstance(setup.configureJavaMailSessionProperties(null, false)).getStore();
        store.connect("[email protected]", "[email protected]");
        try {
            Folder folder = store.getFolder("INBOX");
            folder.open(Folder.READ_ONLY);
            assertEquals("Can not check mails using "+store.getURLName(), 2, folder.getMessageCount());
        } finally {
            store.close();
        }
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:28,代码来源:DockerServiceIT.java

示例10: setUp

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setUp() throws MessagingException, UserException, InterruptedException {
    ServerSetup sS = new ServerSetup(4008, "localhost", ServerSetup.PROTOCOL_IMAPS);
    greenMail = new GreenMail(sS);
    greenMail.start();
    user = greenMail.setUser("[email protected]", "okkopa", "soooosecret");
    Properties props = System.getProperties();
    props.setProperty("mail.store.protocol", "imaps");
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setSubject("subject2576Hf");
    message.setText("viesti");
    user.deliver(message);

    Security.setProperty("ssl.SocketFactory.provider", DummySSLSocketFactory.class.getName());

    server = new IMAPserver("localhost", "okkopa", "soooosecret", 4008);
    server.login();

    IMAPfolder = new IMAPfolder(server, "inbox");

    assertTrue(greenMail.waitForIncomingEmail(5000, 1));

}
 
开发者ID:ohtuprojekti,项目名称:OKKoPa,代码行数:25,代码来源:IMAPfolderTest.java

示例11: setUp

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    ServerSetup sS = new ServerSetup(4008, "localhost", ServerSetup.PROTOCOL_IMAPS);
    greenMail = new GreenMail(sS);
    greenMail.start();
    user = greenMail.setUser("[email protected]", "okkopa", "soooosecret");
    Properties props = System.getProperties();
    props.setProperty("mail.store.protocol", "imaps");
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setSubject("subject2576Hf");
    message.setText("viesti");
    user.deliver(message);

    Security.setProperty("ssl.SocketFactory.provider", DummySSLSocketFactory.class.getName());

    assertTrue(greenMail.waitForIncomingEmail(5000, 1));
}
 
开发者ID:ohtuprojekti,项目名称:OKKoPa,代码行数:19,代码来源:IMAPserverTest.java

示例12: setUp

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
@Before
public void setUp() throws MessagingException, UserException, InterruptedException {
    Security.setProperty("ssl.SocketFactory.provider", DummySSLSocketFactory.class.getName());

    ServerSetup sS = new ServerSetup(4008, "localhost", ServerSetup.PROTOCOL_IMAPS);
    greenMail = new GreenMail(sS);
    greenMail.start();
    user = greenMail.setUser("[email protected]", "okkopa", "soooosecret");
    Properties props = System.getProperties();
    props.setProperty("mail.store.protocol", "imaps");
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setSubject("subject2576Hf");
    message.setText("viesti");
    user.deliver(message);

    assertTrue(greenMail.waitForIncomingEmail(5000, 1));

    server = new IMAPserver("localhost", "okkopa", "soooosecret", 4008);
    server.login();

    IMAPfolder = new IMAPfolder(server, "inbox");
}
 
开发者ID:ohtuprojekti,项目名称:OKKoPa,代码行数:24,代码来源:IMAPmessageTest.java

示例13: AbstractServer

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
protected AbstractServer(ServerSetup setup, Managers managers) {
    try {
        this.setup = setup;
        bindTo = InetAddress.getByName(setup.getBindAddress());
    } catch (UnknownHostException e) {
        throw new RuntimeException(e);
    }
    this.managers = managers;
    handlers = new Vector();
}
 
开发者ID:Alfresco,项目名称:alfresco-greenmail,代码行数:11,代码来源:AbstractServer.java

示例14: getPop3SslProperties

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
public static Properties getPop3SslProperties() {
    SimplifiedProperties props = new SimplifiedProperties();
    props.set(EmailProperty.MAIL_STORE_PROTOCOL, ServerSetup.PROTOCOL_POP3S);
    props.set(EmailProperty.MAIL_POP3S_HOST, getTestPop3SslHost());
    props.set(EmailProperty.MAIL_POP3S_PORT, getTestPop3SslPort());
    props.set(EmailProperty.MAIL_POP3S_SOCKETFACTORY_CLASS, getSslSocketFactory());
    props.set(EmailProperty.MAIL_POP3S_SOCKETFACTORY_PORT, getTestPop3SslPort());
    props.set(EmailProperty.MAIL_POP3S_SOCKETFACTORY_FALLBACK, false);
    props.setDefault(EmailProperty.MAIL_POP3S_SSL_TRUST);
    props.set(EmailProperty.MAIL_POP3S_AUTH, true);
    return props;
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:13,代码来源:PropertyAccessor.java

示例15: getPop3Properties

import com.icegreen.greenmail.util.ServerSetup; //导入依赖的package包/类
public static Properties getPop3Properties() {
    SimplifiedProperties props = new SimplifiedProperties();
    props.set(EmailProperty.MAIL_STORE_PROTOCOL, ServerSetup.PROTOCOL_POP3);
    props.set(EmailProperty.MAIL_POP3_HOST, getTestPop3Host());
    props.set(EmailProperty.MAIL_POP3_PORT, getTestPop3Port());
    props.set(EmailProperty.MAIL_POP3_AUTH, true);
    return props;
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:9,代码来源:PropertyAccessor.java


注:本文中的com.icegreen.greenmail.util.ServerSetup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。