本文整理汇总了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();
}
示例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;
}
}
示例3: init
@Before
public void init() {
MockitoAnnotations.initMocks(this);
tokenStoreService = new TokenStoreServiceImpl(emailService, tokenStoreRepository);
greenMail = new GreenMail(ServerSetupTest.SMTP);
greenMail.start();
}
示例4: setup
@Before
public void setup() {
mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();
smtpServer = new GreenMail(ServerSetupTest.SMTP);
smtpServer.start();
}
示例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();
}
示例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();
}
}
示例7: init
@Before
public void init() {
MockitoAnnotations.initMocks(this);
greenMail = new GreenMail(ServerSetupTest.SMTP);
greenMail.start();
}
示例8: setup
@Before
public void setup() throws Exception {
super.setup();
testSmtp = new GreenMail(ServerSetupTest.SMTP);
testSmtp.start();
}
示例9: getServerSetup
private static ServerSetup getServerSetup() {
final ServerSetup setup = ServerSetupTest.SMTP;
setup.setServerStartupTimeout(5000);
setup.setVerbose(true);
return setup;
}
示例10: testSmtpInit
@BeforeClass
public static void testSmtpInit() {
testSmtp = new GreenMail(ServerSetupTest.SMTP);
}
示例11: startServer
protected void startServer() {
greenMail = new GreenMail(ServerSetupTest.SMTP);
greenMail.start();
}
示例12: before
@Before
public void before() {
this.greenMail = new GreenMail(ServerSetupTest.SMTP);
this.greenMail.start();
}
示例13: setUp
@Before
public void setUp() {
server = new GreenMail(ServerSetupTest.SMTP);
server.start();
}
示例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();
}
}
示例15: afterPropertiesSet
@Override
public void afterPropertiesSet() throws Exception {
greenMail = new GreenMail(ServerSetupTest.SMTP);
greenMail.setUser(mail, password);
greenMail.start();
}