activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1185804 - in /activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web: AjaxTest.java JettyServer.java JettyTestSupport.java RestTest.java
Date Tue, 18 Oct 2011 19:05:15 GMT
Author: tabish
Date: Tue Oct 18 19:05:15 2011
New Revision: 1185804

URL: http://svn.apache.org/viewvc?rev=1185804&view=rev
Log:
Removes the dependence on the fixed ports, should prevent needless test failures.

Modified:
    activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
    activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyServer.java
    activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
    activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java

Modified: activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java?rev=1185804&r1=1185803&r2=1185804&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java (original)
+++ activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java Tue
Oct 18 19:05:15 2011
@@ -18,9 +18,7 @@ package org.apache.activemq.web;
 
 import org.apache.activemq.transport.stomp.StompConnection;
 import org.apache.activemq.transport.stomp.StompFrame;
-import org.apache.activemq.transport.stomp.Stomp;
 
-import java.lang.Thread;
 import java.net.SocketTimeoutException;
 
 import org.slf4j.Logger;
@@ -31,12 +29,10 @@ import java.util.*;
 import org.eclipse.jetty.io.Buffer;
 import org.eclipse.jetty.client.ContentExchange;
 import org.eclipse.jetty.client.HttpClient;
-import org.eclipse.jetty.http.HttpFields;
 import org.eclipse.jetty.io.ByteArrayBuffer;
 
 import javax.jms.MessageProducer;
 import javax.jms.Message;
-import javax.jms.TextMessage;
 
 public class AjaxTest extends JettyTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(AjaxTest.class);
@@ -533,5 +529,4 @@ public class AjaxTest extends JettyTestS
         assertContains( "<response id='handlerB' destination='topic://topicB' >B2</response>\n",
fullResponse );
         assertResponseCount( 4, fullResponse );
      }
-
 }

Modified: activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyServer.java?rev=1185804&r1=1185803&r2=1185804&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyServer.java
(original)
+++ activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyServer.java
Tue Oct 18 19:05:15 2011
@@ -27,8 +27,8 @@ import org.eclipse.jetty.webapp.WebAppCo
 /**
  * A simple bootstrap class for starting Jetty in your IDE using the local web
  * application.
- * 
- * 
+ *
+ *
  */
 public final class JettyServer {
 
@@ -46,8 +46,8 @@ public final class JettyServer {
         BrokerService broker = new BrokerService();
         broker.setPersistent(false);
         broker.setUseJmx(true);
-        broker.addConnector("tcp://localhost:61616");
-        broker.addConnector("stomp://localhost:61613");
+        broker.addConnector("tcp://localhost:0");
+        broker.addConnector("stomp://localhost:0");
         broker.start();
 
         // lets publish some messages so that there is some stuff to browse

Modified: activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java?rev=1185804&r1=1185803&r2=1185804&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
(original)
+++ activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/JettyTestSupport.java
Tue Oct 18 19:05:15 2011
@@ -54,8 +54,8 @@ public class JettyTestSupport extends Te
         broker = new BrokerService();
         broker.setPersistent(false);
         broker.setUseJmx(true);
-        tcpUri = broker.addConnector("tcp://localhost:61616").getConnectUri();
-        stompUri = broker.addConnector("stomp://localhost:61613").getConnectUri();
+        tcpUri = new URI(broker.addConnector("tcp://localhost:0").getPublishableConnectString());
+        stompUri = new URI(broker.addConnector("stomp://localhost:0").getPublishableConnectString());
         broker.start();
         broker.waitUntilStarted();
 

Modified: activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java?rev=1185804&r1=1185803&r2=1185804&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java (original)
+++ activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java Tue
Oct 18 19:05:15 2011
@@ -19,8 +19,6 @@ package org.apache.activemq.web;
 import javax.jms.TextMessage;
 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.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,11 +29,11 @@ import java.util.Set;
 
 public class RestTest extends JettyTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(RestTest.class);
-	
+
 	public void testConsume() throws Exception {
 	    producer.send(session.createTextMessage("test"));
 	    LOG.info("message sent");
-	    
+
 	    HttpClient httpClient = new HttpClient();
         httpClient.start();
         ContentExchange contentExchange = new ContentExchange();
@@ -43,9 +41,9 @@ public class RestTest extends JettyTestS
         contentExchange.setURL("http://localhost:8080/message/test?readTimeout=1000&type=queue");
         httpClient.send(contentExchange);
         contentExchange.waitForDone();
-        assertEquals("test", contentExchange.getResponseContent());	    
+        assertEquals("test", contentExchange.getResponseContent());
 	}
-	
+
 	public void testSubscribeFirst() throws Exception {
         HttpClient httpClient = new HttpClient();
         httpClient.start();
@@ -53,27 +51,27 @@ public class RestTest extends JettyTestS
         httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
         contentExchange.setURL("http://localhost:8080/message/test?readTimeout=5000&type=queue");
         httpClient.send(contentExchange);
-        
+
         Thread.sleep(1000);
-        
+
         producer.send(session.createTextMessage("test"));
         LOG.info("message sent");
-        
+
         contentExchange.waitForDone();
-        assertEquals("test", contentExchange.getResponseContent());	    
+        assertEquals("test", contentExchange.getResponseContent());
 	}
-	
+
 	public void testSelector() throws Exception {
 	    TextMessage msg1 = session.createTextMessage("test1");
 	    msg1.setIntProperty("test", 1);
 	    producer.send(msg1);
 	    LOG.info("message 1 sent");
-	    
+
 	    TextMessage msg2 = session.createTextMessage("test2");
 	    msg2.setIntProperty("test", 2);
 	    producer.send(msg2);
 	    LOG.info("message 2 sent");
-	    
+
         HttpClient httpClient = new HttpClient();
         httpClient.start();
         ContentExchange contentExchange = new ContentExchange();
@@ -84,20 +82,20 @@ public class RestTest extends JettyTestS
         contentExchange.waitForDone();
         assertEquals("test2", contentExchange.getResponseContent());
 	}
-	
+
 	// test for https://issues.apache.org/activemq/browse/AMQ-2827
 	public void testCorrelation() throws Exception {
 	    for (int i = 0; i < 200; i++) {
             String correlId = "RESTY" + RandomStringUtils.randomNumeric(10);
-            
+
             TextMessage message = session.createTextMessage(correlId);
             message.setStringProperty("correlationId", correlId);
             message.setJMSCorrelationID(correlId);
-            
+
             LOG.info("Sending: " + correlId);
-            
+
             producer.send(message);
-            
+
             HttpClient httpClient = new HttpClient();
             httpClient.start();
             ContentExchange contentExchange = new ContentExchange();
@@ -131,12 +129,8 @@ public class RestTest extends JettyTestS
 
         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,*");
-        Set subs = broker.getManagementContext().queryNames(query, null);
+        Set<ObjectName> subs = broker.getManagementContext().queryNames(query, null);
         assertEquals("Consumers not closed", 0 , subs.size());
     }
-
 }



Mime
View raw message