added test case to try reproduce AMQ-1152 (but unfortunately couldn't)

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@540916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-05-23 10:18:20 +00:00
parent 0d289b7c0c
commit 9b9766d034
1 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,8 @@ import java.net.URISyntaxException;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.MessageConsumer;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerRegistry;
@ -69,6 +71,19 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
assertEquals("vm:(broker:()/localhost)", cf.getBrokerURL());
}
public void testUseURIToConfigureRedeliveryPolicy() throws URISyntaxException, JMSException {
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?jms.redeliveryPolicy.maximumRedeliveries=2");
assertEquals("connection redeliveries", 2, cf.getRedeliveryPolicy().getMaximumRedeliveries());
ActiveMQConnection connection = (ActiveMQConnection) cf.createConnection();
assertEquals("connection redeliveries", 2, connection.getRedeliveryPolicy().getMaximumRedeliveries());
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer) session.createConsumer(session.createQueue("FOO.BAR"));
assertEquals("consumer redeliveries", 2, consumer.getRedeliveryPolicy().getMaximumRedeliveries());
connection.close();
}
public void testCreateVMConnectionWithEmbdeddBroker() throws URISyntaxException, JMSException {
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
// Make sure the broker is not created until the connection is instantiated.