Fixes for Sporadic Test Failures

* `ClientWebSocketContainer`: add some synchronization to avoid race conditions: https://build.spring.io/browse/INT-B41-492
* `TomcatWebSocketTestServer`: convert to `0` port to rely on the OS resolution for `localPort`
* Add `LogAdjustingTestSupport` for STOMP test
* `SftpServerTests`: use `0` port to rely on the OS resolution for `localPort`
* `ImapMailReceiver`, `OutboundGatewayFunctionTests` (JMS), `CachingClientConnectionFactoryTests`,
`AsyncGatewayTests`, `AsyncMessagingTemplateTests`, `GatewayParserTests`, `PriorityChannelTests`, `AggregatorIntegrationTests`: increase timeout
* `EnableIntegrationTests`: use `LogAdjustingTestSupport`
* `FileOutboundChannelAdapterParserTests`: rework `Thread.sleep()` with `CountDownLatch`
* `ConnectionToConnectionTests`: increase timeout and count iteration. Previously with `1sec` we may lose some events. And we can't just rely on the `10sec`,
because the last iteration will be so long
* `TcpOutboundGatewayTests`: `500ms` is so big timeout to wait for the `Exception` that in the high load environment we can yield to other Thread so long.
Like in our case to `server` Thread to send the reply for us. Therefore decrease the Exception timeout to the `50ms` and increase server delay to `2sec`
* `StompInboundChannelAdapterWebSocketIntegrationTests`: remove `@Qualifier("taskScheduler")` as a potential candidate to test against latest SF changes.
We're fine with `SF-4.2.2` and it is just a test-case. So, I don't see reason to wait for their fix here.

STOMP: `session = null` in adapters for any transportError

Polishing
This commit is contained in:
Artem Bilan
2015-11-13 22:39:00 -05:00
committed by Gary Russell
parent e45bb36be2
commit 9d8e2b61f6
23 changed files with 150 additions and 129 deletions

View File

@@ -54,6 +54,8 @@ import javax.mail.search.FlagTerm;
import javax.mail.search.FromTerm;
import javax.mail.search.SearchTerm;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPMessage;
import org.apache.commons.logging.Log;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -87,9 +89,6 @@ import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.util.FileCopyUtils;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPMessage;
/**
* @author Oleg Zhurakousky
* @author Gary Russell
@@ -129,8 +128,7 @@ public class ImapMailReceiverTests {
public SearchTerm generateSearchTerm(Flags supportedFlags, Folder folder) {
try {
FromTerm fromTerm = new FromTerm(new InternetAddress("bar@baz"));
AndTerm andTerm = new AndTerm(fromTerm, new FlagTerm(new Flags(Flags.Flag.SEEN), false));
return andTerm;
return new AndTerm(fromTerm, new FlagTerm(new Flags(Flag.SEEN), false));
}
catch (AddressException e) {
throw new RuntimeException(e);
@@ -171,11 +169,11 @@ public class ImapMailReceiverTests {
adapter.start();
@SuppressWarnings("unchecked")
org.springframework.messaging.Message<MimeMessage> received =
(org.springframework.messaging.Message<MimeMessage>) channel.receive(6000);
(org.springframework.messaging.Message<MimeMessage>) channel.receive(10000);
assertNotNull(received);
assertNotNull(received.getPayload().getReceivedDate());
assertTrue(received.getPayload().getLineCount() > -1);
assertNotNull(channel.receive(6000)); // new message after idle
assertNotNull(channel.receive(10000)); // new message after idle
assertNull(channel.receive(10000)); // no new message after second and third idle
verify(logger).debug("Canceling IDLE");
taskScheduler.shutdown();