本文整理汇总了Java中com.dumbster.smtp.SimpleSmtpServer.start方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleSmtpServer.start方法的具体用法?Java SimpleSmtpServer.start怎么用?Java SimpleSmtpServer.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dumbster.smtp.SimpleSmtpServer
的用法示例。
在下文中一共展示了SimpleSmtpServer.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@org.junit.Before
public void setUp() throws Exception {
String in = IOUtils.toString(getClass().getResourceAsStream("/test-mail-action-state.yml"));
YamlModelAccessor<ActionState> yaml = new YamlModelAccessor<>();
mailState = yaml.convertEntry(in);
server = SimpleSmtpServer.start(2525);
SMTPUtilImpl smtp = new SMTPUtilImpl();
smtp.setMailhost("localhost");
smtp.setMailport(2525);
action = new SendMailAction();
action.setConfig(config);
action.setSmtpUtil(smtp);
action.setConfig(config);
List<MailReceiver> receiverList = new ArrayList<>();
when(mailRec.getEmail()).thenReturn("[email protected]");
receiverList.add(mailRec);
when(config.readMailReveiverForMailinglist(anyString())).thenReturn(receiverList);
}
示例2: setup
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@BeforeMethod
public void setup(ITestContext context) throws IOException {
server = SimpleSmtpServer.start(SimpleSmtpServer.AUTO_SMTP_PORT);
Map<String, String> mailConfiguration =
ImmutableMap.of(
"mail.smtp.host",
"localhost",
"mail.smtp.port",
server.getPort() + "",
"mail.transport.protocol",
"smtp",
" mail.smtp.auth",
"false");
mailSender = new MailSender(new MailSessionProvider(mailConfiguration));
}
示例3: send
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void send() {
LostPasswordSpammer spammer = new LostPasswordSpammer(config);
User user = new User();
user.setEmail("[email protected]");
user.setActivationKey("123");
spammer.prepare(user, "lost subject");
SimpleSmtpServer server = null;
try {
server = SimpleSmtpServer.start(config.getInt(ConfigKeys.MAIL_SMTP_PORT));
spammer.dispatchMessages();
}
finally {
if (server != null) {
server.stop();
}
}
Assert.assertEquals(1, server.getReceivedEmailSize());
SmtpMessage message = (SmtpMessage)server.getReceivedEmail().next();
Assert.assertTrue(message.getBody().indexOf("http://localhost/user/recoverPassword/123.page") > -1);
}
示例4: notifyAssign
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyAssign() {
log.debug("start notifyAssign()");
Controllable c = createControllable(ExecutionStatus.POSTPONED);
JpaResource res = new JpaResource(new TEntity());
c.setResource(res);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.POSTPONED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: POSTPONED", email.getHeaderValue("Subject"));
log.debug(email.getBody());
String exp = "Hello approvalUser,\n\n"
+ "A business case under dual control has been assigned to you for final approval. You may release or reject the case. Please visit the dialogue for releasing/rejecting.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity \n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例5: notifyAssign2
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyAssign2() {
log.debug("start notifyAssign2()");
Controllable c = createControllable(ExecutionStatus.POSTPONED);
JpaResource res = new JpaResource(new TEntity());
c.setResource(res);
c.setFirstApprovalUser(null);
c.setFirstApprovalAddress(null);
c.setFirstApprovalDate(null);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.POSTPONED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: POSTPONED", email.getHeaderValue("Subject"));
log.debug(email.getBody());
String exp = "Hello approvalUser,\n\n"
+ "A business case under dual control has been assigned to you for final approval. You may release or reject the case. Please visit the dialogue for releasing/rejecting.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity \n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例6: notifyFirstReleased
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyFirstReleased() {
log.debug("start notifyFirstReleased()");
Controllable c = createControllable(ExecutionStatus.FIRST_RELEASED);
JpaResource res = new JpaResource(new TEntity());
c.setResource(res);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.FIRST_RELEASED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: FIRST_RELEASED", email.getHeaderValue("Subject"));
Assert.assertEquals("[email protected]", email.getHeaderValue("From"));
Assert.assertEquals("[email protected]", email.getHeaderValue("To"));
log.debug(email.getBody());
String exp = "Hello userId,\n\n"
+ "A business case under 6-eyes dual control has been released by the first approval user.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity \n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例7: notifyFirstReleased2
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyFirstReleased2() {
log.debug("start notifyFirstReleased2()");
Controllable c = createControllable(ExecutionStatus.FIRST_RELEASED);
EjbResource res = new EjbResource(new TEntity(), null, null);
res.setMethod("executePay");
c.setResource(res);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.FIRST_RELEASED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: FIRST_RELEASED", email.getHeaderValue("Subject"));
Assert.assertEquals("[email protected]", email.getHeaderValue("From"));
Assert.assertEquals("[email protected]", email.getHeaderValue("To"));
log.debug(email.getBody());
String exp = "Hello userId,\n\n"
+ "A business case under 6-eyes dual control has been released by the first approval user.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity (executePay)\n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例8: notifyRejected
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyRejected() {
log.debug("start notifyRejected()");
Controllable c = createControllable(ExecutionStatus.REJECTED);
JpaResource res = new JpaResource(new TEntity());
c.setResource(res);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.REJECTED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: REJECTED", email.getHeaderValue("Subject"));
Assert.assertEquals("[email protected]", email.getHeaderValue("From"));
Assert.assertEquals("[email protected]", email.getHeaderValue("To"));
log.debug(email.getBody());
String exp = "Hello userId,\n\n" + "A business case under dual control has been rejected.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity \n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n"
+ "rejected by: approvalUser on Wed Sep 25 16:13:22 CEST 2013\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例9: notifyReleased
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyReleased() {
log.debug("start notifyReleased()");
Controllable c = createControllable(ExecutionStatus.EXECUTED);
JpaResource res = new JpaResource(new TEntity());
c.setResource(res);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.EXECUTED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: EXECUTED", email.getHeaderValue("Subject"));
Assert.assertEquals("[email protected]", email.getHeaderValue("From"));
Assert.assertEquals("[email protected]", email.getHeaderValue("To"));
log.debug(email.getBody());
String exp = "Hello userId,\n\n" + "A business case under dual control has been finally released.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity \n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n"
+ "released by: approvalUser on Wed Sep 25 16:13:22 CEST 2013\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例10: send
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void send() {
when(repository.getTotalPosts(notNull(Topic.class))).thenReturn(10);
TopicReplySpammer spammer = new TopicReplySpammer(config);
List<User> users = new ArrayList<User>();
User u1 = new User(); u1.setEmail("[email protected]");
User u2 = new User(); u2.setEmail("[email protected]");
users.add(u1); users.add(u2);
Topic topic = new Topic(repository); topic.setId(1); topic.setSubject("subject x");
topic.setLastPost(new Post()); topic.getLastPost().setId(123);
spammer.prepare(topic, users);
SimpleSmtpServer server = null;
try {
server = SimpleSmtpServer.start(config.getInt(ConfigKeys.MAIL_SMTP_PORT));
spammer.dispatchMessages();
}
finally {
if (server != null) {
server.stop();
}
}
Assert.assertEquals(2, server.getReceivedEmailSize());
SmtpMessage message = (SmtpMessage)server.getReceivedEmail().next();
Assert.assertTrue(message.getBody().indexOf("subject x") > -1);
Assert.assertTrue(message.getBody().indexOf("http://localhost/topics/list/1.page#123") > -1);
Assert.assertTrue(message.getBody().indexOf("http://localhost/topics/unwatch/1.page") > -1);
}
示例11: setup
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Before
public void setup() {
smtpServer = SimpleSmtpServer.start(TEST_SMTP_PORT);
emailService = new SpitterEmailServiceImpl();
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setPort(1025);
emailService.mailSender = mailSender;
}
示例12: startManager
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@BeforeClass
public static void startManager() throws ConfigurationException {
Registry.start();
try {
smtpPort = 9700 + new Random().nextInt(99);
httpPort = 9600 + new Random().nextInt(99);
System.setProperty(Property.DEFAULT_JUDDI_EMAIL_PREFIX + "mail.smtp.host", "localhost");
System.setProperty(Property.DEFAULT_JUDDI_EMAIL_PREFIX + "mail.smtp.port", String.valueOf(smtpPort));
System.setProperty(Property.DEFAULT_JUDDI_EMAIL_PREFIX + "mail.smtp.from", "[email protected]");
mailServer = SimpleSmtpServer.start(smtpPort);
//bring up the TCK HTTP SubscriptionListener
httpEndpoint = "http://localhost:" + httpPort + "/tcksubscriptionlistener";
System.out.println("Bringing up SubscriptionListener endpoint at " + httpEndpoint);
endPoint = Endpoint.publish(httpEndpoint, new UDDISubscriptionListenerImpl());
logger.debug("Getting auth tokens..");
api010.saveJoePublisher();
api010.saveMaryPublisher();
UDDISecurityPortType security = new UDDISecurityImpl();
authInfoJoe = TckSecurity.getAuthToken(security, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword());
Assert.assertNotNull(authInfoJoe);
authInfoMary = TckSecurity.getAuthToken(security, TckPublisher.getMaryPublisherId(), TckPublisher.getMaryPassword());
Assert.assertNotNull(authInfoMary);
} catch (Exception e) {
logger.error(e.getMessage(), e);
Assert.fail(e.getMessage());
}
}
示例13: setup
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Before
public void setup() throws IOException {
service.setMailSender(getValidFakeConfig());
dumbster = SimpleSmtpServer.start(SimpleSmtpServer.DEFAULT_SMTP_PORT);
}
示例14: notifyAssign3
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyAssign3() {
log.debug("start notifyAssign3()");
Controllable c = createControllable(ExecutionStatus.POSTPONED);
MethodResource res = new MethodResource(new TEntity(), null, null);
res.setMethod("executePay");
c.setResource(res);
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.POSTPONED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: POSTPONED", email.getHeaderValue("Subject"));
Assert.assertEquals("[email protected]", email.getHeaderValue("From"));
Assert.assertEquals("[email protected]", email.getHeaderValue("To"));
log.debug(email.getBody());
String exp = "Hello approvalUser,\n\n"
+ "A business case under dual control has been assigned to you for final approval. You may release or reject the case. Please visit the dialogue for releasing/rejecting.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity (executePay)\n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n\n\n"
+ "thanks for your attention\n" + "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}
示例15: notifyAssign3WithRemarks
import com.dumbster.smtp.SimpleSmtpServer; //导入方法依赖的package包/类
@Test
public void notifyAssign3WithRemarks() {
log.debug("start notifyAssign3WithRemarks()");
Controllable c = createControllable(ExecutionStatus.POSTPONED);
EjbResource res = new EjbResource(new TEntity(), null, null);
res.setMethod("executePay");
c.setResource(res);
c.setCreateRemark("Hase");
c.setFirstApprovalRemark("Igel");
EmailNotificationProvider prov = new EmailNotificationProvider();
prov.setFrom("[email protected]");
prov.setSmtpHost("localhost");
prov.setSmtpPort("8854");
SimpleSmtpServer server = SimpleSmtpServer.start(8854);
try {
prov.notify(ExecutionStatus.POSTPONED, c);
server.stop();
Assert.assertTrue(server.getReceivedEmailSize() == 1);
Iterator<SmtpMessage> emailIter = server.getReceivedEmail();
SmtpMessage email = emailIter.next();
Assert.assertEquals("Cibet Notification: POSTPONED", email.getHeaderValue("Subject"));
Assert.assertEquals("[email protected]", email.getHeaderValue("From"));
Assert.assertEquals("[email protected]", email.getHeaderValue("To"));
log.debug(email.getBody());
String exp = "Hello approvalUser,\n\n"
+ "A business case under dual control has been assigned to you for final approval. You may release or reject the case. Please visit the dialogue for releasing/rejecting.\n"
+ "The dual controlled business case is registered under id: 123 (case id: test-caseid)\n\n"
+ "control event: DELETE\n"
+ "controlled target: com.cibethelper.entities.TEntity (executePay)\n"
+ "initiated by: userId on Fri Sep 20 16:13:22 CEST 2013\n"
+ "creation remark: Hase\n"
+ "first released by: firstApprovalUserId on Sun Sep 22 16:13:22 CEST 2013\n"
+ "remark: Igel\n\n\n" + "thanks for your attention\n"
+ "Cibet (http://www.logitags.com/cibet)";
Assert.assertEquals(exp, email.getBody());
} finally {
server.stop();
}
}