Add tests for ARTEMIS-230

This commit is contained in:
Julian Scheid 2015-09-28 20:09:25 +02:00
parent 235380d5df
commit 7fb30547f4
1 changed files with 45 additions and 5 deletions

View File

@ -35,6 +35,7 @@ import org.apache.activemq.artemis.tests.integration.stomp.util.ClientStompFrame
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnection;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionFactory;
import org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionV11;
import org.apache.activemq.artemis.core.protocol.stomp.Stomp;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.junit.After;
import org.junit.Assert;
@ -2312,9 +2313,48 @@ public class StompV11Test extends StompV11TestBase {
connV11.disconnect();
}
@Test
public void testReceiveContentType() throws Exception {
MessageConsumer consumer = session.createConsumer(queue);
connV11.connect(defUser, defPass);
ClientStompFrame frame = connV11.createFrame("SEND");
frame.addHeader("destination", getQueuePrefix() + getQueueName());
frame.addHeader(Stomp.Headers.CONTENT_TYPE, "text/plain");
frame.setBody("Hello World");
connV11.sendFrame(frame);
TextMessage message = (TextMessage) consumer.receive(1000);
Assert.assertNotNull(message);
Assert.assertEquals(
"text/plain",
message.getStringProperty(
org.apache.activemq.artemis.api.core.Message.HDR_CONTENT_TYPE.toString()));
}
@Test
public void testSendContentType() throws Exception {
connV11.connect(defUser, defPass);
this.subscribe(connV11, "sub1", "auto");
MessageProducer producer = session.createProducer(queue);
BytesMessage message = session.createBytesMessage();
message.setStringProperty(
org.apache.activemq.artemis.api.core.Message.HDR_CONTENT_TYPE.toString(),
"text/plain");
message.writeBytes("Hello World".getBytes(StandardCharsets.UTF_8));
producer.send(message);
ClientStompFrame frame = connV11.receiveFrame();
Assert.assertNotNull(frame);
Assert.assertEquals("text/plain", frame.getHeader(Stomp.Headers.CONTENT_TYPE));
connV11.disconnect();
}
}