From 7fb30547f4ad1d3cfbfbb6e1bc7f7c2f78105d92 Mon Sep 17 00:00:00 2001 From: Julian Scheid Date: Mon, 28 Sep 2015 20:09:25 +0200 Subject: [PATCH] Add tests for ARTEMIS-230 --- .../integration/stomp/v11/StompV11Test.java | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java index 945da81737..6c402714fa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java @@ -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(); + } + } - - - - -