Skip to content

Commit 6d15fcc

Browse files
committed
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.
1 parent 59e02e6 commit 6d15fcc

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
import org.apache.commons.logging.LogFactory;
3131
import org.junit.After;
3232
import org.junit.Before;
33+
import org.junit.Rule;
3334
import org.junit.Test;
3435

36+
import org.junit.rules.TestName;
3537
import org.springframework.context.ApplicationEvent;
3638
import org.springframework.context.ApplicationEventPublisher;
3739
import org.springframework.messaging.Message;
@@ -56,6 +58,9 @@
5658
*/
5759
public class StompBrokerRelayMessageHandlerIntegrationTests {
5860

61+
@Rule
62+
public final TestName testName = new TestName();
63+
5964
private static final Log logger = LogFactory.getLog(StompBrokerRelayMessageHandlerIntegrationTests.class);
6065

6166
private static final Charset UTF_8 = Charset.forName("UTF-8");
@@ -75,14 +80,12 @@ public class StompBrokerRelayMessageHandlerIntegrationTests {
7580

7681
@Before
7782
public void setUp() throws Exception {
78-
83+
logger.debug("Setting up '" + this.testName.getMethodName() + "'");
7984
this.port = SocketUtils.findAvailableTcpPort(61613);
80-
8185
this.responseChannel = new ExecutorSubscribableChannel();
8286
this.responseHandler = new TestMessageHandler();
8387
this.responseChannel.subscribe(this.responseHandler);
8488
this.eventPublisher = new TestEventPublisher();
85-
8689
startActiveMqBroker();
8790
createAndStartRelay();
8891
}

spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.apache.commons.logging.LogFactory;
2424
import org.junit.After;
2525
import org.junit.Before;
26+
import org.junit.Rule;
27+
import org.junit.rules.TestName;
2628
import org.junit.runners.Parameterized.Parameter;
2729
import org.springframework.context.Lifecycle;
2830
import org.springframework.context.annotation.Bean;
@@ -53,6 +55,9 @@ public abstract class AbstractWebSocketIntegrationTests {
5355
upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
5456
}
5557

58+
@Rule
59+
public final TestName testName = new TestName();
60+
5661
@Parameter(0)
5762
public WebSocketTestServer server;
5863

@@ -65,6 +70,10 @@ public abstract class AbstractWebSocketIntegrationTests {
6570
@Before
6671
public void setup() throws Exception {
6772

73+
logger.debug("Setting up '" + this.testName.getMethodName() + "', client=" +
74+
this.webSocketClient.getClass().getSimpleName() + ", server=" +
75+
this.server.getClass().getSimpleName());
76+
6877
this.wac = new AnnotationConfigWebApplicationContext();
6978
this.wac.register(getAnnotatedConfigClasses());
7079
this.wac.register(upgradeStrategyConfigTypes.get(this.server.getClass()));

spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
import org.hamcrest.Matchers;
2222
import org.junit.After;
2323
import org.junit.Before;
24+
import org.junit.Rule;
2425
import org.junit.Test;
26+
import org.junit.rules.TestName;
2527
import org.springframework.beans.factory.annotation.Autowired;
2628
import org.springframework.context.annotation.Bean;
2729
import org.springframework.context.annotation.Configuration;
@@ -75,6 +77,9 @@
7577
*/
7678
public abstract class AbstractSockJsIntegrationTests {
7779

80+
@Rule
81+
public final TestName testName = new TestName();
82+
7883
protected Log logger = LogFactory.getLog(getClass());
7984

8085
private WebSocketTestServer server;
@@ -88,6 +93,7 @@ public abstract class AbstractSockJsIntegrationTests {
8893

8994
@Before
9095
public void setup() throws Exception {
96+
logger.debug("Setting up '" + this.testName.getMethodName() + "'");
9197
this.errorFilter = new ErrorFilter();
9298
this.wac = new AnnotationConfigWebApplicationContext();
9399
this.wac.register(TestConfig.class, upgradeStrategyConfigClass());

0 commit comments

Comments
 (0)