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
This commit is contained in:
Gary Tully 2012-12-19 11:38:53 +00:00
parent 0f3ce45cff
commit 10e1c0c8d3
1 changed files with 7 additions and 13 deletions

View File

@ -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);