git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@994978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2010-09-08 10:39:17 +00:00
parent 4c4f0d18ce
commit f772e5f8c7
1 changed files with 27 additions and 0 deletions

View File

@ -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 JettyTestSupport {
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());
}
}
}