Removes the dependence on the fixed ports, should prevent needless test failures.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1185804 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-10-18 19:05:15 +00:00
parent 6c82480a10
commit f3e9ec0b81
4 changed files with 23 additions and 34 deletions

View File

@ -18,9 +18,7 @@ package org.apache.activemq.web;
import org.apache.activemq.transport.stomp.StompConnection; import org.apache.activemq.transport.stomp.StompConnection;
import org.apache.activemq.transport.stomp.StompFrame; import org.apache.activemq.transport.stomp.StompFrame;
import org.apache.activemq.transport.stomp.Stomp;
import java.lang.Thread;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,12 +29,10 @@ import java.util.*;
import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.client.ContentExchange; import org.eclipse.jetty.client.ContentExchange;
import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.ByteArrayBuffer;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Message; import javax.jms.Message;
import javax.jms.TextMessage;
public class AjaxTest extends JettyTestSupport { public class AjaxTest extends JettyTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(AjaxTest.class); private static final Logger LOG = LoggerFactory.getLogger(AjaxTest.class);
@ -533,5 +529,4 @@ public class AjaxTest extends JettyTestSupport {
assertContains( "<response id='handlerB' destination='topic://topicB' >B2</response>\n", fullResponse ); assertContains( "<response id='handlerB' destination='topic://topicB' >B2</response>\n", fullResponse );
assertResponseCount( 4, fullResponse ); assertResponseCount( 4, fullResponse );
} }
} }

View File

@ -46,8 +46,8 @@ public final class JettyServer {
BrokerService broker = new BrokerService(); BrokerService broker = new BrokerService();
broker.setPersistent(false); broker.setPersistent(false);
broker.setUseJmx(true); broker.setUseJmx(true);
broker.addConnector("tcp://localhost:61616"); broker.addConnector("tcp://localhost:0");
broker.addConnector("stomp://localhost:61613"); broker.addConnector("stomp://localhost:0");
broker.start(); broker.start();
// lets publish some messages so that there is some stuff to browse // lets publish some messages so that there is some stuff to browse

View File

@ -54,8 +54,8 @@ public class JettyTestSupport extends TestCase {
broker = new BrokerService(); broker = new BrokerService();
broker.setPersistent(false); broker.setPersistent(false);
broker.setUseJmx(true); broker.setUseJmx(true);
tcpUri = broker.addConnector("tcp://localhost:61616").getConnectUri(); tcpUri = new URI(broker.addConnector("tcp://localhost:0").getPublishableConnectString());
stompUri = broker.addConnector("stomp://localhost:61613").getConnectUri(); stompUri = new URI(broker.addConnector("stomp://localhost:0").getPublishableConnectString());
broker.start(); broker.start();
broker.waitUntilStarted(); broker.waitUntilStarted();

View File

@ -19,8 +19,6 @@ package org.apache.activemq.web;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.management.ObjectName; import javax.management.ObjectName;
import org.apache.activemq.broker.jmx.DestinationViewMBean;
import org.apache.activemq.broker.jmx.SubscriptionViewMBean;
import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang.RandomStringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -131,12 +129,8 @@ public class RestTest extends JettyTestSupport {
httpClient.stop(); httpClient.stop();
ObjectName name = new ObjectName("org.apache.activemq" + ":BrokerName=localhost,Type=Queue,Destination=test");
ObjectName query = new ObjectName("org.apache.activemq:BrokerName=localhost,Type=Subscription,destinationType=Queue,destinationName=test,*"); ObjectName query = new ObjectName("org.apache.activemq:BrokerName=localhost,Type=Subscription,destinationType=Queue,destinationName=test,*");
Set subs = broker.getManagementContext().queryNames(query, null); Set<ObjectName> subs = broker.getManagementContext().queryNames(query, null);
assertEquals("Consumers not closed", 0 , subs.size()); assertEquals("Consumers not closed", 0 , subs.size());
} }
} }