From 10e1c0c8d3dd67cd441161939ad08716c0778f40 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Wed, 19 Dec 2012 11:38:53 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-4213 - fix up test that expected async producer creation git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1423833 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/config/ConfigTest.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java b/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java index ae5cb833ca..2b3d1b128b 100755 --- a/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/config/ConfigTest.java @@ -417,26 +417,20 @@ public class ConfigTest extends TestCase { ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61631"); javax.jms.Connection connection = activeMQConnectionFactory.createConnection(); - final CountDownLatch latch = new CountDownLatch(1); - connection.setExceptionListener(new ExceptionListener() { - public void onException(JMSException e) { - if (e.getCause() instanceof IllegalStateException) { - latch.countDown(); - } - } - }); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic("test.foo"); - for (int i = 0; i < (MAX_PRODUCERS + 1); i++) { - MessageProducer messageProducer = session.createProducer(topic); + for (int i = 0; i < MAX_PRODUCERS; i++) { + session.createProducer(topic); } - latch.await(5, TimeUnit.SECONDS); - if (latch.getCount() > 0) { - fail("Should have got an exception"); + try { + session.createProducer(topic); + fail("Should have got an exception on exceeding MAX_PRODUCERS"); + } catch (JMSException expected) { } + try { for (int i = 0; i < (MAX_CONSUMERS + 1); i++) { MessageConsumer consumer = session.createConsumer(topic);