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


Java ServerSetupTest.SMTP属性代码示例

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


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

示例1: setMailSenderParameters

@BeforeMethod(description = "setup parameters need to create a smtp server.")
public void setMailSenderParameters() {

    initProperties = new HashMap<>();
    initProperties.put(EmailTestConstant.MAIL_SENDER_USERNAME, USERNAME);
    initProperties.put(EmailTestConstant.MAIL_SENDER_PASSWORD, PASSWORD);
    //green mail server use port 3025 to create a connection to local email server.
    initProperties.put("mail.smtp.port", "3025");
    //It is required to set auth 'true' to create connection.
    initProperties.put("mail.smtp.auth", "true");
    initProperties.put("mail.smtp.host", HOST);

    //start the green mail server
    mailServer = new GreenMail(ServerSetupTest.SMTP);
    mailServer.start();
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:16,代码来源:SmtpServerMailTestCase.java

示例2: testThis

private void testThis() throws InterruptedException {
    exc = null;
    final GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP);
    greenMail.setUser("[email protected]","[email protected]");
    greenMail.start();
    final Thread sendThread = new Thread() {
        public void run() {
            try {
                sendMail("[email protected]", "[email protected]", "abc", "def", ServerSetupTest.SMTP);
            } catch (final Throwable e) {
                exc = new RuntimeException(e);
            }
        }
    };
    sendThread.start();
    greenMail.waitForIncomingEmail(3000, 1);
    final MimeMessage[] emails = greenMail.getReceivedMessages();
    assertEquals(1, emails.length);
    greenMail.stop();
    sendThread.join(10000);
    if (exc != null) {
        throw exc;
    }
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:24,代码来源:ConcurrentCloseIT.java

示例3: init

@Before
public void init() {
	MockitoAnnotations.initMocks(this);
	tokenStoreService = new TokenStoreServiceImpl(emailService, tokenStoreRepository);
	greenMail = new GreenMail(ServerSetupTest.SMTP);
	greenMail.start();
}
 
开发者ID:codenergic,项目名称:theskeleton,代码行数:7,代码来源:TokenStoreServiceTest.java

示例4: setup

@Before
public void setup() {
	mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();

	smtpServer = new GreenMail(ServerSetupTest.SMTP);
	smtpServer.start();
}
 
开发者ID:oojorgeoo89,项目名称:QuizZz,代码行数:7,代码来源:LifeCycleTest.java

示例5: startMailServer

/**
 * Start the mail server before each test.
 */
@BeforeClass
public static void startMailServer() {
	ServerSetup smtp = ServerSetupTest.SMTP;

	// set timeout as we ran into this issue with CI:
	// https://github.com/greenmail-mail-test/greenmail/issues/76
	smtp.setServerStartupTimeout(3000L);

	greenMail = new GreenMail(smtp);
	greenMail.start();
}
 
开发者ID:terrestris,项目名称:shogun2,代码行数:14,代码来源:MailPublisherTest.java

示例6: testResetAndChangePassword

@Test
public void testResetAndChangePassword() throws Exception {
    GreenMail mailServer = new GreenMail(ServerSetupTest.SMTP);
    mailServer.start();

    Profile profile = profileService.createProfile(DEFAULT_TENANT, AVASQUEZ_USERNAME, AVASQUEZ_PASSWORD1,
                                                   AVASQUEZ_EMAIL1, true, AVASQUEZ_ROLES1, null, VERIFICATION_URL);

    try {
        profile = profileService.resetPassword(profile.getId().toString(), RESET_PASSWORD_URL);

        assertNotNull(profile);

        // Wait a few seconds so that the email can be sent
        Thread.sleep(3000);

        String email = GreenMailUtil.getBody(mailServer.getReceivedMessages()[0]);

        assertNotNull(email);

        Pattern emailPattern = Pattern.compile(VERIFICATION_EMAIL_REGEX, Pattern.DOTALL);
        Matcher emailMatcher = emailPattern.matcher(email);

        assertTrue(emailMatcher.matches());

        String resetTokenId = emailMatcher.group(1);

        Profile profileAfterPswdReset = profileService.changePassword(resetTokenId, AVASQUEZ_PASSWORD2);

        assertNotNull(profileAfterPswdReset);
        assertEquals(profile.getId(), profileAfterPswdReset.getId());
        assertNull(profileAfterPswdReset.getPassword());
    } finally {
        profileService.deleteProfile(profile.getId().toString());

        mailServer.stop();
    }
}
 
开发者ID:craftercms,项目名称:profile,代码行数:38,代码来源:ProfileServiceIT.java

示例7: init

@Before
public void init() {
	MockitoAnnotations.initMocks(this);
	greenMail = new GreenMail(ServerSetupTest.SMTP);
	greenMail.start();
}
 
开发者ID:codenergic,项目名称:theskeleton,代码行数:6,代码来源:EmailServiceTest.java

示例8: setup

@Before
public void setup() throws Exception {
    super.setup();
    testSmtp = new GreenMail(ServerSetupTest.SMTP);
    testSmtp.start();
}
 
开发者ID:egch,项目名称:sushi-bar-BE,代码行数:6,代码来源:RegistrationControllerTest.java

示例9: getServerSetup

private static ServerSetup getServerSetup() {
    final ServerSetup setup = ServerSetupTest.SMTP;
    setup.setServerStartupTimeout(5000);
    setup.setVerbose(true);
    return setup;
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:6,代码来源:EmailingListenerTest.java

示例10: testSmtpInit

@BeforeClass
public static void testSmtpInit() {
    testSmtp = new GreenMail(ServerSetupTest.SMTP);
}
 
开发者ID:music-for-all,项目名称:music-for-all-application,代码行数:4,代码来源:MailServiceTest.java

示例11: startServer

protected void startServer() {
  greenMail = new GreenMail(ServerSetupTest.SMTP);
  greenMail.start();
}
 
开发者ID:nithril,项目名称:smtp-connection-pool,代码行数:4,代码来源:AbstractTest.java

示例12: before

@Before
public void before() {
  this.greenMail = new GreenMail(ServerSetupTest.SMTP);
  this.greenMail.start();
}
 
开发者ID:dzhw,项目名称:metadatamanagement,代码行数:5,代码来源:MailServiceTest.java

示例13: setUp

@Before
public void setUp() {
    server = new GreenMail(ServerSetupTest.SMTP);
    server.start();
}
 
开发者ID:remibantos,项目名称:jeeshop,代码行数:5,代码来源:MailerIT.java

示例14: testCreateAndVerifyProfile

@Test
public void testCreateAndVerifyProfile() throws Exception {
    GreenMail mailServer = new GreenMail(ServerSetupTest.SMTP);
    mailServer.start();

    tenantService.verifyNewProfiles(DEFAULT_TENANT, true);

    Profile profile = profileService.createProfile(DEFAULT_TENANT, AVASQUEZ_USERNAME, AVASQUEZ_PASSWORD1,
                                                   AVASQUEZ_EMAIL1, true, AVASQUEZ_ROLES1, null, VERIFICATION_URL);
    try {
        assertNotNull(profile);
        assertNotNull(profile.getId());
        assertEquals(AVASQUEZ_USERNAME, profile.getUsername());
        assertNull(profile.getPassword());
        assertEquals(AVASQUEZ_EMAIL1, profile.getEmail());
        assertFalse(profile.isVerified());
        assertFalse(profile.isEnabled());
        assertNotNull(profile.getCreatedOn());
        assertNotNull(profile.getLastModified());
        assertEquals(DEFAULT_TENANT, profile.getTenant());
        assertEquals(AVASQUEZ_ROLES1, profile.getRoles());
        assertNotNull(profile.getAttributes());
        assertEquals(0, profile.getAttributes().size());

        // Wait a few seconds so that the email can be sent
        Thread.sleep(3000);

        String email = GreenMailUtil.getBody(mailServer.getReceivedMessages()[0]);

        assertNotNull(email);

        Pattern emailPattern = Pattern.compile(VERIFICATION_EMAIL_REGEX, Pattern.DOTALL);
        Matcher emailMatcher = emailPattern.matcher(email);

        assertTrue(emailMatcher.matches());

        String verificationTokenId = emailMatcher.group(1);

        Profile verifiedProfile = profileService.verifyProfile(verificationTokenId);

        assertNotNull(verifiedProfile);
        assertEquals(profile.getId(), verifiedProfile.getId());
        assertTrue(verifiedProfile.isEnabled());
        assertTrue(verifiedProfile.isVerified());
    } finally {
        profileService.deleteProfile(profile.getId().toString());

        tenantService.verifyNewProfiles(DEFAULT_TENANT, false);

        mailServer.stop();
    }
}
 
开发者ID:craftercms,项目名称:profile,代码行数:52,代码来源:ProfileServiceIT.java

示例15: afterPropertiesSet

@Override
public void afterPropertiesSet() throws Exception {
	greenMail = new GreenMail(ServerSetupTest.SMTP);
	greenMail.setUser(mail, password);
	greenMail.start();
}
 
开发者ID:Michaelleolee,项目名称:appengine,代码行数:6,代码来源:MailServerSimulator.java


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