@Test public void testDoRun() throws MessagingException { GreenMailStandaloneRunner runner = new GreenMailStandaloneRunner(); final Properties properties = new Properties(); properties.setProperty(PropertiesBasedServerSetupBuilder.GREENMAIL_VERBOSE, ""); properties.setProperty("greenmail.setup.test.smtp", ""); properties.setProperty("greenmail.setup.test.imap", ""); properties.setProperty(PropertiesBasedGreenMailConfigurationBuilder.GREENMAIL_USERS, "test1:pwd1,test2:pwd2@localhost"); runner.doRun(properties); GreenMailUtil.sendTextEmail("test2@localhost", "test1@localhost", "Standalone test", "It worked", ServerSetupTest.SMTP); final Session session = runner.getGreenMail().getImap().createSession(); assertThat(session.getDebug()).isTrue(); Store store = session.getStore("imap"); try { store.connect("test2", "pwd2"); final Folder folder = store.getFolder("INBOX"); try { folder.open(Folder.READ_ONLY); Message msg = folder.getMessages()[0]; assertThat(msg.getFrom()[0].toString()).isEqualTo("test1@localhost"); assertThat(msg.getSubject()).isEqualTo("Standalone test"); } finally { folder.close(true); } } finally { store.close(); } }
public void doRun(Properties properties) { ServerSetup[] serverSetup = new PropertiesBasedServerSetupBuilder().build(properties); if (serverSetup.length == 0) { printUsage(System.out); } else { greenMail = new GreenMail(serverSetup); log.info("Starting GreenMail standalone v{} using {}", BuildInfo.INSTANCE.getProjectVersion(), Arrays.toString(serverSetup)); greenMail.withConfiguration(new PropertiesBasedGreenMailConfigurationBuilder().build(properties)) .start(); } }
GreenMailStandaloneRunner { public void doRun(Properties properties) { ServerSetup[] serverSetup = new PropertiesBasedServerSetupBuilder().build(properties); if (serverSetup.length == 0) { printUsage(System.out); } else { greenMail = new GreenMail(serverSetup); log.info("Starting GreenMail standalone v{} using {}", BuildInfo.INSTANCE.getProjectVersion(), Arrays.toString(serverSetup)); greenMail.withConfiguration(new PropertiesBasedGreenMailConfigurationBuilder().build(properties)) .start(); } } }
GreenMailStandaloneRunner { public void doRun(Properties properties) { ServerSetup[] serverSetup = new PropertiesBasedServerSetupBuilder().build(properties); if (serverSetup.length == 0) { printUsage(System.out); } else { greenMail = new GreenMail(serverSetup); log.info("Starting GreenMail standalone v{} using {}", BuildInfo.INSTANCE.getProjectVersion(), Arrays.toString(serverSetup)); greenMail.withConfiguration(new PropertiesBasedGreenMailConfigurationBuilder().build(properties)) .start(); } }  }
GreenMailStandaloneRunner { public void doRun(Properties properties) { ServerSetup[] serverSetup = new PropertiesBasedServerSetupBuilder().build(properties); if (serverSetup.length == 0) { printUsage(System.out); } else { greenMail = new GreenMail(serverSetup); log.info("Starting GreenMail standalone v{} using {}", BuildInfo.INSTANCE.getProjectVersion(), Arrays.toString(serverSetup)); greenMail.withConfiguration(new PropertiesBasedGreenMailConfigurationBuilder().build(properties)) .start(); } }  void doRun(Properties properties); static void main(String[] args); }
GreenMailStandaloneRunner { public void doRun(Properties properties) { ServerSetup[] serverSetup = new PropertiesBasedServerSetupBuilder().build(properties); if (serverSetup.length == 0) { printUsage(System.out); } else { greenMail = new GreenMail(serverSetup); log.info("Starting GreenMail standalone v{} using {}", BuildInfo.INSTANCE.getProjectVersion(), Arrays.toString(serverSetup)); greenMail.withConfiguration(new PropertiesBasedGreenMailConfigurationBuilder().build(properties)) .start(); } }  void doRun(Properties properties); static void main(String[] args);  }