You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2017/12/09 21:15:28 UTC
[1/2] qpid-broker-j git commit: QPID-6933: [System Tests] Remove
redundant MessageProtocolConversionTest
Repository: qpid-broker-j
Updated Branches:
refs/heads/master b1127b7b9 -> 4ac36ca5e
QPID-6933: [System Tests] Remove redundant MessageProtocolConversionTest
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/fc0fd3e0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/fc0fd3e0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/fc0fd3e0
Branch: refs/heads/master
Commit: fc0fd3e09a403cb5a7ac27e82471f5f4204d7132
Parents: b1127b7
Author: Alex Rudyy <or...@apache.org>
Authored: Sat Dec 9 18:36:51 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Sat Dec 9 18:36:51 2017 +0000
----------------------------------------------------------------------
.../message/MessageProtocolConversionTest.java | 325 -------------------
test-profiles/CPPExcludes | 3 -
test-profiles/Java10Excludes | 2 -
test-profiles/JavaPre010Excludes | 1 -
4 files changed, 331 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/fc0fd3e0/systests/src/test/java/org/apache/qpid/server/message/MessageProtocolConversionTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/server/message/MessageProtocolConversionTest.java b/systests/src/test/java/org/apache/qpid/server/message/MessageProtocolConversionTest.java
deleted file mode 100644
index a796852..0000000
--- a/systests/src/test/java/org/apache/qpid/server/message/MessageProtocolConversionTest.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.message;
-
-import org.apache.qpid.QpidException;
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-import javax.jms.*;
-import javax.naming.NamingException;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-
-public class MessageProtocolConversionTest extends QpidBrokerTestCase
-{
-
- private static final int TIMEOUT = 1500;
- private Connection _connection_0_9_1;
- private Connection _connection_0_10;
-
- private static final boolean BOOLEAN_TEST_VAL = true;
- private static final byte BYTE_TEST_VAL = (byte) 4;
- private static final byte[] BYTES_TEST_VAL = {5, 4, 3, 2, 1};
- private static final char CHAR_TEST_VAL = 'x';
- private static final double DOUBLE_TEST_VAL = Double.MAX_VALUE;
- private static final float FLOAT_TEST_VAL = Float.MAX_VALUE;
- private static final int INT_TEST_VAL = -73;
- private static final long LONG_TEST_VAL = Long.MIN_VALUE / 2l;
- private static final short SHORT_TEST_VAL = -586;
- private static final String STRING_TEST_VAL = "This is a test text message";
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- setTestSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
- _connection_0_10 = getConnection();
- setTestSystemProperty(ClientProperties.AMQP_VERSION, "0-9-1");
- _connection_0_9_1 = getConnection();
- }
-
- public void test0_9_1_to_0_10_conversion() throws JMSException, QpidException, NamingException
- {
- doConversionTests(_connection_0_9_1, _connection_0_10);
- }
-
- public void test_0_10_to_0_9_1_conversion() throws JMSException, QpidException, NamingException
- {
-
- doConversionTests(_connection_0_10, _connection_0_9_1);
- }
-
- private void doConversionTests(Connection producerConn, Connection consumerConn)
- throws JMSException, QpidException, NamingException
- {
- Session producerSession = producerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Session consumerSession = consumerConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Queue queue = getTestQueue();
-
- MessageProducer producer = producerSession.createProducer(queue);
- MessageConsumer consumer = consumerSession.createConsumer(queue);
-
- consumerConn.start();
- producerConn.start();
-
- // Text Message
-
- Message m = producerSession.createTextMessage(STRING_TEST_VAL);
- producer.send(m);
- m = consumer.receive(TIMEOUT);
-
- assertNotNull("Expected text message did not arrive", m);
- assertTrue("Received message not an instance of TextMessage (" + m.getClass().getName() + " instead)", m instanceof TextMessage);
- assertEquals("Message text not as expected", STRING_TEST_VAL, ((TextMessage) m).getText());
-
- // Map Message
-
- MapMessage mapMessage = producerSession.createMapMessage();
- mapMessage.setBoolean("boolean", BOOLEAN_TEST_VAL);
- mapMessage.setByte("byte", BYTE_TEST_VAL);
- mapMessage.setBytes("bytes", BYTES_TEST_VAL);
- mapMessage.setChar("char", CHAR_TEST_VAL);
- mapMessage.setDouble("double", DOUBLE_TEST_VAL);
- mapMessage.setFloat("float", FLOAT_TEST_VAL);
- mapMessage.setInt("int", INT_TEST_VAL);
- mapMessage.setLong("long", LONG_TEST_VAL);
- mapMessage.setShort("short", SHORT_TEST_VAL);
- mapMessage.setString("string", STRING_TEST_VAL);
-
- producer.send(mapMessage);
-
- m = consumer.receive(TIMEOUT);
-
- assertNotNull("Expected map message message did not arrive", m);
- assertTrue("Received message not an instance of MapMessage (" + m.getClass().getName() + " instead)", m instanceof MapMessage);
- MapMessage receivedMapMessage = (MapMessage) m;
- assertEquals("Map message boolean value not as expected", BOOLEAN_TEST_VAL, receivedMapMessage.getBoolean("boolean"));
- assertEquals("Map message byte value not as expected", BYTE_TEST_VAL, receivedMapMessage.getByte("byte"));
- assertTrue("Map message bytes value not as expected", Arrays.equals(BYTES_TEST_VAL, receivedMapMessage.getBytes("bytes")));
- assertEquals("Map message char value not as expected", CHAR_TEST_VAL, receivedMapMessage.getChar("char"));
- assertEquals("Map message double value not as expected", DOUBLE_TEST_VAL, receivedMapMessage.getDouble("double"));
- assertEquals("Map message float value not as expected", FLOAT_TEST_VAL, receivedMapMessage.getFloat("float"));
- assertEquals("Map message int value not as expected", INT_TEST_VAL, receivedMapMessage.getInt("int"));
- assertEquals("Map message long value not as expected", LONG_TEST_VAL, receivedMapMessage.getLong("long"));
- assertEquals("Map message short value not as expected", SHORT_TEST_VAL, receivedMapMessage.getShort("short"));
- assertEquals("Map message string value not as expected", STRING_TEST_VAL, receivedMapMessage.getString("string"));
- ArrayList expectedNames = Collections.list(mapMessage.getMapNames());
- Collections.sort(expectedNames);
- ArrayList actualNames = Collections.list(receivedMapMessage.getMapNames());
- Collections.sort(actualNames);
- assertEquals("Map message keys not as expected", expectedNames, actualNames);
-
- // Stream Message
-
- StreamMessage streamMessage = producerSession.createStreamMessage();
- streamMessage.writeString(STRING_TEST_VAL);
- streamMessage.writeShort(SHORT_TEST_VAL);
- streamMessage.writeLong(LONG_TEST_VAL);
- streamMessage.writeInt(INT_TEST_VAL);
- streamMessage.writeFloat(FLOAT_TEST_VAL);
- streamMessage.writeDouble(DOUBLE_TEST_VAL);
- streamMessage.writeChar(CHAR_TEST_VAL);
- streamMessage.writeBytes(BYTES_TEST_VAL);
- streamMessage.writeByte(BYTE_TEST_VAL);
- streamMessage.writeBoolean(BOOLEAN_TEST_VAL);
-
- producer.send(streamMessage);
-
- m = consumer.receive(TIMEOUT);
-
- assertNotNull("Expected stream message message did not arrive", m);
- assertTrue("Received message not an instance of StreamMessage (" + m.getClass().getName() + " instead)", m instanceof StreamMessage);
- StreamMessage receivedStreamMessage = (StreamMessage) m;
-
- assertEquals("Stream message read string not as expected", STRING_TEST_VAL, receivedStreamMessage.readString());
- assertEquals("Stream message read short not as expected", SHORT_TEST_VAL, receivedStreamMessage.readShort());
- assertEquals("Stream message read long not as expected", LONG_TEST_VAL, receivedStreamMessage.readLong());
- assertEquals("Stream message read int not as expected", INT_TEST_VAL, receivedStreamMessage.readInt());
- assertEquals("Stream message read float not as expected", FLOAT_TEST_VAL, receivedStreamMessage.readFloat());
- assertEquals("Stream message read double not as expected", DOUBLE_TEST_VAL, receivedStreamMessage.readDouble());
- assertEquals("Stream message read char not as expected", CHAR_TEST_VAL, receivedStreamMessage.readChar());
- byte[] bytesVal = new byte[BYTES_TEST_VAL.length];
- receivedStreamMessage.readBytes(bytesVal);
- assertTrue("Stream message read bytes not as expected", Arrays.equals(BYTES_TEST_VAL, bytesVal));
- assertEquals("Stream message read byte not as expected", BYTE_TEST_VAL, receivedStreamMessage.readByte());
- assertEquals("Stream message read boolean not as expected", BOOLEAN_TEST_VAL, receivedStreamMessage.readBoolean());
-
- try
- {
- receivedStreamMessage.readByte();
- fail("Unexpected remaining bytes in stream message");
- }
- catch(MessageEOFException e)
- {
- // pass
- }
-
- // Object Message
-
- ObjectMessage objectMessage = producerSession.createObjectMessage();
- objectMessage.setObject(STRING_TEST_VAL);
-
- producer.send(objectMessage);
-
- m = consumer.receive(TIMEOUT);
-
- assertNotNull("Expected object message message did not arrive", m);
- assertTrue("Received message not an instance of ObjectMessage (" + m.getClass().getName() + " instead)", m instanceof ObjectMessage);
- ObjectMessage receivedObjectMessage = (ObjectMessage) m;
- assertEquals("Object message value not as expected", STRING_TEST_VAL, receivedObjectMessage.getObject());
-
-
- // Bytes Message
-
- BytesMessage bytesMessage = producerSession.createBytesMessage();
- bytesMessage.writeBytes(BYTES_TEST_VAL);
-
- producer.send(bytesMessage);
-
- m = consumer.receive(TIMEOUT);
-
- assertNotNull("Expected bytes message message did not arrive", m);
- assertTrue("Received message not an instance of BytesMessage (" + m.getClass().getName() + " instead)", m instanceof BytesMessage);
- BytesMessage receivedBytesMessage = (BytesMessage) m;
- bytesVal = new byte[BYTES_TEST_VAL.length];
- receivedBytesMessage.readBytes(bytesVal);
- assertTrue("Bytes message read bytes not as expected", Arrays.equals(BYTES_TEST_VAL, bytesVal));
-
- try
- {
- receivedBytesMessage.readByte();
- fail("Unexpected remaining bytes in stream message");
- }
- catch(MessageEOFException e)
- {
- // pass
- }
-
- // Headers / properties tests
-
- Message msg = producerSession.createMessage();
- msg.setJMSCorrelationID("testCorrelationId");
- msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
- msg.setJMSPriority(7);
- msg.setJMSType("testType");
-
- msg.setBooleanProperty("boolean", BOOLEAN_TEST_VAL);
- msg.setByteProperty("byte", BYTE_TEST_VAL);
- msg.setDoubleProperty("double", DOUBLE_TEST_VAL);
- msg.setFloatProperty("float", FLOAT_TEST_VAL);
- msg.setIntProperty("int", INT_TEST_VAL);
- msg.setLongProperty("long", LONG_TEST_VAL);
- msg.setShortProperty("short", SHORT_TEST_VAL);
- msg.setStringProperty("string", STRING_TEST_VAL);
-
- producer.send(msg);
-
- m = consumer.receive(TIMEOUT);
- assertNotNull("Expected message did not arrive", m);
- assertEquals("JMSMessageID differs", msg.getJMSMessageID(), m.getJMSMessageID());
- assertEquals("JMSCorrelationID differs",msg.getJMSCorrelationID(),m.getJMSCorrelationID());
- assertEquals("JMSDeliveryMode differs",msg.getJMSDeliveryMode(),m.getJMSDeliveryMode());
- assertEquals("JMSPriority differs",msg.getJMSPriority(),m.getJMSPriority());
- assertEquals("JMSType differs",msg.getJMSType(),m.getJMSType());
-
- assertEquals("Message boolean property not as expected", BOOLEAN_TEST_VAL, m.getBooleanProperty("boolean"));
- assertEquals("Message byte property not as expected", BYTE_TEST_VAL, m.getByteProperty("byte"));
- assertEquals("Message double property not as expected", DOUBLE_TEST_VAL, m.getDoubleProperty("double"));
- assertEquals("Message float property not as expected", FLOAT_TEST_VAL, m.getFloatProperty("float"));
- assertEquals("Message int property not as expected", INT_TEST_VAL, m.getIntProperty("int"));
- assertEquals("Message long property not as expected", LONG_TEST_VAL, m.getLongProperty("long"));
- assertEquals("Message short property not as expected", SHORT_TEST_VAL, m.getShortProperty("short"));
- assertEquals("Message string property not as expected", STRING_TEST_VAL, m.getStringProperty("string"));
-
- ArrayList<String> sentPropNames = Collections.list(msg.getPropertyNames());
- Collections.sort(sentPropNames);
- ArrayList<String> receivedPropNames = Collections.list(m.getPropertyNames());
- Collections.sort(receivedPropNames);
-
- // Shouldn't really need to do this, the client should be hiding these from us
- removeSyntheticProperties(sentPropNames);
- removeSyntheticProperties(receivedPropNames);
-
- assertEquals("Property names were not as expected", sentPropNames, receivedPropNames);
-
- // Test Reply To Queue
-
- Destination replyToDestination = producerSession.createTemporaryQueue();
- MessageConsumer replyToConsumer = producerSession.createConsumer(replyToDestination);
- msg = producerSession.createMessage();
- msg.setJMSReplyTo(replyToDestination);
- producer.send(msg);
-
- m = consumer.receive(TIMEOUT);
- assertNotNull("Expected message did not arrive", m);
- assertNotNull("Message does not have ReplyTo set", m.getJMSReplyTo());
-
- MessageProducer responseProducer = consumerSession.createProducer(m.getJMSReplyTo());
- responseProducer.send(consumerSession.createMessage());
-
- assertNotNull("Expected response message did not arrive", replyToConsumer.receive(TIMEOUT));
-
- // Test Reply To Topic
-
- replyToDestination = producerSession.createTemporaryTopic();
- replyToConsumer = producerSession.createConsumer(replyToDestination);
- msg = producerSession.createMessage();
- msg.setJMSReplyTo(replyToDestination);
- producer.send(msg);
-
- m = consumer.receive(TIMEOUT);
- assertNotNull("Expected message did not arrive", m);
- assertNotNull("Message does not have ReplyTo set", m.getJMSReplyTo());
-
- responseProducer = consumerSession.createProducer(m.getJMSReplyTo());
- responseProducer.send(consumerSession.createMessage());
-
- assertNotNull("Expected response message did not arrive", replyToConsumer.receive(TIMEOUT));
-
-
- }
-
- private void removeSyntheticProperties(ArrayList<String> propNames)
- {
- Iterator<String> nameIter = propNames.iterator();
- while(nameIter.hasNext())
- {
- String propName = nameIter.next();
- if(propName.startsWith("x-jms") || propName.startsWith("JMS_QPID"))
- {
- nameIter.remove();
- }
- }
- }
-
- @Override
- public void tearDown() throws Exception
- {
- _connection_0_9_1.close();
- _connection_0_10.close();
- super.tearDown();
- }
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/fc0fd3e0/test-profiles/CPPExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/CPPExcludes b/test-profiles/CPPExcludes
index 6cf6646..c85821b 100755
--- a/test-profiles/CPPExcludes
+++ b/test-profiles/CPPExcludes
@@ -139,9 +139,6 @@ org.apache.qpid.server.queue.MessageGroupQueueTest#testConsumerCloseGroupAssignm
org.apache.qpid.server.queue.MessageGroupQueueTest#testConsumerCloseWithRelease
org.apache.qpid.server.queue.MessageGroupQueueTest#testGroupAssignmentSurvivesEmpty
-// CPP Broker does not implement message conversion from 0-9-1
-org.apache.qpid.server.message.MessageProtocolConversionTest#*
-
// passwd script is a Qpid Broker-J specific command line tool
org.apache.qpid.scripts.QpidPasswdTest#*
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/fc0fd3e0/test-profiles/Java10Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes
index f1f3529..cc4e13f 100644
--- a/test-profiles/Java10Excludes
+++ b/test-profiles/Java10Excludes
@@ -126,8 +126,6 @@ org.apache.qpid.systest.MessageCompressionTest#*
org.apache.qpid.test.unit.client.connection.ConnectionFactoryTest#*
// Specifically testing the 0-x Connection
org.apache.qpid.test.unit.client.connection.ConnectionTest#*
-// Tests conversion between 0-8/9/9-1 and 0-10
-org.apache.qpid.server.message.MessageProtocolConversionTest#*
// Tests the interaction between the Broker's supported protocols and what the 0-x client agrees to
org.apache.qpid.server.SupportedProtocolVersionsTest#*
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/fc0fd3e0/test-profiles/JavaPre010Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/JavaPre010Excludes b/test-profiles/JavaPre010Excludes
index 76bd08c..7dc8f11 100644
--- a/test-profiles/JavaPre010Excludes
+++ b/test-profiles/JavaPre010Excludes
@@ -23,7 +23,6 @@
// These tests requires a broker capable of 0-8/0-9/0-9-1 and 0-10 concurrently
org.apache.qpid.test.client.message.JMSDestinationTest#testReceiveResend
-org.apache.qpid.server.message.MessageProtocolConversionTest#*
//QPID-3422: test fails because ring queue is not implemented on Apache Qpid Broker-J
org.apache.qpid.test.client.destination.AddressBasedDestinationTest#testBrowseMode
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/2] qpid-broker-j git commit: QPID-6933: [System Tests] Move
JMSReplyToTest and some tests from JMSDestinationTest into JMS 1.1 system
tests
Posted by or...@apache.org.
QPID-6933: [System Tests] Move JMSReplyToTest and some tests from JMSDestinationTest into JMS 1.1 system tests
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/4ac36ca5
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/4ac36ca5
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/4ac36ca5
Branch: refs/heads/master
Commit: 4ac36ca5e7169c19f5c39943d563d5253fbfe545
Parents: fc0fd3e
Author: Alex Rudyy <or...@apache.org>
Authored: Sat Dec 9 21:15:12 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Sat Dec 9 21:15:12 2017 +0000
----------------------------------------------------------------------
.../jms_1_1/message/JMSDestinationTest.java | 192 +++++++++++++++++++
.../jms_1_1/message/JMSReplyToTest.java | 128 +++++++++++++
.../test/client/message/JMSDestinationTest.java | 102 ----------
.../test/client/message/JMSReplyToTest.java | 169 ----------------
test-profiles/cpp.excludes | 3 -
5 files changed, 320 insertions(+), 274 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac36ca5/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSDestinationTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSDestinationTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSDestinationTest.java
new file mode 100644
index 0000000..2197000
--- /dev/null
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSDestinationTest.java
@@ -0,0 +1,192 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.systests.jms_1_1.message;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.Topic;
+
+import org.junit.Test;
+
+import org.apache.qpid.systests.JmsTestBase;
+import org.apache.qpid.systests.Utils;
+
+public class JMSDestinationTest extends JmsTestBase
+{
+
+ @Test
+ public void messageSentToQueueComesBackWithTheSameJMSDestination() throws Exception
+ {
+ Queue queue = createQueue(getTestName());
+ Connection connection = getConnection();
+ try
+ {
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ Utils.sendMessages(session, queue, 1);
+
+ connection.start();
+
+ Message receivedMessage = consumer.receive(getReceiveTimeout());
+ assertNotNull("Message should not be null", receivedMessage);
+
+ Destination receivedDestination = receivedMessage.getJMSDestination();
+
+ assertNotNull("JMSDestination should not be null", receivedDestination);
+ assertTrue("Unexpected destination type", receivedDestination instanceof Queue);
+ assertEquals("Unexpected destination name",
+ queue.getQueueName(),
+ ((Queue) receivedDestination).getQueueName());
+ }
+ finally
+ {
+ connection.close();
+ }
+ }
+
+ @Test
+ public void messageSentToTopicComesBackWithTheSameJMSDestination() throws Exception
+ {
+ Topic topic = createTopic(getTestName());
+ Connection connection = getConnection();
+ try
+ {
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(topic);
+
+ Utils.sendMessages(session, topic, 1);
+
+ connection.start();
+
+ Message receivedMessage = consumer.receive(getReceiveTimeout());
+ assertNotNull("Message should not be null", receivedMessage);
+
+ Destination receivedDestination = receivedMessage.getJMSDestination();
+
+ assertNotNull("JMSDestination should not be null", receivedDestination);
+ assertTrue("Unexpected destination type", receivedDestination instanceof Topic);
+ assertEquals("Unexpected destination name",
+ topic.getTopicName(),
+ ((Topic) receivedDestination).getTopicName());
+ }
+ finally
+ {
+ connection.close();
+ }
+ }
+
+ @Test
+ public void messageSentToQueueComesBackWithTheSameJMSDestinationWhenReceivedAsynchronously() throws Exception
+ {
+ Queue queue = createQueue(getTestName());
+ Connection connection = getConnection();
+ try
+ {
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ Utils.sendMessages(session, queue, 1);
+
+ connection.start();
+
+ CountDownLatch receiveLatch = new CountDownLatch(1);
+ AtomicReference<Message> messageHolder = new AtomicReference<>();
+ consumer.setMessageListener(message -> {
+ messageHolder.set(message);
+ receiveLatch.countDown();
+ });
+ assertTrue("Timed out waiting for message to be received ",
+ receiveLatch.await(getReceiveTimeout(), TimeUnit.MILLISECONDS));
+ assertNotNull("Message should not be null", messageHolder.get());
+
+ Destination receivedDestination = messageHolder.get().getJMSDestination();
+
+ assertNotNull("JMSDestination should not be null", receivedDestination);
+ assertTrue("Unexpected destination type", receivedDestination instanceof Queue);
+ assertEquals("Unexpected destination name",
+ queue.getQueueName(),
+ ((Queue) receivedDestination).getQueueName());
+ }
+ finally
+ {
+ connection.close();
+ }
+ }
+
+ @Test
+ public void testReceiveResend() throws Exception
+ {
+ Queue queue = createQueue(getTestName());
+ Connection connection = getConnection();
+ try
+ {
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ Utils.sendMessages(session, queue, 1);
+
+ connection.start();
+
+ Message receivedMessage = consumer.receive(getReceiveTimeout());
+ assertNotNull("Message should not be null", receivedMessage);
+
+ Destination receivedDestination = receivedMessage.getJMSDestination();
+
+ assertNotNull("JMSDestination should not be null", receivedDestination);
+ assertTrue("Unexpected destination type", receivedDestination instanceof Queue);
+ assertEquals("Unexpected destination name",
+ queue.getQueueName(),
+ ((Queue) receivedDestination).getQueueName());
+
+ MessageProducer producer = session.createProducer(queue);
+ producer.send(receivedMessage);
+
+ Message message = consumer.receive(getReceiveTimeout());
+ assertNotNull("Message should not be null", message);
+
+ Destination destination = message.getJMSDestination();
+
+ assertNotNull("JMSDestination should not be null", destination);
+ assertTrue("Unexpected destination type", destination instanceof Queue);
+ assertEquals("Unexpected destination name",
+ queue.getQueueName(),
+ ((Queue) destination).getQueueName());
+ }
+ finally
+ {
+ connection.close();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac36ca5/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSReplyToTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSReplyToTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSReplyToTest.java
new file mode 100644
index 0000000..b30c136
--- /dev/null
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/message/JMSReplyToTest.java
@@ -0,0 +1,128 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.systests.jms_1_1.message;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+
+import org.junit.Test;
+
+import org.apache.qpid.systests.JmsTestBase;
+
+public class JMSReplyToTest extends JmsTestBase
+{
+ @Test
+ public void testRequestResponseUsingJmsReplyTo() throws Exception
+ {
+ Queue requestQueue = createQueue(getTestName() + ".request");
+ Queue replyToQueue = createQueue(getTestName() + ".reply");
+ Connection connection = getConnection();
+ try
+ {
+ AtomicReference<Throwable> exceptionHolder = createAsynchronousConsumer(connection, requestQueue);
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer replyConsumer = session.createConsumer(replyToQueue);
+
+ Message requestMessage = session.createTextMessage("Request");
+ requestMessage.setJMSReplyTo(replyToQueue);
+ MessageProducer producer = session.createProducer(requestQueue);
+ producer.send(requestMessage);
+
+ Message responseMessage = replyConsumer.receive(getReceiveTimeout());
+ assertNotNull("Response message not received", responseMessage);
+ assertEquals("Correlation id of the response should match message id of the request",
+ responseMessage.getJMSCorrelationID(), requestMessage.getJMSMessageID());
+ assertNull("Unexpected exception in responder", exceptionHolder.get());
+ }
+ finally
+ {
+ connection.close();
+ }
+ }
+
+ @Test
+ public void testRequestResponseUsingTemporaryJmsReplyTo() throws Exception
+ {
+ Queue requestQueue = createQueue(getTestName() + ".request");
+ Connection connection = getConnection();
+ try
+ {
+ AtomicReference<Throwable> exceptionHolder = createAsynchronousConsumer(connection, requestQueue);
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ TemporaryQueue replyToQueue = session.createTemporaryQueue();
+
+ MessageConsumer replyConsumer = session.createConsumer(replyToQueue);
+
+ Message requestMessage = session.createTextMessage("Request");
+ requestMessage.setJMSReplyTo(replyToQueue);
+ MessageProducer producer = session.createProducer(requestQueue);
+ producer.send(requestMessage);
+
+ Message responseMessage = replyConsumer.receive(getReceiveTimeout());
+ assertNotNull("Response message not received", responseMessage);
+ assertEquals("Correlation id of the response should match message id of the request",
+ responseMessage.getJMSCorrelationID(), requestMessage.getJMSMessageID());
+ assertNull("Unexpected exception in responder", exceptionHolder.get());
+ }
+ finally
+ {
+ connection.close();
+ }
+ }
+
+ private AtomicReference<Throwable> createAsynchronousConsumer(Connection connection, Queue requestQueue)
+ throws JMSException
+ {
+ final Session responderSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ final AtomicReference<Throwable> caughtException = new AtomicReference<>();
+ final MessageConsumer requestConsumer = responderSession.createConsumer(requestQueue);
+ requestConsumer.setMessageListener(message -> {
+ try
+ {
+ Destination replyTo = message.getJMSReplyTo();
+ MessageProducer responseProducer = responderSession.createProducer(replyTo);
+ Message responseMessage = responderSession.createMessage();
+ responseMessage.setJMSCorrelationID(message.getJMSMessageID());
+ responseProducer.send(responseMessage);
+ }
+ catch (Throwable t)
+ {
+ caughtException.set(t);
+ }
+ });
+ return caughtException;
+ }
+}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac36ca5/systests/src/test/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/test/client/message/JMSDestinationTest.java b/systests/src/test/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
index 5101e68..1fcc494 100644
--- a/systests/src/test/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
+++ b/systests/src/test/java/org/apache/qpid/test/client/message/JMSDestinationTest.java
@@ -20,19 +20,14 @@
*/
package org.apache.qpid.test.client.message;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
-import javax.jms.Topic;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.CustomJMSXProperty;
@@ -51,9 +46,6 @@ public class JMSDestinationTest extends QpidBrokerTestCase
private Connection _connection;
private Session _session;
- private CountDownLatch _receiveMessage;
- private Message _message;
-
@Override
public void setUp() throws Exception
{
@@ -65,100 +57,6 @@ public class JMSDestinationTest extends QpidBrokerTestCase
}
/**
- * Test a message sent to a queue comes back with JMSDestination queue
- *
- * @throws Exception
- */
- public void testQueue() throws Exception
- {
-
- Queue queue = createTestQueue(_session);
-
- MessageConsumer consumer = _session.createConsumer(queue);
-
- sendMessage(_session, queue, 1);
-
- _connection.start();
-
- Message receivedMessage = consumer.receive(10000);
-
- assertNotNull("Message should not be null", receivedMessage);
-
- Destination receivedDestination = receivedMessage.getJMSDestination();
-
- assertNotNull("JMSDestination should not be null", receivedDestination);
-
- assertEquals("Incorrect Destination type", queue.getClass(), receivedDestination.getClass());
- }
-
- /**
- * Test a message sent to a topic comes back with JMSDestination topic
- *
- * @throws Exception
- */
- public void testTopic() throws Exception
- {
-
- Topic topic = createTopic(_connection, getTestQueueName() + "Topic");
-
- MessageConsumer consumer = _session.createConsumer(topic);
-
- sendMessage(_session, topic, 1);
-
- _connection.start();
-
- Message receivedMessage = consumer.receive(10000);
-
- assertNotNull("Message should not be null", receivedMessage);
-
- Destination receivedDestination = receivedMessage.getJMSDestination();
-
- assertNotNull("JMSDestination should not be null", receivedDestination);
- assertEquals("Incorrect Destination type", topic.getClass(), receivedDestination.getClass());
- }
-
- /**
- * Test a message sent to a queue comes back with JMSDestination queue
- * when received via a message listener
- *
- * @throws Exception
- */
- public void testQueueAsync() throws Exception
- {
-
- Queue queue = createTestQueue(_session);
-
- MessageConsumer consumer = _session.createConsumer(queue);
-
- sendMessage(_session, queue, 1);
-
- _connection.start();
-
- _message = null;
- _receiveMessage = new CountDownLatch(1);
-
- consumer.setMessageListener(new MessageListener()
- {
- @Override
- public void onMessage(Message message)
- {
- _message = message;
- _receiveMessage.countDown();
- }
- });
-
- assertTrue("Timed out waiting for message to be received ", _receiveMessage.await(1, TimeUnit.SECONDS));
-
- assertNotNull("Message should not be null", _message);
-
- Destination receivedDestination = _message.getJMSDestination();
-
- assertNotNull("JMSDestination should not be null", receivedDestination);
-
- assertEquals("Incorrect Destination type", queue.getClass(), receivedDestination.getClass());
- }
-
- /**
* Test a message received without the JMS_QPID_DESTTYPE can be resent
* and correctly have the property set.
*
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac36ca5/systests/src/test/java/org/apache/qpid/test/client/message/JMSReplyToTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/test/client/message/JMSReplyToTest.java b/systests/src/test/java/org/apache/qpid/test/client/message/JMSReplyToTest.java
deleted file mode 100644
index 88594f6..0000000
--- a/systests/src/test/java/org/apache/qpid/test/client/message/JMSReplyToTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.test.client.message;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.IllegalStateException;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TemporaryQueue;
-
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-/**
- * Tests that {@link Message#setJMSReplyTo(Destination)} can be used to pass a {@link Destination} between
- * messaging clients as is commonly used in request/response messaging pattern implementations.
- */
-public class JMSReplyToTest extends QpidBrokerTestCase
-{
- private AtomicReference<Throwable> _caughtException = new AtomicReference<Throwable>();
- private Queue _requestQueue;
- private Connection _connection;
- private Session _session;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- _requestQueue = startAsyncRespondingJmsConsumerOnSeparateConnection();
-
- _connection = getConnection();
- _connection.start();
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- }
-
- public void testRequestResponseUsingJmsReplyTo() throws Exception
- {
- final String responseQueueName = getTestQueueName() + ".response";
- Queue replyToQueue = createTestQueue(_session, responseQueueName);
- sendRequestAndValidateResponse(replyToQueue);
- }
-
- public void testRequestResponseUsingTemporaryJmsReplyTo() throws Exception
- {
- TemporaryQueue replyToQueue = _session.createTemporaryQueue();
-
- sendRequestAndValidateResponse(replyToQueue);
- }
-
- private void sendRequestAndValidateResponse(Queue replyToQueue) throws JMSException, Exception
- {
- MessageConsumer replyConsumer = _session.createConsumer(replyToQueue);
-
- Message requestMessage = createRequestMessageWithJmsReplyTo(_session, replyToQueue);
- sendRequest(_requestQueue, _session, requestMessage);
-
- receiveAndValidateResponse(replyConsumer, requestMessage);
-
- assertNull("Async responder caught unexpected exception", _caughtException.get());
- }
-
- private Message createRequestMessageWithJmsReplyTo(Session session, Queue replyToQueue)
- throws JMSException
- {
- Message requestMessage = session.createTextMessage("My request");
- requestMessage.setJMSReplyTo(replyToQueue);
- return requestMessage;
- }
-
- private void sendRequest(final Queue requestQueue, Session session, Message requestMessage) throws Exception
- {
- MessageProducer producer = session.createProducer(requestQueue);
- producer.send(requestMessage);
- }
-
- private void receiveAndValidateResponse(MessageConsumer replyConsumer, Message requestMessage) throws JMSException
- {
- Message responseMessage = replyConsumer.receive(RECEIVE_TIMEOUT);
- assertNotNull("Response message not received", responseMessage);
- assertEquals("Correlation id of the response should match message id of the request",
- responseMessage.getJMSCorrelationID(), requestMessage.getJMSMessageID());
- }
-
- private Queue startAsyncRespondingJmsConsumerOnSeparateConnection() throws Exception
- {
- final String requestQueueName = getTestQueueName() + ".request";
- final Connection responderConnection = getConnection();
- responderConnection.start();
- final Session responderSession = responderConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- final Queue requestQueue = createTestQueue(responderSession, requestQueueName);
-
- final MessageConsumer requestConsumer = responderSession.createConsumer(requestQueue);
- requestConsumer.setMessageListener(new AsyncResponder(responderSession));
-
- return requestQueue;
- }
-
- private final class AsyncResponder implements MessageListener
- {
- private final Session _responderSession;
-
- private AsyncResponder(Session responderSession)
- {
- _responderSession = responderSession;
- }
-
- @Override
- public void onMessage(Message requestMessage)
- {
- try
- {
- Destination replyTo = getReplyToQueue(requestMessage);
-
- Message responseMessage = _responderSession.createMessage();
- responseMessage.setJMSCorrelationID(requestMessage.getJMSMessageID());
-
- sendResponseToQueue(replyTo, responseMessage);
- }
- catch (Throwable t)
- {
- _caughtException.set(t);
- }
- }
-
- private Destination getReplyToQueue(Message requestMessage) throws JMSException, IllegalStateException
- {
- Destination replyTo = requestMessage.getJMSReplyTo();
- if (replyTo == null)
- {
- throw new IllegalStateException("JMSReplyTo was null on message " + requestMessage);
- }
- return replyTo;
- }
-
- private void sendResponseToQueue(Destination replyTo, Message responseMessage)
- throws JMSException
- {
- MessageProducer responseProducer = _responderSession.createProducer(replyTo);
- responseProducer.send(responseMessage);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac36ca5/test-profiles/cpp.excludes
----------------------------------------------------------------------
diff --git a/test-profiles/cpp.excludes b/test-profiles/cpp.excludes
index b8cbd4b..d41d8fe 100644
--- a/test-profiles/cpp.excludes
+++ b/test-profiles/cpp.excludes
@@ -21,9 +21,6 @@
//Exclude the following tests when running all cpp test profilies
//======================================================================
-// This test requires a management interface to move messages
-org.apache.qpid.test.client.message.JMSDestinationTest#testMovedToQueue
-
// This test requires a broker capable of 0-8/9 and 0-10
org.apache.qpid.test.client.message.JMSDestinationTest#testReceiveResend
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org