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


Java Wiser.setPort方法代码示例

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


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

示例1: main

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
	final Wiser wiser = new Wiser();
	wiser.setPort(2500);
	wiser.start();
	final SmtpSender mailer = new SmtpSender("localhost", 2500, "test", "asdf", "localhost", SmtpSender.Security.TRY_TLS);
	final MessageStruct msg = new MessageStruct();
	msg.Sender = "[email protected]";
	msg.Recipient = "[email protected]";
	msg.Subject = "Test";
	msg.Message = "The message.";
	msg.MailId = 0L;
	try (final SmtpSender.Connection conn = mailer.getConnection()) {
		mailer.send(conn, msg);
	}
	wiser.stop();
	try (final SmtpSender.Connection conn = mailer.getConnection()) {
		throw new AssertionError("Connection should fail now that there is no running mail server.");
	} catch (final Exception ex) {
		// Expected.
	}
}
 
开发者ID:emily-e,项目名称:webframework,代码行数:22,代码来源:SmtpTest.java

示例2: setUp

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp();

    boolean serverUpAndRunning = false;
    while (!serverUpAndRunning) {
        wiser = new Wiser();
        wiser.setPort(5025);

        try {
            wiser.start();
            serverUpAndRunning = true;
        } catch (RuntimeException e) { // Fix for slow port-closing Jenkins
            if (e.getMessage().toLowerCase().contains("BindException")) {
                Thread.sleep(250L);
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:EmailSendTaskTest.java

示例3: setUp

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp();

    boolean serverUpAndRunning = false;
    while (!serverUpAndRunning) {
        wiser = new Wiser();
        wiser.setPort(5025);

        try {
            wiser.start();
            serverUpAndRunning = true;
        } catch (RuntimeException e) { // Fix for slow port-closing Jenkins
            if (e.getMessage().toLowerCase().contains("bindexception")) {
                Thread.sleep(250L);
            }
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:EmailTestCase.java

示例4: testSendMessage

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
/**
 * Test that a Mailer can be retrieved via the KEWServiceLocator and can be used 
 * to send an e-mail message to the SMTP server.
 */
@Test
public void testSendMessage() {
	// Initialize SMTP server
	Wiser smtpServer = new Wiser();
	smtpServer.setPort(55000);
	smtpServer.start();
	
	// Test that a Mailer can be retrieved via the KEWServiceLocator
	Mailer mailer = null;
	mailer = CoreApiServiceLocator.getMailer();
	assertNotNull(mailer);
	
	// Test that an e-mail message gets sent to the SMTP server
	mailer.sendEmail(new EmailFrom(sender), new EmailTo(recipient), new EmailSubject(subject), new EmailBody(messageBody), false);
	Assert.assertEquals(1, smtpServer.getMessages().size());

       // Shutdown the SMTP server
       smtpServer.stop();        
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:MailerTest.java

示例5: testExecute

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Test
   public void testExecute() throws Exception {
// start SMTP Server
Wiser wiser = new Wiser();
wiser.setPort(2525);
wiser.start();

passwordHintAction.setUsername("user");
assertEquals("success", passwordHintAction.execute());
assertFalse(passwordHintAction.hasActionErrors());

// verify an account information e-mail was sent
wiser.stop();
assertTrue(wiser.getMessages().size() == 1);

// verify that success messages are in the request
assertNotNull(passwordHintAction.getSession().getAttribute("messages"));
   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:19,代码来源:PasswordHintActionTest.java

示例6: testSend

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Test
   public void testSend() throws Exception {
// mock smtp server
Wiser wiser = new Wiser();
// set the port to a random value so there's no conflicts between tests
int port = 2525 + (int) (Math.random() * 100);
mailSender.setPort(port);
wiser.setPort(port);
wiser.start();

Date dte = new Date();
this.mailMessage.setTo("[email protected]");
String emailSubject = "grepster testSend: " + dte;
String emailBody = "Body of the grepster testSend message sent at: "
	+ dte;
this.mailMessage.setSubject(emailSubject);
this.mailMessage.setText(emailBody);
this.mailEngine.send(this.mailMessage);

wiser.stop();
assertTrue(wiser.getMessages().size() == 1);
WiserMessage wm = wiser.getMessages().get(0);
assertEquals(emailSubject, wm.getMimeMessage().getSubject());
assertEquals(emailBody, wm.getMimeMessage().getContent());
   }
 
开发者ID:gisgraphy,项目名称:gisgraphy,代码行数:26,代码来源:MailEngineTest.java

示例7: setUp

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  
  boolean serverUpAndRunning = false;
  while (!serverUpAndRunning) {
    wiser = new Wiser();
    wiser.setPort(5025);
    
    try {
      wiser.start();
      serverUpAndRunning = true;
    } catch (RuntimeException e) { // Fix for slow port-closing Jenkins
      if (e.getMessage().toLowerCase().contains("BindException")) {
        Thread.sleep(250L);
      }
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:EmailSendTaskTest.java

示例8: testTimeout

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
/** */
@Test
public void testTimeout() throws Exception {
	Wiser wiser = new Wiser();
	wiser.setPort(PORT);
	wiser.getServer().setConnectionTimeout(1000);
	wiser.start();

	SMTPClient client = new SMTPClient("localhost", PORT);
	client.sendReceive("HELO foo");
	Thread.sleep(2000);
	try {
		client.sendReceive("HELO bar");
		fail();
	} catch (SocketException e) {
		// expected
	} finally {
		wiser.stop();
	}
}
 
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:21,代码来源:TimeoutTest.java

示例9: testSend

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Test
public void testSend() throws Exception {
    // mock smtp server
    Wiser wiser = new Wiser();
    // set the port to a random value so there's no conflicts between tests
    int port = 2525 + (int)(Math.random() * 100);
    mailSender.setPort(port);
    wiser.setPort(port);
    wiser.start();
    
    Date dte = new Date();
    this.mailMessage.setTo("[email protected]");
    String emailSubject = "grepster testSend: " + dte;
    String emailBody = "Body of the grepster testSend message sent at: " + dte;
    this.mailMessage.setSubject(emailSubject);
    this.mailMessage.setText(emailBody);
    this.mailEngine.send(this.mailMessage);
    
    wiser.stop();
    assertTrue(wiser.getMessages().size() == 1);
    WiserMessage wm = wiser.getMessages().get(0);
    assertEquals(emailSubject, wm.getMimeMessage().getSubject());
    assertEquals(emailBody, wm.getMimeMessage().getContent());
}
 
开发者ID:SMVBE,项目名称:ldadmin,代码行数:25,代码来源:MailEngineTest.java

示例10: testConsumeRecoveryToken

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Test
public void testConsumeRecoveryToken() throws Exception {
    final User user = userManager.getUserByUsername("user");
    final Integer version = user.getVersion();

    final String token = passwordTokenManager.generateRecoveryToken(user);
    Assert.assertNotNull(token);
    Assert.assertTrue(passwordTokenManager.isRecoveryTokenValid(user, token));

    // start SMTP Server
    final Wiser wiser = new Wiser();
    wiser.setPort(smtpPort);
    wiser.start();

    userManager.updatePassword(user.getUsername(), null, token, "user", "");

    wiser.stop();
    assertTrue(wiser.getMessages().size() == 1);

    Assert.assertTrue(user.getVersion() > version);
    Assert.assertFalse(passwordTokenManager.isRecoveryTokenValid(user, token));
}
 
开发者ID:SMVBE,项目名称:ldadmin,代码行数:23,代码来源:PasswordTokenManagerTest.java

示例11: create

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@BeforeClass
public void create() throws Exception {
  wiser = new Wiser();
  wiser.setHostname("localhost");
  wiser.setPort(25000);
  queryService = LensServices.get().getService(QueryExecutionService.NAME);
  Map<String, String> sessionconf = new HashMap<>();
  sessionconf.put("test.session.key", "svalue");
  sessionconf.put(LensConfConstants.QUERY_MAIL_NOTIFY, "true");
  sessionconf.put(LensConfConstants.QUERY_RESULT_EMAIL_CC, "[email protected],[email protected],[email protected]");
  lensSessionId = queryService.openSession("[email protected]", "bar", sessionconf); // @localhost should be removed
  // automatically
  createTable(TEST_TABLE);
  loadData(TEST_TABLE, TestResourceFile.TEST_DATA2_FILE.getValue());
  wiser.start();
}
 
开发者ID:apache,项目名称:lens,代码行数:17,代码来源:TestQueryEndEmailNotifier.java

示例12: setUp

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  
  boolean serverUpAndRunning = false;
  while (!serverUpAndRunning) {
    wiser = new Wiser();
    wiser.setPort(5025);
    
    try {
      wiser.start();
      serverUpAndRunning = true;
    } catch (RuntimeException e) { // Fix for slow port-closing Jenkins
      if (e.getMessage().toLowerCase().contains("bindexception")) {
        Thread.sleep(250L);
      }
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:20,代码来源:EmailTestCase.java

示例13: setUp

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  int port = processEngineConfiguration.getMailServerPort();

  boolean serverUpAndRunning = false;
  while (!serverUpAndRunning) {
    wiser = new Wiser();
    wiser.setPort(port);

    try {
      LOG.info("Starting Wiser mail server on port: " + port);
      wiser.start();
      serverUpAndRunning = true;
      LOG.info("Wiser mail server listening on port: " + port);
    } catch (RuntimeException e) { // Fix for slow port-closing Jenkins
      if (e.getMessage().toLowerCase().contains("BindException")) {
        Thread.sleep(250L);
      }
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:EmailTestCase.java

示例14:

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@Bean(initMethod = "start", destroyMethod = "stop")
/*    */ Wiser wiser() {
	/* 49 */ Wiser answer = new Wiser();
	/* 50 */ answer.setPort(this.mailEasyConfig.getSmtpPort());
	/* 51 */ answer.setHostname(this.mailEasyConfig.getSmtpHost());
	/* 52 */ return answer;
	/*    */ }
 
开发者ID:quirinobrizi,项目名称:maileasy,代码行数:8,代码来源:Application.java

示例15: setupClass

import org.subethamail.wiser.Wiser; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() throws IOException {
    Properties p = new Properties();
    try {
        p.load(AbstractTestCase.class.getResourceAsStream("/mail.properties"));
        wiser = new Wiser();
        wiser.setHostname(p.getProperty("mail.host"));
        wiser.setPort(Integer.valueOf(p.getProperty("mail.port")));

        wiser.start();
    } catch (IOException e) {
        throw e;
    }
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:15,代码来源:AbstractTestCase.java


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