本文整理匯總了Java中com.icegreen.greenmail.util.GreenMail.reset方法的典型用法代碼示例。如果您正苦於以下問題:Java GreenMail.reset方法的具體用法?Java GreenMail.reset怎麽用?Java GreenMail.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.icegreen.greenmail.util.GreenMail
的用法示例。
在下文中一共展示了GreenMail.reset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testPipelineStoppedWithMail
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@Test(timeout = 20000)
public void testPipelineStoppedWithMail() throws Exception {
Runner runner = pipelineManager.getRunner( TestUtil.PIPELINE_WITH_EMAIL, "0");
runner.start("admin");
waitForState(runner, PipelineStatus.RUNNING);
((AsyncRunner)runner).getRunner().prepareForStop("admin");
((AsyncRunner)runner).getRunner().stop("admin");
waitForState(runner, PipelineStatus.STOPPED);
//wait for email
GreenMail mailServer = TestUtil.TestRuntimeModule.getMailServer();
while(mailServer.getReceivedMessages().length < 1) {
ThreadUtil.sleep(100);
}
String headers = GreenMailUtil.getHeaders(mailServer.getReceivedMessages()[0]);
Assert.assertTrue(headers.contains("To: foo, bar"));
Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - " +
TestUtil.PIPELINE_TITLE_WITH_EMAIL + " - STOPPED"));
Assert.assertTrue(headers.contains("From: [email protected]"));
Assert.assertNotNull(GreenMailUtil.getBody(mailServer.getReceivedMessages()[0]));
mailServer.reset();
}
示例2: testPipelineFinishWithMail
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@Test(timeout = 20000)
public void testPipelineFinishWithMail() throws Exception {
Runner runner = pipelineManager.getRunner( TestUtil.PIPELINE_WITH_EMAIL, "0");
runner.start("admin");
waitForState(runner, PipelineStatus.RUNNING);
assertNull(runner.getState().getMetrics());
TestUtil.EMPTY_OFFSET = true;
waitForState(runner, PipelineStatus.FINISHED);
assertNotNull(runner.getState().getMetrics());
//wait for email
GreenMail mailServer = TestUtil.TestRuntimeModule.getMailServer();
while(mailServer.getReceivedMessages().length < 1) {
ThreadUtil.sleep(100);
}
String headers = GreenMailUtil.getHeaders(mailServer.getReceivedMessages()[0]);
Assert.assertTrue(headers.contains("To: foo, bar"));
Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - " +
TestUtil.PIPELINE_TITLE_WITH_EMAIL + " - FINISHED"));
Assert.assertTrue(headers.contains("From: [email protected]"));
Assert.assertNotNull(GreenMailUtil.getBody(mailServer.getReceivedMessages()[0]));
mailServer.reset();
}
示例3: testStartStop
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
@Test
public void testStartStop() {
GreenMail service = new GreenMail(ServerSetupTest.ALL);
try {
// Try to stop before start: Nothing happens
service.stop();
service.start();
service.stop();
// Now the server is stopped, should be started by reset command
service.reset();
// Start again
service.reset();
} finally {
// And finally stop
service.stop();
}
}
示例4: waitForEmailAndExtractUrl
import com.icegreen.greenmail.util.GreenMail; //導入方法依賴的package包/類
public static String waitForEmailAndExtractUrl(GreenMail smtpServer) throws IOException, MessagingException {
smtpServer.waitForIncomingEmail(1);
Message[] messages = smtpServer.getReceivedMessages();
smtpServer.reset();
assertEquals(1, messages.length);
return extractUrlFromMail(messages[0]);
}