From 6d15fcc4a64c8bf332e8c3ff8e4bbbaee6e26fc4 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Wed, 2 Jul 2014 14:26:51 -0400 Subject: [PATCH] Log name of test for WebSocket integration tests This makes it easier to trace log output on the CI server where the output is per class. --- .../StompBrokerRelayMessageHandlerIntegrationTests.java | 9 ++++++--- .../web/socket/AbstractWebSocketIntegrationTests.java | 9 +++++++++ .../sockjs/client/AbstractSockJsIntegrationTests.java | 6 ++++++ 3 files changed, 21 insertions(+), 3 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 f038f4e1b0..62a40055ff 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 @@ -30,8 +30,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.After; 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; @@ -56,6 +58,9 @@ import static org.junit.Assert.*; */ public class StompBrokerRelayMessageHandlerIntegrationTests { + @Rule + public final TestName testName = new TestName(); + private static final Log logger = LogFactory.getLog(StompBrokerRelayMessageHandlerIntegrationTests.class); private static final Charset UTF_8 = Charset.forName("UTF-8"); @@ -75,14 +80,12 @@ public class StompBrokerRelayMessageHandlerIntegrationTests { @Before public void setUp() throws Exception { - + logger.debug("Setting up '" + this.testName.getMethodName() + "'"); this.port = SocketUtils.findAvailableTcpPort(61613); - this.responseChannel = new ExecutorSubscribableChannel(); this.responseHandler = new TestMessageHandler(); this.responseChannel.subscribe(this.responseHandler); this.eventPublisher = new TestEventPublisher(); - startActiveMqBroker(); createAndStartRelay(); } diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java index 7346828937..887eb900f7 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java @@ -23,6 +23,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.After; import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TestName; import org.junit.runners.Parameterized.Parameter; import org.springframework.context.Lifecycle; import org.springframework.context.annotation.Bean; @@ -53,6 +55,9 @@ public abstract class AbstractWebSocketIntegrationTests { upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class); } + @Rule + public final TestName testName = new TestName(); + @Parameter(0) public WebSocketTestServer server; @@ -65,6 +70,10 @@ public abstract class AbstractWebSocketIntegrationTests { @Before public void setup() throws Exception { + logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" + + this.webSocketClient.getClass().getSimpleName() + ", server=" + + this.server.getClass().getSimpleName()); + this.wac = new AnnotationConfigWebApplicationContext(); this.wac.register(getAnnotatedConfigClasses()); this.wac.register(upgradeStrategyConfigTypes.get(this.server.getClass())); diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java index 54eebd1be2..51f16cef64 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java @@ -21,7 +21,9 @@ import org.apache.commons.logging.LogFactory; import org.hamcrest.Matchers; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -75,6 +77,9 @@ import static org.junit.Assert.fail; */ public abstract class AbstractSockJsIntegrationTests { + @Rule + public final TestName testName = new TestName(); + protected Log logger = LogFactory.getLog(getClass()); private WebSocketTestServer server; @@ -88,6 +93,7 @@ public abstract class AbstractSockJsIntegrationTests { @Before public void setup() throws Exception { + logger.debug("Setting up '" + this.testName.getMethodName() + "'"); this.errorFilter = new ErrorFilter(); this.wac = new AnnotationConfigWebApplicationContext(); this.wac.register(TestConfig.class, upgradeStrategyConfigClass());