當前位置: 首頁>>代碼示例>>Java>>正文


Java GreenMail.reset方法代碼示例

本文整理匯總了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();
}
 
開發者ID:streamsets,項目名稱:datacollector,代碼行數:23,代碼來源:TestStandaloneRunner.java

示例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();
}
 
開發者ID:streamsets,項目名稱:datacollector,代碼行數:24,代碼來源:TestStandaloneRunner.java

示例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();
    }
}
 
開發者ID:greenmail-mail-test,項目名稱:greenmail,代碼行數:18,代碼來源:ServerStartStopTest.java

示例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]);
}
 
開發者ID:oojorgeoo89,項目名稱:QuizZz,代碼行數:9,代碼來源:MailHelper.java


注:本文中的com.icegreen.greenmail.util.GreenMail.reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。