本文整理匯總了Java中com.icegreen.greenmail.util.GreenMail.start方法的典型用法代碼示例。如果您正苦於以下問題:Java GreenMail.start方法的具體用法?Java GreenMail.start怎麽用?Java GreenMail.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.icegreen.greenmail.util.GreenMail
的用法示例。
在下文中一共展示了GreenMail.start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testHealthCommand
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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();
});
}
示例2: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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.GreenMail; //導入方法依賴的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");
}
示例4: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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);
}
}
示例5: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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();
}
示例6: startGreenMail
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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();
}
示例7: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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));
}
示例8: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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));
}
示例9: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的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");
}
示例10: startGreenMailServers
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
private GreenMail startGreenMailServers() {
ServerSetup[] serverSetups = getServerSetups();
GreenMail greenMail = new GreenMail(serverSetups);
greenMail.setUser(PropertyAccessor.getTestMailBoxLogin(), PropertyAccessor.getTestMailBoxPass());
greenMail.start();
return greenMail;
}
示例11: testStatusCommand
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@Test
public void testStatusCommand() {
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, "status");
verifyResponse(is, "{\r\n \"status\" : \"UP\"\r\n}");
mailServer.stop();
});
}
示例12: setupControllerTest
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@BeforeClass
protected void setupControllerTest() {
greenMail = new GreenMail(
new ServerSetup[] {
new ServerSetup(30000, "127.0.0.1", ServerSetup.PROTOCOL_SMTP)
}
);
greenMail.start();
}
示例13: setupEmailTest
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@BeforeClass
protected void setupEmailTest() {
greenMail = new GreenMail(
new ServerSetup[] {
new ServerSetup(30000, "127.0.0.1", ServerSetup.PROTOCOL_SMTP)
}
);
greenMail.start();
}
示例14: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@BeforeClass
public static void setUp() throws Exception {
ServerSetup serverSetup = new ServerSetup(30993, "localhost", "imap");
greenMail = new GreenMail(serverSetup);
GreenMailUser user = greenMail.setUser("[email protected]", "[email protected]", "password");
inbox = greenMail.getManagers().getImapHostManager().getInbox(user);
greenMail.start();
}
示例15: setUp
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
when(templateService.mergeTemplateIntoString(anyString(), any(Map.class)))
.thenReturn("<!doctype html>\n" +
"<html>\n" +
"<body>\n" +
"<p>\n" +
" THIS IS A TEST WITH TEMPLATE\n" +
"</p>\n" +
"</body>\n" +
"</html>");
ServerSetup serverSetup = new ServerSetup(MAIL_PORT, (String) null, "smtp");
testSmtp = new GreenMail(serverSetup);
testSmtp.start();
//don't forget to set the test port!
((JavaMailSenderImpl) javaMailSender).setPort(serverSetup.getPort());
((JavaMailSenderImpl) javaMailSender).setHost("localhost");
}