resolve the dependency on fixed ports 61616 and 61613.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1075051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-02-27 13:21:15 +00:00
parent 72a0fd1a43
commit 9308db8b75
2 changed files with 82 additions and 78 deletions

View File

@ -266,7 +266,7 @@ public class AjaxTest extends JettyTestSupport {
// stomp client queues some messages
StompConnection connection = new StompConnection();
connection.open("localhost", 61613);
connection.open(stompUri.getHost(), stompUri.getPort());
connection.connect("user", "password");
HashMap<String, String> headers = new HashMap<String, String>();
headers.put( "amq-msg-type", "text" );
@ -319,7 +319,7 @@ public class AjaxTest extends JettyTestSupport {
contentExchange.waitForDone();
StompConnection connection = new StompConnection();
connection.open("localhost", 61613);
connection.open(stompUri.getHost(), stompUri.getPort());
connection.connect("user", "password");
connection.subscribe( "/queue/test" );

View File

@ -17,6 +17,7 @@
package org.apache.activemq.web;
import java.net.Socket;
import java.net.URI;
import java.net.URL;
import javax.jms.Connection;
@ -46,12 +47,15 @@ public class JettyTestSupport extends TestCase {
Session session;
MessageProducer producer;
URI tcpUri;
URI stompUri;
protected void setUp() throws Exception {
broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(true);
broker.addConnector("tcp://localhost:61616");
broker.addConnector("stomp://localhost:61613");
tcpUri = broker.addConnector("tcp://localhost:61616").getConnectUri();
stompUri = broker.addConnector("stomp://localhost:61613").getConnectUri();
broker.start();
broker.waitUntilStarted();
@ -71,7 +75,7 @@ public class JettyTestSupport extends TestCase {
server.start();
waitForJettySocketToAccept("http://localhost:8080");
factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
factory = new ActiveMQConnectionFactory(tcpUri);
connection = factory.createConnection();
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);