From 13be6d2321dd32e1adfa1ef9a08f288f0e315080 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 29 Apr 2014 15:48:39 -0400 Subject: [PATCH] Fix issue in STOMP broker relay integration test --- ...okerRelayMessageHandlerIntegrationTests.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 bdcd2b432c..72bc45a6ed 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 @@ -92,6 +92,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { this.activeMQBroker.addConnector("stomp://localhost:" + this.port); this.activeMQBroker.setStartAsync(false); this.activeMQBroker.setPersistent(false); + this.activeMQBroker.setUseJmx(false); this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5); this.activeMQBroker.start(); @@ -139,6 +140,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @Test public void publishSubscribe() throws Exception { + logger.debug("Starting test publishSubscribe()"); + String sess1 = "sess1"; String sess2 = "sess2"; String subs1 = "subs1"; @@ -161,6 +164,9 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @Test(expected=MessageDeliveryException.class) public void messageDeliveryExceptionIfSystemSessionForwardFails() throws Exception { + + logger.debug("Starting test messageDeliveryExceptionIfSystemSessionForwardFails()"); + stopActiveMqBrokerAndAwait(); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SEND); this.relay.handleMessage(MessageBuilder.createMessage("test".getBytes(), headers.getMessageHeaders())); @@ -169,6 +175,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @Test public void brokerBecomingUnvailableTriggersErrorFrame() throws Exception { + logger.debug("Starting test brokerBecomingUnvailableTriggersErrorFrame()"); + String sess1 = "sess1"; MessageExchange connect = MessageExchangeBuilder.connect(sess1).build(); this.relay.handleMessage(connect.message); @@ -181,6 +189,9 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @Test public void brokerAvailabilityEventWhenStopped() throws Exception { + + logger.debug("Starting test brokerAvailabilityEventWhenStopped()"); + stopActiveMqBrokerAndAwait(); this.eventPublisher.expectBrokerAvailabilityEvent(false); } @@ -188,6 +199,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @Test public void relayReconnectsIfBrokerComesBackUp() throws Exception { + logger.debug("Starting test relayReconnectsIfBrokerComesBackUp()"); + String sess1 = "sess1"; MessageExchange conn1 = MessageExchangeBuilder.connect(sess1).build(); this.relay.handleMessage(conn1.message); @@ -217,6 +230,8 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @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); @@ -246,6 +261,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { public void expectBrokerAvailabilityEvent(boolean isBrokerAvailable) throws InterruptedException { BrokerAvailabilityEvent event = this.eventQueue.poll(10000, TimeUnit.MILLISECONDS); + assertNotNull("Times out waiting for BrokerAvailabilityEvent[" + isBrokerAvailable + "]", event); assertEquals(isBrokerAvailable, event.isBrokerAvailable()); } } @@ -265,6 +281,7 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { public void expectMessages(MessageExchange... messageExchanges) throws InterruptedException { for (MessageExchange exchange : messageExchanges) { Message message = this.queue.poll(10000, TimeUnit.MILLISECONDS); + assertNotNull("Timed out waiting for: " + exchange, message); assertTrue("Expected: " + exchange + " but got: " + message, exchange.matchMessage(message)); } }