qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r1031364 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
Date Fri, 05 Nov 2010 00:09:55 GMT
Author: rajith
Date: Fri Nov  5 00:09:54 2010
New Revision: 1031364

URL: http://svn.apache.org/viewvc?rev=1031364&view=rev
Log:
Added a test case for QPID-2737, QPID-2774, QPID-2928

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=1031364&r1=1031363&r2=1031364&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
Fri Nov  5 00:09:54 2010
@@ -280,6 +280,10 @@ public class AddressBasedDestinationTest
         assertTrue("Queue not bound as expected",(
                 (AMQSession_0_10)jmsSession).isQueueBound("my-exchange", 
                     dest.getQueueName(),"hello", Collections.<String, Object>emptyMap()));
+        
+        // The client should be able to query and verify the existence of my-exchange (QPID-2774)
+        dest = new AMQAnyDestination("ADDR:my-exchange; {create: never}");
+        cons = jmsSession.createConsumer(dest); 
     }
     
     public void testBindQueueWithArgs() throws Exception
@@ -684,9 +688,11 @@ public class AddressBasedDestinationTest
     }
     
     /**
-     * Test Goal : Verify that unique subscription queues are created when consumers are
-     *             created using the same destination except when the subscription queue
-     *             has a name.
+     * Test Goal : When the same destination is used when creating two consumers,
+     *             If the type == topic, verify that unique subscription queues are created,

+     *             unless subscription queue has a name.
+     *             
+     *             If the type == queue, same queue should be shared.
      */
     public void testSubscriptionForSameDestination() throws Exception
     {
@@ -715,6 +721,28 @@ public class AddressBasedDestinationTest
         catch(Exception e)
         {            
         }
+        _connection.close();
+        
+        _connection = getConnection() ;
+        _connection.start();
+        ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);        
+        dest = ssn.createTopic("ADDR:my_queue; {create: always}");
+        consumer1 = ssn.createConsumer(dest);
+        consumer2 = ssn.createConsumer(dest);
+        prod = ssn.createProducer(dest);
+        
+        prod.send(ssn.createTextMessage("A"));
+        Message m1 = consumer1.receive(1000); 
+        Message m2 = consumer2.receive(1000);
+        
+        if (m1 != null)
+        {
+            assertNull("Only one consumer should receive the message",m2);  
+        }
+        else
+        {
+            assertNotNull("Only one consumer should receive the message",m2);  
+        }
     }
  
     public void testXBindingsWithoutExchangeName() throws Exception
@@ -752,4 +780,20 @@ public class AddressBasedDestinationTest
         assertNotNull("consumer should receive a message",cons.receive(1000));
         cons.close();
     }
+    
+    public void testXSubscribeOverrides() throws Exception
+    {
+        Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
+        String str = "ADDR:my_queue; {create:always,link: {x-subscribes:{exclusive: true,
arguments: {a:b,x:y}}}}";
+        Destination dest = ssn.createTopic(str);
+        MessageConsumer consumer1 = ssn.createConsumer(dest);
+        try
+        {
+            MessageConsumer consumer2 = ssn.createConsumer(dest);
+            fail("An exception should be thrown as 'my-queue' already have an exclusive subscriber");
+        }
+        catch(Exception e)
+        {            
+        }
+    }
 }



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


Mime
View raw message