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

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2015 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.
@@ -57,7 +57,7 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
private volatile CountDownLatch connectionLatch;
private WebSocketSession clientSession;
private volatile WebSocketSession clientSession;
private volatile Throwable openConnectionException;
@@ -106,7 +106,7 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
*/
@Override
public WebSocketSession getSession(String sessionId) {
if (this.isRunning()) {
if (isRunning()) {
try {
this.connectionLatch.await(this.connectionTimeout, TimeUnit.SECONDS);
}
@@ -146,9 +146,11 @@ public final class ClientWebSocketContainer extends IntegrationWebSocketContaine
}
@Override
public void start() {
this.connectionLatch = new CountDownLatch(1);
this.connectionManager.start();
public synchronized void start() {
if (!isRunning()) {
this.connectionLatch = new CountDownLatch(1);
this.connectionManager.start();
}
}
@Override