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.
master
Rossen Stoyanchev 10 years ago
parent 59e02e63c4
commit 6d15fcc4a6
  1. 9
      spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandlerIntegrationTests.java
  2. 9
      spring-websocket/src/test/java/org/springframework/web/socket/AbstractWebSocketIntegrationTests.java
  3. 6
      spring-websocket/src/test/java/org/springframework/web/socket/sockjs/client/AbstractSockJsIntegrationTests.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();
}

@ -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()));

@ -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());

Loading…
Cancel
Save