Don't use hard coded port for the Broker.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1452371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-03-04 16:27:03 +00:00
parent 03c79886a3
commit c46c040122
1 changed files with 13 additions and 13 deletions

View File

@ -27,16 +27,16 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.activemq.util.ByteSequence;
import org.apache.activemq.wireformat.WireFormat;
import org.apache.derby.jdbc.EmbeddedDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.derby.jdbc.EmbeddedDataSource;
import junit.framework.TestCase;
// https://issues.apache.org/activemq/browse/AMQ-2880
public class JDBCCommitExceptionTest extends TestCase {
@ -44,20 +44,23 @@ public class JDBCCommitExceptionTest extends TestCase {
private static final Logger LOG = LoggerFactory.getLogger(JDBCCommitExceptionTest.class);
protected static final int messagesExpected = 10;
protected ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(
"tcp://localhost:61616?jms.prefetchPolicy.all=0&jms.redeliveryPolicy.maximumRedeliveries="+messagesExpected);
protected ActiveMQConnectionFactory factory;
protected BrokerService broker;
protected String connectionUri;
protected EmbeddedDataSource dataSource;
protected java.sql.Connection dbConnection;
protected BrokenPersistenceAdapter jdbc;
@Override
public void setUp() throws Exception {
broker = createBroker();
broker.start();
factory = new ActiveMQConnectionFactory(
connectionUri + "?jms.prefetchPolicy.all=0&jms.redeliveryPolicy.maximumRedeliveries="+messagesExpected);
}
@Override
public void tearDown() throws Exception {
broker.stop();
}
@ -71,9 +74,7 @@ public class JDBCCommitExceptionTest extends TestCase {
int messagesReceived = receiveMessages(messagesExpected);
dumpMessages();
assertEquals("Messages expected doesn't equal messages received", messagesExpected, messagesReceived);
broker.stop();
}
@ -164,11 +165,10 @@ public class JDBCCommitExceptionTest extends TestCase {
broker.setPersistenceAdapter(jdbc);
broker.setPersistent(true);
broker.addConnector("tcp://localhost:61616");
connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();
return broker;
}
}