Repository: qpid-jms Updated Branches: refs/heads/master 8494d1812 -> 9903b1c6d
QPIDJMS-207: fix race to avoid sporadic failure, adjust a timeout to reflect its units Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/34c6a7d3 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/34c6a7d3 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/34c6a7d3 Branch: refs/heads/master Commit: 34c6a7d36f542a4bede9318ede07081d195703ec Parents: 8494d18 Author: Robert Gemmell <[email protected]> Authored: Thu Sep 15 17:49:44 2016 +0100 Committer: Robert Gemmell <[email protected]> Committed: Thu Sep 15 17:49:44 2016 +0100 ---------------------------------------------------------------------- .../qpid/jms/integration/ProducerIntegrationTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/34c6a7d3/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java index d34aae6..9bca0cd 100644 --- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java +++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/ProducerIntegrationTest.java @@ -1014,12 +1014,12 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { final String BREAD_CRUMB = "ErrorMessage"; try (TestAmqpPeer testPeer = new TestAmqpPeer();) { - final AtomicBoolean producerClosed = new AtomicBoolean(); + final CountDownLatch producerClosed = new CountDownLatch(1); JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.addConnectionListener(new JmsDefaultConnectionListener() { @Override public void onProducerClosed(MessageProducer producer, Exception exception) { - producerClosed.set(true); + producerClosed.countDown(); } }); @@ -1052,13 +1052,14 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { fail("No expected exception for this send."); } - testPeer.waitForAllHandlersToComplete(1000); + testPeer.waitForAllHandlersToComplete(2000); - // Verify the producer gets marked closed - assertTrue(listener.awaitCompletion(2000, TimeUnit.SECONDS)); + // Verify the sends gets marked errored + assertTrue(listener.awaitCompletion(5, TimeUnit.SECONDS)); assertEquals(MSG_COUNT, listener.errorCount); - // Verify the session is now marked closed + // Verify the producer gets marked closed + assertTrue("Producer closed callback didn't trigger", producerClosed.await(5, TimeUnit.SECONDS)); try { producer.getDeliveryMode(); fail("Expected ISE to be thrown due to being closed"); @@ -1068,7 +1069,6 @@ public class ProducerIntegrationTest extends QpidJmsTestCase { assertTrue(errorMessage.contains(BREAD_CRUMB)); } - assertTrue("Producer closed callback didn't trigger", producerClosed.get()); // Try closing it explicitly, should effectively no-op in client. // The test peer will throw during close if it sends anything. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
