Repository: qpid-jms Updated Branches: refs/heads/master 9a8a9c1c6 -> 144e690a3
QPIDJMS-175 Improve test reliability. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/144e690a Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/144e690a Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/144e690a Branch: refs/heads/master Commit: 144e690a3ce3d892965b8d4147af578409e05b98 Parents: 9a8a9c1 Author: Timothy Bish <[email protected]> Authored: Mon May 9 10:00:01 2016 -0400 Committer: Timothy Bish <[email protected]> Committed: Mon May 9 10:00:01 2016 -0400 ---------------------------------------------------------------------- .../jms/integration/ConsumerIntegrationTest.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/144e690a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java index 4ca76b7..a776a76 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ConsumerIntegrationTest.java @@ -786,7 +786,7 @@ public class ConsumerIntegrationTest extends QpidJmsTestCase { // Consumer should close due to timed waiting for drain. testPeer.expectDetach(true, true, true); - MessageConsumer consumer = session.createConsumer(queue); + final MessageConsumer consumer = session.createConsumer(queue); try { if (noWait) { @@ -800,13 +800,18 @@ public class ConsumerIntegrationTest extends QpidJmsTestCase { LOG.info("Receive failed after drain timeout as expected: {}", ex.getMessage()); } - try { - consumer.getMessageSelector(); - fail("Should be closed and throw an exception"); - } catch (JMSException ex) { - } + assertTrue("Consumer should close", Wait.waitFor(new Wait.Condition() { - consumer.close(); + @Override + public boolean isSatisified() throws Exception { + try { + consumer.getMessageSelector(); + return false; + } catch (JMSException ex) { + return true; + } + } + })); testPeer.expectClose(); connection.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
