From f59fc83f3045d2d6623825da6249de60a8d5cac6 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 6 Jan 2015 09:52:06 -0500 Subject: [PATCH] Remove STOMP relay integration test The test was verifying that when a DISCONNECT frame is sent to the broker, there will be no further messages on the clientOutboundChannel. This is generally true, however in some cases when the broker receives a DISCONNECT it may close its connection fast enough (before we do) in which case we send an ERROR message downstream to ensure the WebSocket side is cleaned up. Either way the downstream should be idempotent with regards to cleaning up sessions. --- ...erRelayMessageHandlerIntegrationTests.java | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java index 011d5efbf2..f7ec40d95a 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java @@ -33,7 +33,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; - import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEventPublisher; import org.springframework.messaging.Message; @@ -49,7 +48,9 @@ import org.springframework.messaging.support.MessageBuilder; import org.springframework.util.Assert; import org.springframework.util.SocketUtils; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** * Integration tests for {@link StompBrokerRelayMessageHandler} running against ActiveMQ. @@ -229,25 +230,6 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { this.eventPublisher.expectBrokerAvailabilityEvent(true); } - @Test - public void disconnectClosesRelaySessionCleanly() throws Exception { - - logger.debug("Starting test disconnectClosesRelaySessionCleanly()"); - - MessageExchange connect = MessageExchangeBuilder.connect("sess1").build(); - this.relay.handleMessage(connect.message); - this.responseHandler.expectMessages(connect); - - StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.DISCONNECT); - headers.setSessionId("sess1"); - this.relay.handleMessage(MessageBuilder.createMessage(new byte[0], headers.getMessageHeaders())); - - Thread.sleep(2000); - - // Check that we have not received an ERROR as a result of the connection closing - assertTrue("Unexpected messages: " + this.responseHandler.queue, this.responseHandler.queue.isEmpty()); - } - @Test public void disconnectWithReceipt() throws Exception {