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


Java GreenMailUtil.getHeaders方法代码示例

本文整理汇总了Java中com.icegreen.greenmail.util.GreenMailUtil.getHeaders方法的典型用法代码示例。如果您正苦于以下问题:Java GreenMailUtil.getHeaders方法的具体用法?Java GreenMailUtil.getHeaders怎么用?Java GreenMailUtil.getHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.icegreen.greenmail.util.GreenMailUtil的用法示例。


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

示例1: testEmailNotifierRunError

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testEmailNotifierRunError() throws Exception {

  EmailNotifier emailNotifier = new EmailNotifier("x", "x", "0", runtimeInfo, emailSender, ImmutableList.of("foo", "bar"),
    ImmutableSet.of("RUN_ERROR"));

  PipelineState runningState = new PipelineStateImpl("x", "x", "0", PipelineStatus.RUNNING, "Running",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  PipelineState runErrorState = new PipelineStateImpl("x", "x", "0", PipelineStatus.RUN_ERROR, "Run Error",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  emailNotifier.onStateChange(runningState, runErrorState, "", null, null);

  String headers = GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers != null);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - x - ERROR"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertNotNull(GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:TestEmailNotifier.java

示例2: testEmailNotifierStartError

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testEmailNotifierStartError() throws Exception {

  EmailNotifier emailNotifier = new EmailNotifier("x", "x","0", runtimeInfo, emailSender, ImmutableList.of("foo", "bar")
    , ImmutableSet.of("START_ERROR"));

  PipelineState startingState = new PipelineStateImpl("x", "x", "0", PipelineStatus.STARTING, "Starting",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  PipelineState startErrorState = new PipelineStateImpl("x", "x", "0", PipelineStatus.START_ERROR, "Start Error",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  emailNotifier.onStateChange(startingState, startErrorState, "", null, null);

  String headers = GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers != null);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - x - ERROR"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertNotNull(GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:TestEmailNotifier.java

示例3: testEmailNotifierFinished

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testEmailNotifierFinished() throws Exception {

  EmailNotifier emailNotifier = new EmailNotifier("x", "x","0", runtimeInfo, emailSender, ImmutableList.of("foo", "bar"),
    ImmutableSet.of("FINISHED"));

  PipelineState runningState = new PipelineStateImpl("x", "x", "0", PipelineStatus.RUNNING, "Running",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  PipelineState finishedState = new PipelineStateImpl("x", "x", "0", PipelineStatus.FINISHED, "Finished",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  emailNotifier.onStateChange(runningState, finishedState, "", null, null);

  String headers = GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers != null);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - x - FINISHED"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertNotNull(GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:TestEmailNotifier.java

示例4: testEmailNotifierStopped

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testEmailNotifierStopped() throws Exception {

  EmailNotifier emailNotifier = new EmailNotifier("x", "x","0", runtimeInfo, emailSender, ImmutableList.of("foo", "bar"),
    ImmutableSet.of("STOPPED"));

  PipelineState stoppingState = new PipelineStateImpl("x", "x", "0", PipelineStatus.STOPPING, "Stopping",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  PipelineState stoppedState = new PipelineStateImpl("x", "x", "0", PipelineStatus.STOPPED, "Stopped",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  emailNotifier.onStateChange(stoppingState, stoppedState, "", null, null);

  String headers = GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers != null);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - x - STOPPED"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertNotNull(GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:TestEmailNotifier.java

示例5: testEmailNotifierDisconnected

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testEmailNotifierDisconnected() throws Exception {

  EmailNotifier emailNotifier = new EmailNotifier("x", "x","0", runtimeInfo, emailSender, ImmutableList.of("foo", "bar"),
    ImmutableSet.of("DISCONNECTED"));

  PipelineState disconnectingState = new PipelineStateImpl("x", "x", "0", PipelineStatus.DISCONNECTING, "Disconnecting",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  PipelineState disconnectedState = new PipelineStateImpl("x", "x", "0", PipelineStatus.DISCONNECTED, "Disconnected",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  emailNotifier.onStateChange(disconnectingState, disconnectedState, "", null, null);

  String headers = GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers != null);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - x - DISCONNECTED"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertNotNull(GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:TestEmailNotifier.java

示例6: testEmailNotifierConnecting

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testEmailNotifierConnecting() throws Exception {

  EmailNotifier emailNotifier = new EmailNotifier("x", "x","0", runtimeInfo, emailSender, ImmutableList.of("foo", "bar"),
    ImmutableSet.of("CONNECTING"));

  PipelineState disconnectedState = new PipelineStateImpl("x", "x", "0", PipelineStatus.DISCONNECTED, "Disconnected",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  PipelineState connectingState = new PipelineStateImpl("x", "x", "0", PipelineStatus.CONNECTING, "Connecting",
    System.currentTimeMillis(), new HashMap<String, Object>(), ExecutionMode.STANDALONE, "", 0, 0);
  emailNotifier.onStateChange(disconnectedState, connectingState, "", null, null);

  String headers = GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers != null);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: StreamsSets Data Collector Alert - x - CONNECTING"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertNotNull(GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:TestEmailNotifier.java

示例7: testPipelineStoppedWithMail

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的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

示例8: testPipelineFinishWithMail

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的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

示例9: testSendEmailNoAuth

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Test
public void testSendEmailNoAuth() throws Exception {
  Configuration conf = new Configuration();
  conf.set("mail.smtp.host", "localhost");
  conf.set("mail.smtp.port", Integer.toString(server.getSmtp().getPort()));
  EmailSender sender = new EmailSender(conf);
  sender.send(ImmutableList.of("foo", "bar"), "SUBJECT", "BODY");
  String headers =GreenMailUtil.getHeaders(server.getReceivedMessages()[0]);
  Assert.assertTrue(headers.contains("To: foo, bar"));
  Assert.assertTrue(headers.contains("Subject: SUBJECT"));
  Assert.assertTrue(headers.contains("From: [email protected]"));
  Assert.assertTrue(headers.contains("Content-Type: text/html; charset=UTF-8"));
  Assert.assertEquals("BODY", GreenMailUtil.getBody(server.getReceivedMessages()[0]));
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:15,代码来源:TestEmailSender.java

示例10: getHeaders

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
@Override
public String getHeaders(final Part msg) {
	return GreenMailUtil.getHeaders(msg);
}
 
开发者ID:rbattenfeld,项目名称:arquillian-extension-mail-master,代码行数:5,代码来源:DefaultMailTestUtil.java

示例11: getMailHeaders

import com.icegreen.greenmail.util.GreenMailUtil; //导入方法依赖的package包/类
/**
 * get mail message headers based on message index
 * @param index - mail index
 * @return
 */

public String getMailHeaders( int index) {
    return GreenMailUtil.getHeaders(greenMail.getReceivedMessages()[index]);
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:10,代码来源:EmailServerUtil.java


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