diff --git a/quickfixj-core/src/test/java/quickfix/mina/SocksProxyTest.java b/quickfixj-core/src/test/java/quickfix/mina/SocksProxyTest.java index 88459bb59..9b1216349 100644 --- a/quickfixj-core/src/test/java/quickfix/mina/SocksProxyTest.java +++ b/quickfixj-core/src/test/java/quickfix/mina/SocksProxyTest.java @@ -3,7 +3,11 @@ import org.apache.mina.util.AvailablePortFinder; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import quickfix.Acceptor; import quickfix.ApplicationAdapter; import quickfix.ConfigError; @@ -28,13 +32,19 @@ */ public class SocksProxyTest { + private static final Logger LOGGER = LoggerFactory.getLogger(SocksProxyTest.class); + // maximum time to wait for session logon private static final long TIMEOUT_SECONDS = 5; + @Rule + public TestName testName = new TestName(); + private SocksProxyServer proxyServer; @Before public void setUp() { + LOGGER.info("Starting test {}", getCurrentTestName()); int proxyPort = AvailablePortFinder.getNextAvailable(); proxyServer = new SocksProxyServer(proxyPort); @@ -46,6 +56,8 @@ public void tearDown() { if (proxyServer != null) { proxyServer.stop(); } + + LOGGER.info("Finished test {}", getCurrentTestName()); } @Test @@ -113,6 +125,16 @@ private boolean isLoggedOn(SessionConnector connector, SessionID sessionID) { return session.isLoggedOn(); } + private String getCurrentTestName() { + String methodName = testName.getMethodName(); + + if (methodName == null) { + return getClass().getSimpleName(); + } + + return getClass().getSimpleName() + "." + methodName; + } + private SessionConnector createAcceptor(int port) throws ConfigError { MessageStoreFactory messageStoreFactory = new MemoryStoreFactory(); MessageFactory messageFactory = new DefaultMessageFactory();