diff options
author | Keith Wall <kwall@apache.org> | 2012-02-18 14:24:37 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2012-02-18 14:24:37 +0000 |
commit | 543ef5c6ada4626852da6630e4d276338f547f65 (patch) | |
tree | fb3144d573f2e4b5064c1b710b6401a95ce07fa8 | |
parent | 8d9183b255011726a9eabe0166d7870ea1122e13 (diff) | |
download | qpid-python-543ef5c6ada4626852da6630e4d276338f547f65.tar.gz |
NO-JIRA: Added extra logging to better understand FailoverMethodTest failure on Apache Jenkins Freebsd slaves.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1245926 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java index 5aa5c44a2a..babe2d207d 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java @@ -37,10 +37,9 @@ import java.util.concurrent.TimeUnit; public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionListener { + private static final Logger LOGGER = LoggerFactory.getLogger(FailoverMethodTest.class); private CountDownLatch _failoverComplete = new CountDownLatch(1); - protected static final Logger _logger = LoggerFactory.getLogger(FailoverMethodTest.class); - - + private final int _freePortWithNoBroker = findFreePort(); /** * Test that the round robin method has the correct delays. @@ -53,8 +52,8 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL //note: The first broker has no connect delay and the default 1 retry // while the tcp:localhost broker has 3 retries with a 2s connect delay String connectionString = "amqp://guest:guest@/test?brokerlist=" + - "'tcp://:" + getPort() + - ";tcp://localhost:5670?connectdelay='2000',retries='3''"; + "'tcp://localhost:" + getPort() + + ";tcp://localhost:" + _freePortWithNoBroker + "?connectdelay='2000',retries='3''"; AMQConnectionURL url = new AMQConnectionURL(connectionString); @@ -65,7 +64,9 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL connection.setExceptionListener(this); + LOGGER.debug("Stopping broker"); stopBroker(); + LOGGER.debug("Stopped broker"); _failoverComplete.await(30, TimeUnit.SECONDS); assertEquals("failoverLatch was not decremented in given timeframe", @@ -109,7 +110,9 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL connection.setExceptionListener(this); + LOGGER.debug("Stopping broker"); stopBroker(); + LOGGER.debug("Stopped broker"); _failoverComplete.await(30, TimeUnit.SECONDS); assertEquals("failoverLatch was not decremented in given timeframe", @@ -138,18 +141,6 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL } } - public void onException(JMSException e) - { - if (e.getLinkedException() instanceof AMQDisconnectedException || e.getLinkedException() instanceof AMQConnectionClosedException) - { - _logger.debug("Received AMQDisconnectedException"); - _failoverComplete.countDown(); - } - else - { - _logger.error("Unexpected underlying exception", e.getLinkedException()); - } - } /** * Test that setting 'nofailover' as the failover policy does not result in @@ -200,13 +191,11 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL } catch (Exception e) { - System.err.println(e.getMessage()); - e.printStackTrace(); + LOGGER.error("Exception whilst starting broker", e); } } }); - brokerStart.start(); long start = System.currentTimeMillis(); @@ -260,11 +249,17 @@ public class FailoverMethodTest extends QpidBrokerTestCase implements ExceptionL } } - public void stopBroker(int port) throws Exception + @Override + public void onException(JMSException e) { - if (isBrokerPresent(port)) + if (e.getLinkedException() instanceof AMQDisconnectedException || e.getLinkedException() instanceof AMQConnectionClosedException) + { + LOGGER.debug("Received AMQDisconnectedException"); + _failoverComplete.countDown(); + } + else { - super.stopBroker(port); + LOGGER.error("Unexpected underlying exception", e.getLinkedException()); } } |