You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2011/04/06 20:08:45 UTC

svn commit: r1089554 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java

Author: rajith
Date: Wed Apr  6 18:08:44 2011
New Revision: 1089554

URL: http://svn.apache.org/viewvc?rev=1089554&view=rev
Log:
QPID-3182
Added a test case to cover the above issue.
This class can use a bit of refactoring and some consolidation of test cases.
Hoping to do that soon.

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java?rev=1089554&r1=1089553&r2=1089554&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java Wed Apr  6 18:08:44 2011
@@ -194,9 +194,7 @@ public class AddressBasedDestinationTest
                     dest.getAddressName(),dest.getAddressName(), dest.getSourceNode().getDeclareArgs()));
         
     }
-    
-    // todo add tests for delete options
-    
+ 
     public void testCreateQueue() throws Exception
     {
         Session jmsSession = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
@@ -293,16 +291,40 @@ public class AddressBasedDestinationTest
         cons = jmsSession.createConsumer(dest); 
     }
     
+    public void checkQueueForBindings(Session jmsSession, AMQDestination dest,String headersBinding) throws Exception
+    {
+    	assertTrue("Queue not created as expected",(
+                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
+        
+        assertTrue("Queue not bound as expected",(
+                (AMQSession_0_10)jmsSession).isQueueBound("", 
+                    dest.getAddressName(),dest.getAddressName(), null));
+        
+        assertTrue("Queue not bound as expected",(
+                (AMQSession_0_10)jmsSession).isQueueBound("amq.direct", 
+                    dest.getAddressName(),"test", null));  
+      
+        assertTrue("Queue not bound as expected",(
+                (AMQSession_0_10)jmsSession).isQueueBound("amq.topic", 
+                    dest.getAddressName(),"a.#", null));
+        
+        Address a = Address.parse(headersBinding);
+        assertTrue("Queue not bound as expected",(
+                (AMQSession_0_10)jmsSession).isQueueBound("amq.match", 
+                    dest.getAddressName(),null, a.getOptions()));
+    }
+    
+    /**
+     * Test goal: Verifies that a producer and consumer creation triggers the correct
+     *            behavior for x-bindings specified in node props.
+     */
     public void testBindQueueWithArgs() throws Exception
     {
-        Session jmsSession = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
         
+    	Session jmsSession = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
         String headersBinding = "{exchange: 'amq.match', arguments: {x-match: any, dep: sales, loc: CA}}";
         
-        String addr = "ADDR:my-queue/hello; " + 
-                      "{ " + 
-                           "create: always, " +
-                           "node: "  + 
+        String addr = "node: "  + 
                            "{" + 
                                "durable: true ," +
                                "x-declare: " + 
@@ -317,28 +339,14 @@ public class AddressBasedDestinationTest
                            "}" +
                       "}";
 
-        AMQDestination dest = new AMQAnyDestination(addr);
-        MessageConsumer cons = jmsSession.createConsumer(dest); 
-        
-        assertTrue("Queue not created as expected",(
-                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true));              
-        
-        assertTrue("Queue not bound as expected",(
-                (AMQSession_0_10)jmsSession).isQueueBound("", 
-                    dest.getAddressName(),dest.getAddressName(), null));
         
-        assertTrue("Queue not bound as expected",(
-                (AMQSession_0_10)jmsSession).isQueueBound("amq.direct", 
-                    dest.getAddressName(),"test", null));  
-      
-        assertTrue("Queue not bound as expected",(
-                (AMQSession_0_10)jmsSession).isQueueBound("amq.topic", 
-                    dest.getAddressName(),"a.#", null));
-        
-        Address a = Address.parse(headersBinding);
-        assertTrue("Queue not bound as expected",(
-                (AMQSession_0_10)jmsSession).isQueueBound("amq.match", 
-                    dest.getAddressName(),null, a.getOptions()));
+        AMQDestination dest1 = new AMQAnyDestination("ADDR:my-queue/hello; {create: receiver, " +addr);
+        MessageConsumer cons = jmsSession.createConsumer(dest1); 
+        checkQueueForBindings(jmsSession,dest1,headersBinding);       
+        
+        AMQDestination dest2 = new AMQAnyDestination("ADDR:my-queue2/hello; {create: sender, " +addr);
+        MessageProducer prod = jmsSession.createProducer(dest2); 
+        checkQueueForBindings(jmsSession,dest2,headersBinding);     
     }
     
     /**



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org