activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r994978 - /activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java
Date Wed, 08 Sep 2010 10:39:17 GMT
Author: dejanb
Date: Wed Sep  8 10:39:17 2010
New Revision: 994978

URL: http://svn.apache.org/viewvc?rev=994978&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2827 - test case

Modified:
    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/RestTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java?rev=994978&r1=994977&r2=994978&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 Wed
Sep  8 10:39:17 2010
@@ -18,6 +18,7 @@ package org.apache.activemq.web;
 
 import javax.jms.TextMessage;
 
+import org.apache.commons.lang.RandomStringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.eclipse.jetty.client.ContentExchange;
@@ -78,5 +79,31 @@ 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();
+            httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
+            contentExchange.setURL("http://localhost:8080/message/test?readTimeout=1000&type=queue&clientId=test");
+            httpClient.send(contentExchange);
+            contentExchange.waitForDone();
+            LOG.info("Received: [" + contentExchange.getResponseStatus() + "] " + contentExchange.getResponseContent());
+            assertEquals(200, contentExchange.getResponseStatus());
+            assertEquals(correlId, contentExchange.getResponseContent());
+	    }
+	}
 
 }



Mime
View raw message