summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-07-08 18:30:47 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-07-08 18:30:47 +0000
commitaf8ace82354ea9a0aaf4ee204d544cb6cdf10645 (patch)
treec3647ea497ac112b0381a5d4c6f63311d4ee3c8f
parent555b22988d27b1b6fb66280905d7c71becb59c43 (diff)
downloadqpid-python-af8ace82354ea9a0aaf4ee204d544cb6cdf10645.tar.gz
Contains test cases for QPID-2722 and QPID-2723
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@961869 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java101
1 files changed, 53 insertions, 48 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java b/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
index 48fed0f0f7..2fc83fa026 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
@@ -381,6 +381,11 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase
}
}
+ /**
+ * Test goal: Verifies if the new address format based destinations
+ * can be specified and loaded correctly from the properties file.
+ *
+ */
public void testLoadingFromPropertiesFile() throws Exception
{
Hashtable<String,String> map = new Hashtable<String,String>();
@@ -422,61 +427,61 @@ public class AddressBasedDestinationTest extends QpidBrokerTestCase
TextMessage msg = (TextMessage)cons3.receive(1000);
assertEquals("Destination3 was not created as expected.",msg.getText(),"Hello");
}
-
- /*public void testBindQueueForXMLExchange() throws Exception
+
+ /**
+ * Test goal: Verifies the subject can be overridden using "qpid.subject" message property.
+ * Test strategy: Creates and address with a default subject "topic1"
+ * Creates a message with "qpid.subject"="topic2" and sends it.
+ * Verifies that the message goes to "topic2" instead of "topic1".
+ */
+ public void testOverridingSubject() throws Exception
{
- if (!isCppBroker())
- {
- return;
- }
+ Session jmsSession = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
+
+ AMQDestination topic1 = new AMQAnyDestination("ADDR:amq.topic/topic1; {link:{name: queue1}}");
+ MessageProducer prod = jmsSession.createProducer(topic1);
+
+ Message m = jmsSession.createTextMessage("Hello");
+ m.setStringProperty("qpid.subject", "topic2");
+ MessageConsumer consForTopic1 = jmsSession.createConsumer(topic1);
+ MessageConsumer consForTopic2 = jmsSession.createConsumer(new AMQAnyDestination("ADDR:amq.topic/topic2; {link:{name: queue2}}"));
+
+ prod.send(m);
+ Message msg = consForTopic1.receive(1000);
+ assertNull("message shouldn't have been sent to topic1",msg);
+
+ msg = consForTopic2.receive(1000);
+ assertNotNull("message should have been sent to topic2",msg);
+
+ }
+
+ public void testAddressBasedReplyTo() throws Exception
+ {
Session jmsSession = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
- ((AMQSession_0_10)jmsSession).sendExchangeDeclare("xml", "xml",null,null,false);
-
- String xQuery = "let $w := ./weather \n" +
- "return $w/station = \'Raleigh-Durham International Airport (KRDU)\' \n" +
- "and $w/temperature_f > 50 \n" +
- "and $w/temperature_f - $w/dewpoint > 5 \n" +
- "and $w/wind_speed_mph > 7 \n" +
- "and $w/wind_speed_mph < 20";
-
- String xmlExchangeBinding = "'xml; {xquery: " + xQuery + "} '";
-
- String addr = "ADDR:my-queue/hello; { " +
- "create: always, " +
- "node-properties: {" +
- "durable: true ," +
- "x-properties: { " +
- "auto-delete: true," +
- "'qpid.max_count': 100," +
- " bindings: ['amq.direct/test', 'amq.topic/a.#'," + xmlExchangeBinding + "]" +
-
- "}" +
- "}" +
- "}";
- AMQDestination dest = new AMQAnyDestination(addr);
- MessageConsumer cons = jmsSession.createConsumer(dest);
+ String addr = "ADDR:amq.direct/x512; {create: receiver, " +
+ "link : {name : 'MY.RESP.QUEUE', " +
+ "x-declare : { auto-delete: true, exclusive: true, " +
+ "'qpid.max_size': 1000, 'qpid.policy_type': ring } } }";
- assertTrue("Queue not created as expected",(
- (AMQSession_0_10)jmsSession).isQueueExist(dest, true));
+ Destination replyTo = new AMQAnyDestination(addr);
+ Destination dest =new AMQAnyDestination("ADDR:amq.direct/Hello");
- assertTrue("Queue not bound as expected",(
- (AMQSession_0_10)jmsSession).isQueueBound("",
- dest.getName(),dest.getName(), null));
+ MessageConsumer cons = jmsSession.createConsumer(dest);
+ MessageProducer prod = jmsSession.createProducer(dest);
+ Message m = jmsSession.createTextMessage("Hello");
+ m.setJMSReplyTo(replyTo);
+ prod.send(m);
- assertTrue("Queue not bound as expected",(
- (AMQSession_0_10)jmsSession).isQueueBound("amq.direct",
- dest.getName(),"test", null));
-
- assertTrue("Queue not bound as expected",(
- (AMQSession_0_10)jmsSession).isQueueBound("amq.topic",
- dest.getName(),"a.#", null));
+ Message msg = cons.receive(1000);
+ assertNotNull("consumer should have received the message",msg);
- Address a = Address.parse(xmlExchangeBinding);
- assertTrue("Queue not bound as expected",(
- (AMQSession_0_10)jmsSession).isQueueBound("xml",
- dest.getName(),null, a.getOptions()));
+ MessageConsumer replyToCons = jmsSession.createConsumer(replyTo);
+ MessageProducer replyToProd = jmsSession.createProducer(msg.getJMSReplyTo());
+ replyToProd.send(jmsSession.createTextMessage("reply"));
- }*/
+ Message replyToMsg = replyToCons.receive(1000);
+ assertNotNull("The reply to consumer should have got the message",replyToMsg);
+ }
}