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:
committed by
Gary Russell
parent
e45bb36be2
commit
9d8e2b61f6
@@ -51,6 +51,7 @@ import org.springframework.integration.stomp.event.StompIntegrationEvent;
|
||||
import org.springframework.integration.stomp.event.StompReceiptEvent;
|
||||
import org.springframework.integration.stomp.event.StompSessionConnectedEvent;
|
||||
import org.springframework.integration.test.rule.Log4jLevelAdjuster;
|
||||
import org.springframework.integration.test.support.LogAdjustingTestSupport;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.websocket.TomcatWebSocketTestServer;
|
||||
import org.springframework.messaging.Message;
|
||||
@@ -92,10 +93,7 @@ import org.springframework.web.socket.sockjs.client.WebSocketTransport;
|
||||
@ContextConfiguration(classes = StompInboundChannelAdapterWebSocketIntegrationTests.ContextConfiguration.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class StompInboundChannelAdapterWebSocketIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public Log4jLevelAdjuster adjuster = new Log4jLevelAdjuster(Level.TRACE, "org.springframework");
|
||||
public class StompInboundChannelAdapterWebSocketIntegrationTests extends LogAdjustingTestSupport {
|
||||
|
||||
@Value("#{server.serverContext}")
|
||||
private ConfigurableApplicationContext serverContext;
|
||||
@@ -115,6 +113,10 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
|
||||
@Autowired
|
||||
private StompInboundChannelAdapter stompInboundChannelAdapter;
|
||||
|
||||
public StompInboundChannelAdapterWebSocketIntegrationTests() {
|
||||
super("org.springframework", "org.springframework.integration.stomp");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWebSocketStompClient() throws Exception {
|
||||
Message<?> eventMessage = this.stompEvents.receive(10000);
|
||||
@@ -240,7 +242,7 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebSocketStompClient stompClient(@Qualifier("taskScheduler") TaskScheduler taskScheduler) {
|
||||
public WebSocketStompClient stompClient(TaskScheduler taskScheduler) {
|
||||
WebSocketStompClient webSocketStompClient = new WebSocketStompClient(webSocketClient());
|
||||
webSocketStompClient.setMessageConverter(new MappingJackson2MessageConverter());
|
||||
webSocketStompClient.setTaskScheduler(taskScheduler);
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.springframework.integration.stomp.event.StompExceptionEvent;
|
||||
import org.springframework.integration.stomp.event.StompIntegrationEvent;
|
||||
import org.springframework.integration.stomp.event.StompReceiptEvent;
|
||||
import org.springframework.integration.stomp.event.StompSessionConnectedEvent;
|
||||
import org.springframework.integration.test.support.LogAdjustingTestSupport;
|
||||
import org.springframework.integration.test.support.LongRunningIntegrationTest;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.integration.websocket.TomcatWebSocketTestServer;
|
||||
@@ -96,7 +97,7 @@ import org.springframework.web.socket.sockjs.client.WebSocketTransport;
|
||||
@ContextConfiguration(classes = StompMessageHandlerWebSocketIntegrationTests.ContextConfiguration.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext
|
||||
public class StompMessageHandlerWebSocketIntegrationTests {
|
||||
public class StompMessageHandlerWebSocketIntegrationTests extends LogAdjustingTestSupport {
|
||||
|
||||
@ClassRule
|
||||
public static LongRunningIntegrationTest longTests = new LongRunningIntegrationTest();
|
||||
@@ -112,6 +113,10 @@ public class StompMessageHandlerWebSocketIntegrationTests {
|
||||
@Qualifier("stompEvents")
|
||||
private PollableChannel stompEvents;
|
||||
|
||||
public StompMessageHandlerWebSocketIntegrationTests() {
|
||||
super("org.springframework", "org.springframework.integration.stomp");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStompMessageHandler() throws InterruptedException {
|
||||
StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SEND);
|
||||
|
||||
Reference in New Issue
Block a user