From f48d01997071d3d9f27af1e1815b7b88c64d9a83 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 11 Apr 2016 11:12:24 -0400 Subject: [PATCH] INT-3909: Upgrade to Tomcat-8.0.33 JIRA: https://jira.spring.io/browse/INT-3909 Un`@Ignore` the `ClientWebSocketContainerTests` to ensure that `Tomcat-8.0.33` has the fix for the closed WebSocket session race condition. Fix `StompIntegrationTests` test data Clean up queue channels before each test, because of some remained extra messages during the web-socket protocol interactions, like socket close events or similar Fix `RedisStoreInboundChannelAdapterIntegrationTests` race conditions Since Jedis driver is async, we not always receive a reply from the `TX-sync` component immediately. And loop checking the Redis for the `key` after some `Thread.sleep()` --- build.gradle | 2 +- ...oreInboundChannelAdapterIntegrationTests.java | 16 +++++++++++++++- .../websocket/ClientWebSocketContainerTests.java | 2 -- .../websocket/client/StompIntegrationTests.java | 10 +++++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 87fb2fc2a4..28dfbe73bb 100644 --- a/build.gradle +++ b/build.gradle @@ -141,7 +141,7 @@ subprojects { subproject -> saajImplVersion = '1.3.23' servletApiVersion = '3.1.0' slf4jVersion = "1.7.21" - tomcatVersion = "8.0.30" + tomcatVersion = "8.0.33" smackVersion = '4.1.6' springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '1.6.0.BUILD-SNAPSHOT' // springCloudClusterVersion = '1.0.0.BUILD-SNAPSHOT' diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisStoreInboundChannelAdapterIntegrationTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisStoreInboundChannelAdapterIntegrationTests.java index 6844b5de9a..e78775f35d 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisStoreInboundChannelAdapterIntegrationTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/inbound/RedisStoreInboundChannelAdapterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-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. @@ -94,6 +94,13 @@ public class RedisStoreInboundChannelAdapterIntegrationTests extends RedisAvaila //poll again, should get nothing since the collection was removed during synchronization message = (Message) redisChannel.receive(100); assertNull(message); + + int n = 0; + while (n++ < 100 && template.keys("bar").size() == 0) { + Thread.sleep(100); + } + assertTrue("Rename didn't occur", n < 100); + assertEquals(Long.valueOf(13), template.boundListOps("bar").size()); template.delete("bar"); @@ -161,6 +168,13 @@ public class RedisStoreInboundChannelAdapterIntegrationTests extends RedisAvaila //poll again, should get nothing since the collection was removed during synchronization message = (Message) redisChannel.receive(100); assertNull(message); + + int n = 0; + while (n++ < 100 && template.keys("bar").size() == 0) { + Thread.sleep(100); + } + assertTrue("Rename didn't occur", n < 100); + assertEquals(Long.valueOf(13), template.boundListOps("bar").size()); template.delete("bar"); diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/ClientWebSocketContainerTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/ClientWebSocketContainerTests.java index f6ed2f9b00..449311402e 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/ClientWebSocketContainerTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/ClientWebSocketContainerTests.java @@ -35,7 +35,6 @@ import java.util.concurrent.TimeUnit; import org.apache.tomcat.websocket.WsWebSocketContainer; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.springframework.web.socket.CloseStatus; @@ -64,7 +63,6 @@ public class ClientWebSocketContainerTests { } @Test - @Ignore("Ignored until fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=58624") public void testClientWebSocketContainer() throws Exception { StandardWebSocketClient webSocketClient = new StandardWebSocketClient(); Map userProperties = new HashMap(); diff --git a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java index f01b5d6a93..d01f09c2d5 100644 --- a/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java +++ b/spring-integration-websocket/src/test/java/org/springframework/integration/websocket/client/StompIntegrationTests.java @@ -31,6 +31,7 @@ import java.util.Collections; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -125,7 +126,14 @@ public class StompIntegrationTests { @Autowired @Qualifier("webSocketEvents") - private PollableChannel webSocketEvents; + private QueueChannel webSocketEvents; + + @Before + public void setup() { + this.webSocketInputChannel.clear(); + this.webSocketEvents.clear(); + } + @Test public void sendMessageToController() throws Exception {