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 | 98015264c15a8153642a0157cf5a3fa2a9dc59eb (patch) | |
| tree | 8cf6eca6b0fe1f66bd05016c2158a2bf9f8f2519 /qpid/java | |
| parent | 2a2bc1a0b096e095c08d2b202e1e1ec480fd2606 (diff) | |
| download | qpid-python-98015264c15a8153642a0157cf5a3fa2a9dc59eb.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@1245926 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java index 5aa5c44a2a..babe2d207d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/FailoverMethodTest.java +++ b/qpid/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()); } } |
