INT-4292: More Diagnostics

https://jira.spring.io/browse/INT-4292

Add class-level log adjuster.
This commit is contained in:
Gary Russell
2017-06-13 16:51:28 -04:00
parent 1c02d375f1
commit 48edc94a1e
3 changed files with 122 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,8 +26,10 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import org.apache.activemq.broker.BrokerService;
import org.apache.log4j.Level;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.springframework.context.ApplicationEvent;
@@ -50,7 +52,7 @@ import org.springframework.integration.stomp.event.StompSessionConnectedEvent;
import org.springframework.integration.stomp.inbound.StompInboundChannelAdapter;
import org.springframework.integration.stomp.outbound.StompMessageHandler;
import org.springframework.integration.support.converter.PassThruMessageConverter;
import org.springframework.integration.test.support.LogAdjustingTestSupport;
import org.springframework.integration.test.rule.Log4jClassLevelAdjuster;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageDeliveryException;
@@ -67,18 +69,17 @@ import org.springframework.util.SocketUtils;
* @author Gary Russell
* @since 4.2
*/
public class StompServerIntegrationTests extends LogAdjustingTestSupport {
public class StompServerIntegrationTests {
@ClassRule
public static Log4jClassLevelAdjuster adjuster = new Log4jClassLevelAdjuster(Level.TRACE, "org.springframework", "org.springframework.integration.stomp",
"org.apache.activemq.broker", "reactor.io", "io.netty");
private static BrokerService activeMQBroker;
private static Reactor2TcpStompClient stompClient;
public StompServerIntegrationTests() {
super("org.springframework", "org.springframework.integration.stomp",
"org.apache.activemq.broker", "reactor.io", "io.netty");
}
@BeforeClass
public static void setup() throws Exception {
int port = SocketUtils.findAvailableTcpPort(61613);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@ import static org.junit.Assert.assertTrue;
import java.util.Collections;
import java.util.Map;
import org.apache.log4j.Level;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -50,7 +52,7 @@ import org.springframework.integration.stomp.event.StompConnectionFailedEvent;
import org.springframework.integration.stomp.event.StompIntegrationEvent;
import org.springframework.integration.stomp.event.StompReceiptEvent;
import org.springframework.integration.stomp.event.StompSessionConnectedEvent;
import org.springframework.integration.test.support.LogAdjustingTestSupport;
import org.springframework.integration.test.rule.Log4jClassLevelAdjuster;
import org.springframework.integration.websocket.TomcatWebSocketTestServer;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
@@ -90,12 +92,17 @@ import org.springframework.web.socket.sockjs.client.WebSocketTransport;
/**
* @author Artem Bilan
* @author Gary Russell
* @since 4.2
*/
@ContextConfiguration(classes = StompInboundChannelAdapterWebSocketIntegrationTests.ContextConfiguration.class)
@RunWith(SpringJUnit4ClassRunner.class)
@DirtiesContext
public class StompInboundChannelAdapterWebSocketIntegrationTests extends LogAdjustingTestSupport {
public class StompInboundChannelAdapterWebSocketIntegrationTests {
@ClassRule
public static Log4jClassLevelAdjuster adjuster = new Log4jClassLevelAdjuster(Level.TRACE, "org.springframework",
"org.springframework.integration.stomp");
@Value("#{server.serverContext}")
private ConfigurableApplicationContext serverContext;
@@ -115,10 +122,6 @@ public class StompInboundChannelAdapterWebSocketIntegrationTests extends LogAdju
@Autowired
private StompInboundChannelAdapter stompInboundChannelAdapter;
public StompInboundChannelAdapterWebSocketIntegrationTests() {
super("org.springframework", "org.springframework.integration.stomp");
}
@Test
public void testWebSocketStompClient() throws Exception {
Message<?> eventMessage = this.stompEvents.receive(10000);