@BeforeEach void startGreenMailInstance() { greenMail = new GreenMail(ServerSetupTest.ALL);; greenMail.setUser(GREEN_MAIL_COM, GREEN, PWD); greenMail.start(); }
@BeforeEach void startGreenMailInstance() { greenMail = new GreenMail(ServerSetupTest.ALL);; greenMail.setUser(GREEN_MAIL_COM, GREEN, PWD); greenMail.start(); }
@Test void testEnvelopes_FilterByMessageId() { final GreenMail greenMail = new GreenMail(ServerSetupTest.ALL); greenMail.setUser(GREEN_MAIL_COM, GREEN, PWD); greenMail.start();
@Override public GreenMailUser setUser(String login, String password) { return setUser(login, login, password); }
@Override public void setUsers(Properties users) { for (Object o : users.keySet()) { String email = (String) o; String password = users.getProperty(email); setUser(email, email, password); } }
@Override public GreenMailUser setUser(String login, String password) { return getGreenMail().setUser(login, password); }
@Override public GreenMailUser setUser(String email, String login, String password) { return getGreenMail().setUser(email, login, password); }
public static synchronized GreenMail startEmailServer() { if ( server == null ) { // ServerSetup smtp = new ServerSetup( 1234, null, ServerSetup.PROTOCOL_SMTP ); ServerSetup smtp = new ServerSetup( emailServerPort, null, ServerSetup.PROTOCOL_SMTP ); server = new GreenMail( smtp ); server.setUser( "system@nexus.org", "smtp-username", "smtp-password" ); log.debug( "Starting e-mail server" ); server.start(); } return server; }
/** * Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied * BeanFactoryAware and ApplicationContextAware). <p>This method allows the bean instance to * perform initialization only possible when all bean properties have been set and to throw an * exception in the event of misconfiguration. * * @throws Exception in the event of misconfiguration (such as failure to set an essential * property) or if initialization fails. */ @Override public void afterPropertiesSet() throws Exception { greenMail = new GreenMail(createServerSetup()); if (null != users) { for (String user : users) { int posColon = user.indexOf(':'); int posAt = user.indexOf('@'); String login = user.substring(0, posColon); String pwd = user.substring(posColon + 1, posAt); String domain = user.substring(posAt + 1); if (log.isDebugEnabled()) { log.debug("Adding user {}:{}@{}" ,login, pwd, domain); } greenMail.setUser(login + '@' + domain, login, pwd); } } if (autostart) { greenMail.start(); started = true; } }
public static synchronized GreenMail startEmailServer() { if (server == null) { // ServerSetup smtp = new ServerSetup( 1234, null, ServerSetup.PROTOCOL_SMTP ); ServerSetup smtp = new ServerSetup(EMAIL_SERVER_PORT, null, ServerSetup.PROTOCOL_SMTP); server = new GreenMail(smtp); server.setUser(USER_EMAIL, USER_USERNAME, USER_PASSWORD); log.debug("Starting e-mail server"); server.start(); } return server; }
/** * Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied * BeanFactoryAware and ApplicationContextAware). <p>This method allows the bean instance to * perform initialization only possible when all bean properties have been set and to throw an * exception in the event of misconfiguration. * * @throws Exception in the event of misconfiguration (such as failure to set an essential * property) or if initialization fails. */ @Override public void afterPropertiesSet() throws Exception { greenMail = new GreenMail(createServerSetup()); if (null != users) { for (String user : users) { int posColon = user.indexOf(':'); int posAt = user.indexOf('@'); String login = user.substring(0, posColon); String pwd = user.substring(posColon + 1, posAt); String domain = user.substring(posAt + 1); if (log.isDebugEnabled()) { log.debug("Adding user {}:{}@{}" ,login, pwd, domain); } greenMail.setUser(login + '@' + domain, login, pwd); } } if (autostart) { greenMail.start(); started = true; } }
@BeforeClass public static void startEmailServer() { String port = TestProperties.getString("email.server.port"); emailServerPort = new Integer(port); // ServerSetup smtp = new ServerSetup( 1234, null, ServerSetup.PROTOCOL_SMTP ); ServerSetup smtp = new ServerSetup(emailServerPort, null, ServerSetup.PROTOCOL_SMTP); server = new GreenMail(smtp); server.setUser("system@nexus.org", "smtp-username", "smtp-password"); LOG.debug("Starting e-mail server"); server.start(); }
@SuppressWarnings("unchecked") public T ensureStarted() { if (greenMail == null) { send = setupSendServer(); receive = setupReceiveServer(); greenMail = new GreenMail(new ServerSetup[] { send, receive }); greenMail.setUser(ADMIN_USER + "@localhost", ADMIN_USER, ADMIN_PASSWORD); greenMail.start(); } return (T) this; }
@BeforeEach void startEmailing() { EMAIL.start(); EMAIL.setUser(USERNAME, USERNAME, PASSWORD); LOGGER.info("Started e-mailing."); }
@BeforeEach void startEmailing() { EMAIL.start(); EMAIL.setUser(USERNAME, USERNAME, PASSWORD); LOGGER.info("Started e-mailing."); }
@BeforeEach void startEmailing() { EMAIL.start(); EMAIL.setUser("user@seznam.cz", "user@seznam.cz", "pass").create(); LOGGER.info("Started e-mailing."); }
@Test public void forMatrixIdInvite() throws MessagingException { gm.setUser("mxisd", "mxisd"); _MatrixID sender = MatrixID.asAcceptable("mxisd", domain); _MatrixID recipient = MatrixID.asAcceptable("john", domain); MatrixIdInvite idInvite = new MatrixIdInvite("!rid:" + domain, sender, recipient, ThreePidMedium.Email.getId(), "john@" + domain, Collections.emptyMap()); m.getNotif().sendForInvite(idInvite); assertEquals(1, gm.getReceivedMessages().length); MimeMessage msg = gm.getReceivedMessages()[0]; assertEquals(1, msg.getFrom().length); assertEquals("\"Mxisd Server (Unit Test)\" <mxisd@localhost>", msg.getFrom()[0].toString()); assertEquals(1, msg.getRecipients(Message.RecipientType.TO).length); }