diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java index 80d496a550..d569658bb7 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java +++ b/spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java @@ -81,9 +81,9 @@ import org.springframework.integration.channel.QueueChannel; import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.history.MessageHistory; import org.springframework.integration.mail.ImapIdleChannelAdapter.ImapIdleExceptionEvent; -import org.springframework.integration.mail.TestMailServer.ImapServer; import org.springframework.integration.mail.config.ImapIdleChannelAdapterParserTests; import org.springframework.integration.mail.support.DefaultMailHeaderMapper; +import org.springframework.integration.test.mail.TestMailServer; import org.springframework.integration.test.support.LongRunningIntegrationTest; import org.springframework.integration.test.util.TestUtils; import org.springframework.messaging.MessageHeaders; @@ -105,7 +105,7 @@ public class ImapMailReceiverTests { private final AtomicInteger failed = new AtomicInteger(0); - private final static ImapServer imapIdleServer = TestMailServer.imap(0); + private final static TestMailServer.ImapServer imapIdleServer = TestMailServer.imap(0); @BeforeClass diff --git a/spring-integration-mail/src/test/java/org/springframework/integration/mail/TestMailServer.java b/spring-integration-test/src/main/java/org/springframework/integration/test/mail/TestMailServer.java similarity index 95% rename from spring-integration-mail/src/test/java/org/springframework/integration/mail/TestMailServer.java rename to spring-integration-test/src/main/java/org/springframework/integration/test/mail/TestMailServer.java index 8822a61983..57b031fc3c 100644 --- a/spring-integration-mail/src/test/java/org/springframework/integration/mail/TestMailServer.java +++ b/spring-integration-test/src/main/java/org/springframework/integration/test/mail/TestMailServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.integration.mail; +package org.springframework.integration.test.mail; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -35,8 +35,15 @@ import javax.net.ServerSocketFactory; import org.springframework.util.Base64Utils; /** + * A basic test mail server for pop3, imap, + * Serves up a canned email message with each protocol. + * For smtp, it handles the basic handshaking and captures + * the pertinent data so it can be verified by a test case. + * * @author Gary Russell * + * @since 4.3.6 + * */ public class TestMailServer { @@ -283,8 +290,8 @@ public class TestMailServer { + "FLAGS (\\Seen) " + "ENVELOPE (\"Mon, 27 May 2013 15:14:49 +0530\" " + "\"Test Email\" ((\"Bar\" NIL \"bar\" \"baz\")) " - + "((\"Foo\" NIL \"foo\" \"bar.tv\")) " - + "((\"Foo\" NIL \"foo\" \"bar.tv\")) " + + "((\"Bar\" NIL \"bar\" \"baz\")) " + + "((\"Bar\" NIL \"bar\" \"baz\")) " + "((\"Foo\" NIL \"foo\" \"bar\")) NIL NIL " + "\"<4DA0A7E4.3010506@baz.net>\" " + "\"\") " @@ -433,8 +440,10 @@ public class TestMailServer { public abstract class MailHandler implements Runnable { - protected static final String MESSAGE = - "To: Foo \r\nFrom: Bar \r\nSubject: Test Email\r\n\r\nfoo"; + public static final String BODY = "foo\r\n"; + + public static final String MESSAGE = + "To: Foo \r\nFrom: Bar \r\nSubject: Test Email\r\n\r\n" + BODY; protected final Socket socket;