com.icegreen.greenmail.imap.ImapServer Java Examples

The following examples show how to use com.icegreen.greenmail.imap.ImapServer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InterruptableGreenMail.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Override
protected Map<String, AbstractServer> createServices(final ServerSetup[] config, final Managers mgr) {
    Map<String, AbstractServer> srvc = new HashMap<>();
    for (ServerSetup setup : config) {
        if (srvc.containsKey(setup.getProtocol())) {
            throw new IllegalArgumentException("Server '" + setup.getProtocol()
                    + "' was found at least twice in the array");
        }
        final String protocol = setup.getProtocol();
        if (protocol.startsWith(ServerSetup.PROTOCOL_SMTP)) {
            srvc.put(protocol, new InterruptableSmtpServer(setup, mgr));
        } else if (protocol.startsWith(ServerSetup.PROTOCOL_POP3)) {
            srvc.put(protocol, new Pop3Server(setup, mgr));
        } else if (protocol.startsWith(ServerSetup.PROTOCOL_IMAP)) {
            srvc.put(protocol, new ImapServer(setup, mgr));
        }
    }
    return srvc;
}
 
Example #2
Source File: GreenMail.java    From greenmail with Apache License 2.0 6 votes vote down vote up
/**
 * Create the required services according to the server setup
 *
 * @param config Service configuration
 * @return Services map
 */
protected Map<String, AbstractServer> createServices(ServerSetup[] config, Managers mgr) {
    Map<String, AbstractServer> srvc = new HashMap<>();
    for (ServerSetup setup : config) {
        if (srvc.containsKey(setup.getProtocol())) {
            throw new IllegalArgumentException("Server '" + setup.getProtocol() + "' was found at least twice in the array");
        }
        final String protocol = setup.getProtocol();
        if (protocol.startsWith(ServerSetup.PROTOCOL_SMTP)) {
            srvc.put(protocol, new SmtpServer(setup, mgr));
        } else if (protocol.startsWith(ServerSetup.PROTOCOL_POP3)) {
            srvc.put(protocol, new Pop3Server(setup, mgr));
        } else if (protocol.startsWith(ServerSetup.PROTOCOL_IMAP)) {
            srvc.put(protocol, new ImapServer(setup, mgr));
        }
    }
    return srvc;
}
 
Example #3
Source File: ArdulinkMailOnCamelIntegrationTest.java    From Ardulink-2 with Apache License 2.0 5 votes vote down vote up
private String imapUri(String username, String password) {
	ImapServer imapd = mailMock.getImap();
	return makeURI("imap://" + imapd.getBindTo() + ":" + imapd.getPort(), newMapBuilder() //
			.put("username", username) //
			.put("password", password) //
			.put("delete", true) //
			.put("initialDelay", 0) //
			.put("delay", 10) //
			.put("timeUnit", MINUTES.name()) //
			.build() //
	);
}
 
Example #4
Source File: ArdulinkMailOnCamelIntegrationTest.java    From Ardulink-2 with Apache License 2.0 5 votes vote down vote up
private Message fetchMail(String loginId, String password) throws MessagingException, InterruptedException {
	ImapServer imapd = mailMock.getImap();
	Message msg = null;
	while ((msg = retrieveViaImap(imapd.getBindTo(), imapd.getPort(), loginId, password)) == null) {
		MILLISECONDS.sleep(100);
	}
	return msg;
}
 
Example #5
Source File: GreenMail.java    From greenmail with Apache License 2.0 4 votes vote down vote up
@Override
public ImapServer getImap() {
    return (ImapServer) services.get(ServerSetup.PROTOCOL_IMAP);

}
 
Example #6
Source File: GreenMail.java    From greenmail with Apache License 2.0 4 votes vote down vote up
@Override
public ImapServer getImaps() {
    return (ImapServer) services.get(ServerSetup.PROTOCOL_IMAPS);

}
 
Example #7
Source File: GreenMailProxy.java    From greenmail with Apache License 2.0 4 votes vote down vote up
@Override
public ImapServer getImap() {
    return getGreenMail().getImap();
}
 
Example #8
Source File: GreenMailProxy.java    From greenmail with Apache License 2.0 4 votes vote down vote up
@Override
public ImapServer getImaps() {
    return getGreenMail().getImaps();
}
 
Example #9
Source File: GreenMailOperations.java    From greenmail with Apache License 2.0 2 votes vote down vote up
/**
 * @return SMTP server operated by this GreenMail instance or null if there is none
 */
ImapServer getImap();
 
Example #10
Source File: GreenMailOperations.java    From greenmail with Apache License 2.0 2 votes vote down vote up
/**
 * @return SMTP server operated by this GreenMail instance or null if there is none
 */
ImapServer getImaps();